1<?php 2/** 3 * page4relesae index rebuilder 4 * authors Jonas Fourquier <jonas@mythtv-fr.org> 5 */ 6 7 8if (!defined('DOKU_INC')) 9 define('DOKU_INC', realpath(dirname(__FILE__) . '/../../../') . '/'); 10 11if (!defined('NL')) 12 define('NL', "\n"); 13 14require_once(DOKU_INC.'inc/init.php'); 15require_once(DOKU_INC.'inc/common.php'); 16require_once(DOKU_INC.'inc/pageutils.php'); 17require_once(DOKU_INC.'inc/auth.php'); 18require_once(DOKU_INC.'inc/search.php'); 19require_once(DOKU_INC.'inc/indexer.php'); 20 21//close session 22session_write_close(); 23 24header('Content-Type: text/plain; charset=utf-8'); 25 26if (!auth_isadmin()) { 27 die('for admins only'); 28} 29 30$pages = array(); 31search($pages, $conf['datadir'], 'search_allpages', array()); 32 33echo "\n====================================================\nScan des pages\n====================================================\n\n"; 34$page4release = array(); 35foreach ($pages as $page) { 36 echo '[['.$page['id'].']]'; 37 $filename = array_pop(explode(':',$page['id'])); 38 $release = p_get_metadata($page['id'], 'page4release',True); 39 if ($release) { 40 echo "\t$filename {{pour $release}}\n"; 41 $page4release[$filename][$page['id']] = $release; 42 } else { 43 echo "\n"; 44 } 45} 46echo "\n====================================================\nIndex des pages\n====================================================\n\n"; 47$pagesExpired = array(); 48foreach ($page4release as $filename => $pages) { 49 $pagesID = array_keys($pages); 50 echo $filename.': [['.join(']], [[',$pagesID)."]]\n"; 51 $pagesExpired = array_merge($pagesExpired,$pagesID); 52} 53io_saveFile($conf['indexdir'].'/page4release.idx', serialize($page4release)); 54echo "\n====================================================\nCache expiré\n====================================================\n\n"; 55foreach ($pagesExpired as $pageExpired) { 56 p_set_metadata($pageExpired, array('cache' => 'expire'), False, False); 57 echo $pageExpired."\n"; 58} 59?> 60