XPressME Integration Kit

Trac


Ignore:
Timestamp:
Mar 6, 2009, 5:16:22 PM (15 years ago)
Author:
toemon
Message:

途中経過でインストール、アップデートできなくなってしまっていたバグ修正
イベント通知の部分をFix、(ゲストのモジュールアクセス権限がないと通知できないのは直らない)
ブロックのキャッシュを見直し、キャッシュがない場合と、ブロックオプションが変更された場合にリフレッシュする機能を追加
ブロックキャッシュの更新にてポスト削除時のイベントをDB削除前にとっていたバグを修正。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/plugins/xpressme/include/xpress_common_functions.php

    r95 r96  
    4949} 
    5050 
     51function is_block_cache_found($block_name) 
     52{ 
     53        global $xoops_config; 
     54        $mydirname = get_xpress_dir_name(); 
     55 
     56        if(defined('XOOPS_ROOT_PATH')){ 
     57                $cache_dir = XOOPS_ROOT_PATH . '/cache/'; 
     58        } else { 
     59                $cache_dir = $xoops_config->xoops_root_path . '/cache/'; 
     60        } 
     61        $xml_name = $block_name . '.xml'; 
     62 
     63    $filename = $cache_dir .$mydirname . '_' . $xml_name; 
     64        $cache_time = 0; 
     65//        if (file_exists($filename) && ((time() - filemtime($filename)) < $cache_time)) { 
     66    if (file_exists($filename)) { 
     67        return true; 
     68        } else { 
     69                return false; 
     70        } 
     71} 
     72 
     73 
     74//When there is no block cash, and an optional block is different, false is returned. 
     75function is_block_cache_normal() 
     76{ 
     77        global $xoops_config; 
     78        global $xoops_db; 
     79        $mid = get_xpress_modid(); 
     80        $sql = "SELECT bid,options,func_file FROM " . get_xoops_prefix() . "newblocks WHERE mid = $mid "; 
     81        $blocks = $xoops_db->get_results($sql); 
     82        $mydirname = get_xpress_dir_name(); 
     83        require_once get_xpress_dir_path() . '/include/xpress_block_render.php'; 
     84 
     85        foreach($blocks as $block){ 
     86                $func_file = $block->func_file; 
     87                $call_theme_function_name = str_replace(".php", "", $func_file); 
     88                $inc_theme_file_name = str_replace(".php", "", $func_file) . '_theme.php'; 
     89                $cache_title = str_replace(".php", "", $func_file); 
     90                $blockID = $block->bid; 
     91                $options = explode("|", $block->options); 
     92                 
     93                if (!is_block_cache_found($cache_title . $blockID)) return false; 
     94                $xml = xpress_block_cache_read($mydirname,$cache_title. $blockID); 
     95                $options = ''; 
     96                $options = @$xml['block']['options']; 
     97                if( strcmp($options,$block->options) != 0 ) return false; 
     98        } 
     99        return true; 
     100} 
     101 
     102 
    51103function block_cache_refresh() 
    52104{ 
     
    71123                $block_render = $call_theme_function_name($options);            //The block name and the called function name should be assumed to be the same name.                     
    72124                $xml['block'] = $block_render; 
     125                $xml['block']['options'] = $block->options; 
    73126                xpress_block_cache_write($mydirname,$cache_title. $blockID, $xml); 
    74127        } 
Note: See TracChangeset for help on using the changeset viewer.