/**
  * キャッシュクリア
  *
  * @param <type> $targetsData
  */
 public function clearCache($module, $controller, $action, $option)
 {
     // デバッグ
     if ($this->_debug_mode) {
         return;
     }
     // ロックをかける処理かどうかのチェック
     if (isset($this->_cacheTargetList->lock->{$module}->{$controller}->{$action})) {
         $target = $this->_cacheTargetList->lock->{$module}->{$controller}->{$action};
         $targets = explode(',', $target);
     } else {
         return;
     }
     // 指定された分キャッシュデータを削除
     foreach ($targets as $target) {
         // オプションあり?
         if ($option != '') {
             $target .= '_' . $option;
         }
         // ターゲットあり
         if (isset($this->_cacheTargetList->delete->{$target})) {
             // 配列化
             $list = $this->_cacheTargetList->delete->{$target}->toArray();
             // 空であればNULLを格納
             if (empty($list['file'])) {
                 $list['file'] = null;
             }
             // 配列に統一
             if (!is_array($list['cache_id'])) {
                 $cacheList = array($list['cache_id']);
             } else {
                 $cacheList = $list['cache_id'];
             }
             foreach ($cacheList as $cache_id) {
                 // キャッシュ
                 $this->_smarty->clear_cache($list['file'], $_SERVER['HTTP_HOST'] . $cache_id);
             }
         }
     }
     // ロック解除
     $this->unlockForCache();
 }
Beispiel #2
0
 public function ClearCache($cache_id = null, $compile_id = null, $exp_time = null)
 {
     return parent::clear_cache($this->_template, $cache_id, $compile_id, $exp_time);
 }
Beispiel #3
0
if (caching == 1) {
    // this is to clear the cache and reload it for settings_from_db.php
    clearCatCache();
}
// breadcrumbs and page title
$navwhere['text1'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel');
$navwhere['link1'] = getmyurl('admin', '');
$navwhere['text2'] = $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel_2');
$navwhere['link2'] = my_pligg_base . "/admin_categories.php";
$main_smarty->assign('navbar_where', $navwhere);
$main_smarty->assign('posttitle', " / " . $main_smarty->get_config_vars('PLIGG_Visual_Header_AdminPanel'));
if ($canIhaveAccess == 1) {
    // clear the category sidebar module from the cache so it can regenerate in case we make changes
    $main_smarty->cache = 2;
    $main_smarty->cache_dir = "cache";
    $main_smarty->clear_cache();
    $main_smarty->cache = false;
    $main_smarty = do_sidebar($main_smarty);
    $QEIPA = array('table_name' => table_categories, 'field_name' => 'category_name', 'key' => 'category__auto_id');
    // a unique identifier for the row
    $main_smarty->assign('qeip_CatName', $QEIPA);
    $QEIPA = array('table_name' => table_categories, 'field_name' => 'category_parent', 'key' => 'category__auto_id');
    // a unique identifier for the row
    $main_smarty->assign('qeip_CatParent', $QEIPA);
    $QEIPA = array('table_name' => table_categories, 'field_name' => 'category_order', 'key' => 'category__auto_id');
    // a unique identifier for the row
    $main_smarty->assign('qeip_CatOrder', $QEIPA);
    $QEIPA = array('table_name' => table_categories, 'field_name' => 'category_desc', 'key' => 'category__auto_id');
    // a unique identifier for the row
    $main_smarty->assign('qeip_CatDesc', $QEIPA);
    $QEIPA = array('table_name' => table_categories, 'field_name' => 'category_keywords', 'key' => 'category__auto_id');
 /**
  * clear the entire contents of cache (all templates)
  *
  * Smarty's original clear_all_cache function calls the subclasse's
  * clear_cache function. As we always prepend the module name, this
  * doesn't work here...
  *
  * @param string $exp_time expire time
  * @return boolean results of {@link smarty_core_rm_auto()}
  */
 function clear_all_cache($exp_time = null)
 {
     return parent::clear_cache(null, null, null, $exp_time);
 }
Beispiel #5
0
 /**
  * 重载Smarty中的clear_cache方法
  * @param	string	$tpl_file	模板的位置
  * @param	mixed	$cache_id	缓存的ID
  */
 public function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null)
 {
     if (is_null($tpl_file)) {
         $tpl_file = $_GET['m'] . '/' . $_GET['a'] . '.' . TPLPREFIX;
     } else {
         if (strstr($tpl_file, '/')) {
             $tpl_file = $tpl_file . TPLPREFIX;
         } else {
             $tpl_file = $_GET['m'] . '/' . $tpl_file . '.' . TPLPREFIX;
         }
     }
     return parent::clear_cache($tpl_file, $cache_id, $compile_id, $exp_time);
 }
Beispiel #6
0
 function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null)
 {
     if (is_null($tpl_file)) {
         $tpl_file = "{$_GET["m"]}/{$_GET["a"]}." . TPLPREFIX;
     } else {
         if (strstr($tpl_file, "/")) {
             $tpl_file = $tpl_file . "." . TPLPREFIX;
         } else {
             $tpl_file = $_GET["m"] . "/" . $tpl_file . "." . TPLPREFIX;
         }
     }
     return parent::clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null);
 }
 /**
  * clear_cache * 这个用在比如我们删除某文章帖子的时候同时把缓存也删了,不占用磁盘空间
  * 
  * @Param $tpl_file 
  * @Param $cache_id 
  * @Param $compile_id 
  * @Param $exp_time 
  * @Access public
  * @Return void
  */
 function clear_cache($tpl_file = NULL, $cache_id = NULL, $compile_id = NULL, $exp_time = NULL)
 {
     if (empty($tpl_file)) {
         $tpl_file = $_GET['m'] . '/' . $_GET['a'] . '.' . TPL_PREFIX;
     } else {
         if (strstr($tpl_file, '/')) {
             $tpl_file = $tpl_file . '.' . TPL_PREFIX;
         } else {
             $tpl_file = $_GET['m'] . '/' . $tpl_file . '.' . TPL_PREFIX;
         }
     }
     parent::clear_cache($tpl_file, $cache_id, $compile_id, $exp_time);
 }
 function clear_cache($_smarty_tpl_file = null, $_smarty_cache_id = null, $_smarty_compile_id = null, $_smarty_exp_time = null)
 {
     global $prefs, $style_base, $tikidomain;
     if (isset($prefs['style']) && isset($style_base) && isset($_smarty_tpl_file)) {
         if ($tikidomain and file_exists("templates/{$tikidomain}/styles/{$style_base}/{$_smarty_tpl_file}")) {
             $_smarty_tpl_file = "{$tikidomain}/styles/{$style_base}/{$_smarty_tpl_file}";
         } elseif ($tikidomain and file_exists("templates/{$tikidomain}/{$_smarty_tpl_file}")) {
             $_smarty_tpl_file = "{$tikidomain}/{$_smarty_tpl_file}";
         } elseif (file_exists("templates/styles/{$style_base}/{$_smarty_tpl_file}")) {
             $_smarty_tpl_file = "styles/{$style_base}/{$_smarty_tpl_file}";
         }
     }
     $_smarty_cache_id = $prefs['language'] . $_smarty_cache_id;
     $_smarty_compile_id = $prefs['language'] . $_smarty_compile_id;
     return parent::clear_cache($_smarty_tpl_file, $_smarty_cache_id, $_smarty_compile_id, $_smarty_exp_time);
 }
# this is needed, esp. for the play_field_types
# assign all the smarty variables we support
$smarty->assign('classname', $dt->get_camelcase_table_name());
$smarty->assign('objectname', $dt->get_java_object_name());
$smarty->assign('tablename', $tablename);
$smarty->assign('tablename_clean', $dt->get_clean_table_name());
$smarty->assign('tablename_clean_singular', $dt->get_clean_table_name_singular());
$smarty->assign('fields', $table_field_names);
# NEW
$smarty->assign('field_is_reqd', $dt->get_field_is_reqd());
$smarty->assign('camelcase_fields', $dt->get_camelcase_field_names());
$smarty->assign('fields_as_insert_csv_string', $dt->get_fields_as_insert_stmt_csv_list());
$smarty->assign('prep_stmt_as_insert_csv_string', $dt->get_prep_stmt_insert_csv_string());
$smarty->assign('prep_stmt_as_update_csv_string', $dt->get_fields_as_update_stmt_csv_list());
$smarty->assign('types', $dt->get_java_field_types());
$smarty->assign('scala_field_types', $dt->get_scala_field_types());
$smarty->assign('play_field_types', $dt->get_play_field_types());
$smarty->assign('play_json_field_types', $dt->get_play_json_field_types());
$smarty->assign('db_types', $dt->get_db_field_types());
$smarty->assign('dt', $dt);
# try to disable caching so template changes are picked up immediately
#$smarty->force_compile = 1;
#$smarty->clear_compiled_tpl("$template");
$smarty->clear_cache("{$template}");
# read and process the template with fetch(), then echo it out
$out = $smarty->fetch("{$template}");
echo $out;
$mdb->disconnect();
?>

Beispiel #10
0
 function store()
 {
     global $db, $current_user;
     $this->store_basic();
     $link_url = $db->escape($this->url);
     $link_url_title = $db->escape($this->url_title);
     $link_title = $db->escape($this->title);
     $link_title_url = $db->escape($this->title_url);
     if ($link_title_url == "") {
         $link_title_url = makeUrlFriendly($this->title);
     }
     $link_tags = $db->escape($this->tags);
     $link_content = $db->escape($this->content);
     $link_field1 = $db->escape($this->link_field1);
     $link_field2 = $db->escape($this->link_field2);
     $link_field3 = $db->escape($this->link_field3);
     $link_field4 = $db->escape($this->link_field4);
     $link_field5 = $db->escape($this->link_field5);
     $link_field6 = $db->escape($this->link_field6);
     $link_field7 = $db->escape($this->link_field7);
     $link_field8 = $db->escape($this->link_field8);
     $link_field9 = $db->escape($this->link_field9);
     $link_field10 = $db->escape($this->link_field10);
     $link_field11 = $db->escape($this->link_field11);
     $link_field12 = $db->escape($this->link_field12);
     $link_field13 = $db->escape($this->link_field13);
     $link_field14 = $db->escape($this->link_field14);
     $link_field15 = $db->escape($this->link_field15);
     $link_summary = $db->escape($this->link_summary);
     $db->query("UPDATE " . table_links . " set link_summary='{$link_summary}', link_title_url='{$link_title_url}', link_url='{$link_url}', link_url_title='{$link_url_title}', link_title='{$link_title}', link_content='{$link_content}', link_tags='{$link_tags}', link_field1='{$link_field1}', link_field2='{$link_field2}', link_field3='{$link_field3}', link_field4='{$link_field4}', link_field5='{$link_field5}', link_field6='{$link_field6}', link_field7='{$link_field7}', link_field8='{$link_field8}', link_field9='{$link_field9}', link_field10='{$link_field10}', link_field11='{$link_field11}', link_field12='{$link_field12}', link_field13='{$link_field13}', link_field14='{$link_field14}', link_field15='{$link_field15}' WHERE link_id={$this->id}");
     $pos = strrpos($_SERVER["SCRIPT_NAME"], "/");
     $script_name = substr($_SERVER["SCRIPT_NAME"], $pos + 1, 100);
     $script_name = str_replace(".php", "", $script_name);
     if ($this->count_all_votes() != 0 && $script_name != 'submit') {
         // clear the cache for that story that was voted on
         include_once 'Smarty.class.php';
         $votesmarty = new Smarty();
         $votesmarty->compile_dir = "templates_c/";
         $votesmarty->template_dir = "templates/";
         $votesmarty->config_dir = "";
         $votesmarty->cache_dir = "templates_c/";
         // enable caching at your own risk. this code is still experimental
         //$votesmarty->cache = true;
         $votesmarty->clear_cache($the_template . '/link_summary.tpl', 'story' . $this->id);
         $votesmarty = "";
     }
 }