function clearSumCache() { if ($_POST['option_clear_sum'] == 'on') { $qry = DBFactory::getDBQuery(); $qry->execute("DELETE FROM kb3_sum_alliance"); $qry->execute("DELETE FROM kb3_sum_corp"); $qry->execute("DELETE FROM kb3_sum_pilot"); // Clear page and query cache as well since they also contain the // summaries. CacheHandler::removeByAge('SQL', 0, true); CacheHandler::removeByAge('store', 0, true); $_POST['option_clear_sum'] == 'off'; } }
$page_error[] = "Could not unlink " . $curFile; } } } } if ($readingZip->getErrors()) { $page_error[] = $readingZip->getErrors(); } else { Config::set('upd_CodeVersion', $piece['version']); $qry = DBFactory::getDBQuery(true); $qry->execute("INSERT INTO `kb3_config` (cfg_site, cfg_key, cfg_value) " . "SELECT cfg_site, 'upd_codeVersion', '{$piece['version']}' FROM `kb3_config` " . "GROUP BY cfg_site ON DUPLICATE KEY UPDATE cfg_value = '{$piece['version']}';"); $codeversion = $piece['version']; } //kill the template and page caches CacheHandler::removeByAge('store', 0, true); CacheHandler::removeByAge('templates_c', 0, true); break; } } } } } } //if we've finished an action, reparse the xml if (isset($_GET['db_apply_ref']) || isset($_GET['db_dl_ref']) || isset($_GET['code_apply_ref']) || isset($_GET['code_dl_ref'])) { $parser->retrieveData(); } //list the db updates $db = $parser->getDBInfo(); $lowestDB = $parser->getLowestDBVersion(); if ($parser->getLatestDBVersion() > $dbversion) {
// If the above doesn't work - place your working directory path to killboard root below - comment out the above two lines and uncomment the two below // Edit the path below with your webspace directory to the killboard root folder - also check your php folder is correct as defined by the first line of this file //$KB_HOME = "/home/yoursite/public_html/kb"; chdir($KB_HOME); require_once 'kbconfig.php'; require_once 'common/includes/globals.php'; require_once 'common/includes/db.php'; require_once 'common/includes/class.edkerror.php'; set_error_handler(array('EDKError', 'handler'), E_ERROR); @error_reporting(E_ERROR); // disable query caching while the script is running. $qcache = config::get('cfg_qcache'); if ($qcache) { echo "<br />\n File query cache disabled <br />\n"; config::set('cfg_qcache', 0); } echo "<br />Removed " . CacheHandler::removeByAge('SQL/', $maxSQLAge * 24) . " files from SQL/<br />\n"; echo "Removed " . CacheHandler::removeByAge('page/' . KB_SITE . '/', $maxOtherAge * 24) . " files from page/<br />\n"; echo "Removed " . CacheHandler::removeByAge("templates_c/", $maxOtherAge * 24) . " files from templates_c/<br />\n"; echo "Removed " . CacheHandler::removeByAge("mail/", $maxOtherAge * 24) . " files from mail/<br />\n"; // Let's let people see their latest beautiful creation in the character creator. echo "Removed " . CacheHandler::removeByAge('img/', $maxImageAge * 24) . " files from img/<br />\n"; //echo "Removed ".CacheHandler::removeBySize('img/', 512 * 24)." files from img/<br />\n"; //echo "Removed ".CacheHandler::removeByAge('store/', 7 * 24)." files from store/<br />\n"; echo "Removed " . CacheHandler::removeBySize('store/', $maxStoreSize) . " files from store/<br />\n"; echo "Removed " . CacheHandler::removeByAge('api/', $maxAPIAge * 24) . " files from api/<br />\n"; //echo "Removed ".CacheHandler::removeByAge('/', 30 * 24, false)." files from entire cache<br />\n"; if ($qcache) { echo "<br />\n File query cache re-enabled <br />\n"; config::set('cfg_qcache', 1); }
/** * Checks if theme has changed and updates page before display. */ function changeTheme() { global $themename; if (options::getPrevious('theme_name') == $_POST['option_theme_name']) { return; } $themename = preg_replace('/[^a-zA-Z0-9-_]/', '', $_POST['option_theme_name']); if (!is_dir("themes/{$themename}")) { $themename = 'default'; } $_POST['option_theme_name'] = $themename; config::set('theme_name', $themename); global $smarty; $smarty->assign('theme_url', config::get('cfg_kbhost') . '/themes/' . $themename); $smarty->assign('theme_name', $themename); $smarty->template_dir = './themes/' . $themename . '/templates'; if (!file_exists(KB_CACHEDIR . '/templates_c/' . $themename . '/')) { mkdir(KB_CACHEDIR . '/templates_c/' . $themename . '/', 0755, true); } $smarty->compile_dir = KB_CACHEDIR . '/templates_c/' . $themename . '/'; CacheHandler::removeByAge('templates_c/' . $themename, 0, false); }