Add title index to the indexer files, improve indexer calls
This commit is contained in:
parent
159ef59620
commit
a0070b52bb
|
@ -152,6 +152,7 @@ function _clearindex(){
|
|||
_lock();
|
||||
_quietecho("Clearing index... ");
|
||||
io_saveFile($conf['indexdir'].'/page.idx','');
|
||||
io_saveFile($conf['indexdir'].'/title.idx','');
|
||||
$dir = @opendir($conf['indexdir']);
|
||||
if($dir!==false){
|
||||
while(($f = readdir($dir)) !== false){
|
||||
|
|
|
@ -233,9 +233,8 @@ function _ft_pageLookup(&$data){
|
|||
$in_ns = !$data['not_in_ns'];
|
||||
$in_title = !$data['not_in_title'];
|
||||
|
||||
global $conf;
|
||||
$pages = array_map('rtrim', file($conf['indexdir'].'/page.idx'));
|
||||
$titles = array_map('rtrim', file($conf['indexdir'].'/title.idx'));
|
||||
$pages = array_map('rtrim', idx_getIndex('page', ''));
|
||||
$titles = array_map('rtrim', idx_getIndex('title', ''));
|
||||
$pages = array_combine($pages, $titles);
|
||||
|
||||
if($id !== '' && cleanID($id) !== '') {
|
||||
|
|
|
@ -304,7 +304,8 @@ function init_paths(){
|
|||
function init_files(){
|
||||
global $conf;
|
||||
|
||||
$files = array( $conf['indexdir'].'/page.idx');
|
||||
$files = array( $conf['indexdir'].'/page.idx',
|
||||
$conf['indexdir'].'/title.idx');
|
||||
|
||||
foreach($files as $file){
|
||||
if(!@file_exists($file)){
|
||||
|
|
|
@ -255,7 +255,7 @@ function runSitemapper(){
|
|||
return false;
|
||||
}
|
||||
|
||||
$pages = file($conf['indexdir'].'/page.idx');
|
||||
$pages = idx_getIndex('page', '');
|
||||
print 'runSitemapper(): creating sitemap using '.count($pages).' pages'.NL;
|
||||
|
||||
// build the sitemap
|
||||
|
|
|
@ -354,24 +354,22 @@ class dokuwiki_xmlrpc_server extends IXR_IntrospectionServer {
|
|||
* List all pages - we use the indexer list here
|
||||
*/
|
||||
function listPages(){
|
||||
global $conf;
|
||||
|
||||
$list = array();
|
||||
$pages = file($conf['indexdir'] . '/page.idx');
|
||||
$pages = array_filter($pages, 'isVisiblePage');
|
||||
$pages = array_filter(array_filter(idx_getIndex('page', ''),
|
||||
'isVisiblePage'),
|
||||
'page_exists');
|
||||
|
||||
foreach(array_keys($pages) as $idx) {
|
||||
if(page_exists($pages[$idx])) {
|
||||
$perm = auth_quickaclcheck($pages[$idx]);
|
||||
if($perm >= AUTH_READ) {
|
||||
$page = array();
|
||||
$page['id'] = trim($pages[$idx]);
|
||||
$page['perms'] = $perm;
|
||||
$page['size'] = @filesize(wikiFN($pages[$idx]));
|
||||
$page['lastModified'] = new IXR_Date(@filemtime(wikiFN($pages[$idx])));
|
||||
$list[] = $page;
|
||||
}
|
||||
$perm = auth_quickaclcheck($pages[$idx]);
|
||||
if($perm < AUTH_READ) {
|
||||
continue;
|
||||
}
|
||||
$page = array();
|
||||
$page['id'] = trim($pages[$idx]);
|
||||
$page['perms'] = $perm;
|
||||
$page['size'] = @filesize(wikiFN($pages[$idx]));
|
||||
$page['lastModified'] = new IXR_Date(@filemtime(wikiFN($pages[$idx])));
|
||||
$list[] = $page;
|
||||
}
|
||||
|
||||
return $list;
|
||||
|
|
Loading…
Reference in New Issue