|
Last change
on this file since 95 was
95,
checked in by toemon, 17 years ago
|
|
XOOPS mainfile.phpのdefine文を事前に読み取りwp-config.phpのDB接続関係を生成することにより、XOOPSシステムを必要なときだけ呼び出す仕組みを作る。
およびイベント通知関係の修正(まだゲストのアクセス権限がないと駄目)
|
|
File size:
1.5 KB
|
| Rev | Line | |
|---|
| [36] | 1 | <?php |
|---|
| 2 | |
|---|
| 3 | if(!function_exists("xpress_cache_read")): |
|---|
| 4 | function xpress_cache_read($mydirname,$collation_key) |
|---|
| 5 | { |
|---|
| [95] | 6 | global $xoops_config; |
|---|
| 7 | $cache_dir = $xoops_config->xoops_root_path . '/cache/'; |
|---|
| [36] | 8 | $cache_time = 0; |
|---|
| 9 | $filename = $cache_dir .$mydirname . '_' . $collation_key; |
|---|
| 10 | // if (file_exists($filename) && ((time() - filemtime($filename)) < $cache_time)) { |
|---|
| 11 | if (file_exists($filename)) { |
|---|
| 12 | return file_get_contents($filename); |
|---|
| 13 | } else { |
|---|
| 14 | return ''; |
|---|
| 15 | } |
|---|
| 16 | } |
|---|
| 17 | endif; |
|---|
| 18 | |
|---|
| 19 | if(!function_exists("xpress_cache_write")): |
|---|
| 20 | function xpress_cache_write($mydirname,$collation_key,$content) |
|---|
| 21 | { |
|---|
| [95] | 22 | global $xoops_config; |
|---|
| 23 | $cache_dir = $xoops_config->xoops_root_path . '/cache/'; |
|---|
| [36] | 24 | $cache_time = 0; |
|---|
| 25 | |
|---|
| 26 | $filename = $cache_dir .$mydirname . '_' . $collation_key; |
|---|
| 27 | // if ((time() - @filemtime($filename)) > $cache_time) { |
|---|
| 28 | $fp = fopen($filename, "w"); |
|---|
| 29 | flock($fp, 2); |
|---|
| 30 | fputs($fp, $content); |
|---|
| 31 | fclose($fp); |
|---|
| 32 | // } |
|---|
| 33 | } |
|---|
| 34 | endif; |
|---|
| 35 | |
|---|
| 36 | if(!function_exists("xpress_block_cache_clear")): |
|---|
| 37 | function xpress_cache_clear($mydirname) |
|---|
| 38 | { |
|---|
| [95] | 39 | global $xoops_config; |
|---|
| 40 | $cache_dir = $xoops_config->xoops_root_path . '/cache/'; |
|---|
| [36] | 41 | $cache_time = 0; |
|---|
| 42 | if ($dh = opendir($cache_dir)) { |
|---|
| 43 | while (($file = readdir($dh)) !== false) { |
|---|
| 44 | if (preg_match('/^' . preg_quote($mydirname) . '/', $file)) { |
|---|
| 45 | unlink($cache_dir.$file); |
|---|
| 46 | } |
|---|
| 47 | } |
|---|
| 48 | closedir($dh); |
|---|
| 49 | } |
|---|
| 50 | } |
|---|
| 51 | endif; |
|---|
| 52 | |
|---|
| 53 | ?> |
|---|
Note: See
TracBrowser
for help on using the repository browser.