当前位置: 首页>>代码示例>>PHP>>正文


PHP KTConfig::clearCache方法代码示例

本文整理汇总了PHP中KTConfig::clearCache方法的典型用法代码示例。如果您正苦于以下问题:PHP KTConfig::clearCache方法的具体用法?PHP KTConfig::clearCache怎么用?PHP KTConfig::clearCache使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KTConfig的用法示例。


在下文中一共展示了KTConfig::clearCache方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: saveSettings

 /**
  * Save any modified settings, clear the cached settings and return the new settings
  *
  * @param array $currentSettings
  * @return array
  */
 function saveSettings($currentSettings, $log = false)
 {
     $newSettings = isset($_POST['configArray']) ? $_POST['configArray'] : '';
     if (!empty($newSettings)) {
         $this->addInfoMessage(_kt('The configuration settings have been updated.'));
         if ($log) {
             $comment = array();
         }
         // If the value in the post array is different from the current value, then update the DB
         foreach ($currentSettings as $setting) {
             $new = $newSettings[$setting['id']];
             if ($setting['value'] != $new) {
                 // Update the value
                 $res = DBUtil::autoUpdate('config_settings', array('value' => $new), $setting['id']);
                 if (PEAR::isError($res)) {
                     $this->addErrorMessage(sprintf(_kt("The setting %s could not be updated: %s"), $setting['display_name'], $res->getMessage()));
                 }
                 if ($log) {
                     $comment[] = sprintf(_kt("%s from %s to %s"), $setting['display_name'], $setting['value'], $new);
                 }
             }
         }
         if ($log) {
             $this->logTransaction($comment);
         }
         // Clear the cached settings
         $oKTConfig = new KTConfig();
         $oKTConfig->clearCache();
         // Get the new settings from the DB
         $currentSettings = $this->getSettings();
     }
     return $currentSettings;
 }
开发者ID:5haman,项目名称:knowledgetree,代码行数:39,代码来源:configSettings.php

示例2: performPostUpgradeActions

function performPostUpgradeActions()
{
    // This is just to test and needs to be updated to a more sane and error resistent architrcture if it works.
    // It should idealy work the same as the upgrades.
    global $default;
    // Ensure all plugins are re-registered.
    $sql = "TRUNCATE plugin_helper";
    $res = DBUtil::runQuery($sql);
    // Clear out all caches and proxies - they need to be regenerated with the new code
    $proxyDir = $default->proxyCacheDirectory;
    KTUtil::deleteDirectory($proxyDir);
    $oKTCache = new KTCache();
    $oKTCache->deleteAllCaches();
    // Clear the configuration cache, it'll regenerate on next load
    $oKTConfig = new KTConfig();
    $oKTConfig->clearCache();
    // Unlock the scheduler
    $lockFile = $default->cacheDirectory . DIRECTORY_SEPARATOR . 'scheduler.lock';
    if (file_exists($lockFile)) {
        @unlink($lockFile);
    }
    return true;
}
开发者ID:sfsergey,项目名称:knowledgetree,代码行数:23,代码来源:upgrade.php


注:本文中的KTConfig::clearCache方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。