/** * @see AdminToolsFunction::execute($data) */ public function execute($data) { parent::execute($data); $parameters = $data['parameters']['cache.clearCache']; if ($parameters['clearWCFCache']) { WCF::getCache()->clear(WCF_DIR . 'cache', '*.php', true); } if ($parameters['clearStandaloneCache']) { $sql = "SELECT packageDir FROM wcf" . WCF_N . "_package WHERE packageID = " . PACKAGE_ID; $row = WCF::getDB()->getFirstRow($sql); WCF::getCache()->clear($row['packageDir'] . 'cache', '*.php', true); } if ($parameters['clearTemplateCache']) { require_once WCF_DIR . 'lib/system/template/ACPTemplate.class.php'; ACPTemplate::deleteCompiledACPTemplates(); Template::deleteCompiledTemplates(); } if ($parameters['clearLanguageCache']) { LanguageEditor::deleteLanguageFiles('*', '*', '*'); } if ($parameters['clearStandaloneOptions']) { Options::resetCache(); Options::resetFile(); } $this->executed(); }
/** * @see Form::save() */ public function save() { parent::save(); // save options and affected package ids $saveOptions = $affectedPackageIDArray = array(); foreach ($this->cachedOptions as $option) { $saveOptions[$option['optionID']] = $option['optionValue']; $affectedPackageIDArray[] = $option['packageID']; } Options::save($saveOptions); // clear cache Options::resetCache(); // delete relevant options.inc.php's $affectedPackageIDArray = array_unique($affectedPackageIDArray); Options::resetFile($affectedPackageIDArray); $this->saved(); // show succes message WCF::getTPL()->assign('success', true); }
/** * Wrapper for UsersOnlineList->renderOnlineList() * @see UsersOnlineList::renderOnlineList() */ protected function renderOnlineList() { require_once WCF_DIR . 'lib/data/user/usersOnline/UsersOnlineList.class.php'; $usersOnlineList = new UsersOnlineList('', true); $usersOnlineList->renderOnlineList(); // check users online record $usersOnlineTotal = USERS_ONLINE_RECORD_NO_GUESTS ? $usersOnlineList->usersOnlineMembers : $usersOnlineList->usersOnlineTotal; if ($usersOnlineTotal > USERS_ONLINE_RECORD) { // save new users online record $sql = "UPDATE\twcf" . WCF_N . "_option\n\t\t\t\tSET\toptionValue = IF(" . $usersOnlineTotal . " > optionValue, " . $usersOnlineTotal . ", optionValue)\n\t\t\t\tWHERE\toptionName = 'users_online_record'\n\t\t\t\t\tAND packageID = " . PACKAGE_ID; WCF::getDB()->registerShutdownUpdate($sql); // save new record time if (TIME_NOW > USERS_ONLINE_RECORD_TIME) { $sql = "UPDATE\twcf" . WCF_N . "_option\n\t\t\t\t\tSET\toptionValue = IF(" . TIME_NOW . " > optionValue, " . TIME_NOW . ", optionValue)\n\t\t\t\t\tWHERE\toptionName = 'users_online_record_time'\n\t\t\t\t\t\tAND packageID = " . PACKAGE_ID; WCF::getDB()->registerShutdownUpdate($sql); } // reset options file require_once WCF_DIR . 'lib/acp/option/Options.class.php'; Options::resetFile(); } }
/** * @see Form::save() */ public function save() { parent::save(); // get option ids $sql = "SELECT\t\toptionName, optionID \n\t\t\tFROM\t\twcf" . WCF_N . "_option acp_option,\n\t\t\t\t\twcf" . WCF_N . "_package_dependency package_dependency\n\t\t\tWHERE \t\tacp_option.packageID = package_dependency.dependency\n\t\t\t\t\tAND package_dependency.packageID = " . PACKAGE_ID . "\n\t\t\tORDER BY\tpackage_dependency.priority"; $result = WCF::getDB()->sendQuery($sql); $optionIDArray = array(); while ($row = WCF::getDB()->fetchArray($result)) { $optionIDArray[$row['optionName']] = $row['optionID']; } // save foreach ($this->options as $name => $value) { if (isset($optionIDArray[$name])) { $sql = "UPDATE\twcf" . WCF_N . "_option\n\t\t\t\t\tSET\toptionValue = '" . escapeString($value) . "'\n\t\t\t\t\tWHERE\toptionID = " . $optionIDArray[$name]; WCF::getDB()->sendQuery($sql); } } // reset cache Options::resetFile(); Options::resetCache(); $this->saved(); // show success message WCF::getTPL()->assign('success', true); }