From: Tim Otten Date: Sun, 23 Aug 2015 16:05:55 +0000 (-0700) Subject: CRM_Core_BAO_Preferences - Remove unused file/class/functions X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=7bce9b92b2d47457b6628b9c9f8b613f5b3ef9ac;p=civicrm-core.git CRM_Core_BAO_Preferences - Remove unused file/class/functions --- diff --git a/CRM/Core/BAO/Preferences.php b/CRM/Core/BAO/Preferences.php deleted file mode 100644 index b80a9ce1fc..0000000000 --- a/CRM/Core/BAO/Preferences.php +++ /dev/null @@ -1,152 +0,0 @@ -fetch()) { - if (!isset($params[$dao->valueName])) { - continue; - } - if ($dao->optionName == 'directory_preferences') { - $dirParams[$dao->valueName] = CRM_Utils_Array::value($dao->valueName, $params, ''); - } - else { - $urlParams[$dao->valueName] = CRM_Utils_Array::value($dao->valueName, $params, ''); - } - unset($params[$dao->valueName]); - } - - if (!empty($dirParams)) { - CRM_Core_BAO_Preferences::storeDirectoryOrURLPreferences($dirParams, 'directory'); - } - - if (!empty($urlParams)) { - CRM_Core_BAO_Preferences::storeDirectoryOrURLPreferences($urlParams, 'url'); - } - } - - /** - * @param array $params - * @param string $type - */ - public static function storeDirectoryOrURLPreferences(&$params, $type = 'directory') { - $optionName = ($type == 'directory') ? 'directory_preferences' : 'url_preferences'; - - $sql = " -UPDATE civicrm_option_value v, - civicrm_option_group g -SET v.value = %1, - v.is_active = 1 -WHERE g.name = %2 -AND v.option_group_id = g.id -AND v.name = %3 -"; - - foreach ($params as $name => $value) { - // always try to store relative directory or url from CMS root - if ($type == 'directory') { - $value = CRM_Utils_File::relativeDirectory($value); - } - else { - $value = CRM_Utils_System::relativeURL($value); - } - $sqlParams = array( - 1 => array($value, 'String'), - 2 => array($optionName, 'String'), - 3 => array($name, 'String'), - ); - CRM_Core_DAO::executeQuery($sql, $sqlParams); - } - } - - /** - * @param array $params - * @param bool $setInConfig - */ - public static function retrieveDirectoryAndURLPreferences(&$params, $setInConfig = FALSE) { - if ($setInConfig) { - $config = CRM_Core_Config::singleton(); - } - - $sql = " -SELECT v.name as valueName, v.value, g.name as optionName -FROM civicrm_option_value v, - civicrm_option_group g -WHERE ( g.name = 'directory_preferences' -OR g.name = 'url_preferences' ) -AND v.option_group_id = g.id -AND v.is_active = 1 -"; - - $dao = CRM_Core_DAO::executeQuery($sql); - while ($dao->fetch()) { - if (!$dao->value) { - continue; - } - if ($dao->optionName == 'directory_preferences') { - $value = CRM_Utils_File::absoluteDirectory($dao->value); - } - else { - // CRM-7622: we need to remove the language part - $value = CRM_Utils_System::absoluteURL($dao->value, TRUE); - } - $params[$dao->valueName] = $value; - if ($setInConfig) { - $config->{$dao->valueName} = $value; - } - } - } - -}