/** * Upgrade the passed preferences file * * @param string $prefs_file The preferences file to upgrade * * @return boolean * @access public */ function _upgrade($prefs_file) { // Start the upgrade if (!file_exists($prefs_file)) { echo "No Preferences found\n"; return FALSE; } //end if include_once $prefs_file; if (isset($preferences['user']['SQ_USER_SESSION_PREFS']['default'])) { $current = $preferences['user']['SQ_USER_SESSION_PREFS']['default']; $test = array_pop($preferences['user']['SQ_USER_SESSION_PREFS']['default']); if (!is_array($test)) { unset($preferences['user']['SQ_USER_SESSION_PREFS']['default']); $preferences['user']['SQ_USER_SESSION_PREFS']['default'] = array($current); // Save the new preferences if (!_savePreferences($preferences, $prefs_file)) { echo "Error saving file\n"; return FALSE; } //end if } //end if } //end if // Cleanup unset($preferences); // Finish echo "Done\n"; return TRUE; }
/** * Upgrade the passed preferences file * Remove tool_clear_squid_cache field, it shouldn't belong to preference system * * @param string $prefs_file The preferences file to upgrade * * @return boolean * @access public */ function _upgrade($prefs_file) { // Start the upgrade if (!file_exists($prefs_file)) { echo "Ignored\n"; return TRUE; } //end if include $prefs_file; if (isset($preferences['tool_clear_squid_cache'])) { unset($preferences['tool_clear_squid_cache']); // Save the new preferences if (!_savePreferences($preferences, $prefs_file)) { echo "Error saving file\n"; return FALSE; } //end if } else { echo "Ignored\n"; return TRUE; } // Cleanup unset($preferences); // Finish echo "Done\n"; return TRUE; }