예제 #1
0
 function action()
 {
     set_time_limit(0);
     global $vars;
     $page = isset($vars['page']) ? $vars['page'] : '';
     if ($page != '') {
         $file = $this->get_cache_filename($page);
         @unlink($file);
         if (exec_page($page, '/^#contentsx/')) {
             $body = 'Recreated a cache of ';
         } else {
             $body = 'No #contentsx in ';
         }
         $body .= make_pagelink($page);
     } else {
         // remove all files
         $files = $this->get_cache_filenames();
         foreach ($files as $file) {
             unlink($file);
         }
         // execute all pages
         $exec_pages = exec_existpages('/^#contentsx/');
         if (empty($exec_pages)) {
             $body = '';
         } else {
             $links = array_map('make_pagelink', $exec_pages);
             $body = '<p>Following pages were executed to assure:</p>' . '<p>' . implode("<br />\n", $links) . '</p>';
         }
     }
     return array('msg' => 'Clean Contentsx Caches', 'body' => $body);
 }
예제 #2
0
 /**
  * Clean Table of Contents Cache Files
  */
 function clean_cache()
 {
     set_time_limit(0);
     global $vars;
     $page = isset($vars['page']) ? $vars['page'] : '';
     if ($page != '') {
         $toc = new PluginSonotsToc();
         $file = $toc->syntax['cachefile']($page);
         @unlink($file);
         if (exec_page($page, '/^#contentsx/')) {
             $body = 'Recreated a cache of ';
         } else {
             $body = 'No #contentsx in ';
         }
         $body .= make_pagelink($page);
     } else {
         $toc = new PluginSonotsToc();
         $file = $toc->syntax['cachefile']('hoge');
         $suffix = substr($file, strrpos($file, '.'));
         // remove all files
         $files = sonots::get_existfiles(CACHE_DIR, $suffix);
         foreach ($files as $file) {
             unlink($file);
         }
         // execute all pages
         $exec_pages = sonots::exec_existpages('', '/^#contentsx/');
         $links = array_map('make_pagelink', $exec_pages);
         $body = '<p>Following pages were executed to assure:</p>' . '<p>' . implode("<br />\n", $links) . '</p>';
     }
     return $body;
 }