/**
  * @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();
 }
Esempio n. 2
0
 /**
  * @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);
 }
 /**
  * @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);
 }