diff --git a/inc/init.php b/inc/init.php index 20263f95a..9a3eaf9c9 100644 --- a/inc/init.php +++ b/inc/init.php @@ -304,8 +304,7 @@ function init_paths(){ function init_files(){ global $conf; - $files = array( $conf['indexdir'].'/page.idx', - $conf['indexdir'].'/title.idx'); + $files = array($conf['indexdir'].'/page.idx'); foreach($files as $file){ if(!@file_exists($file)){ @@ -318,6 +317,22 @@ function init_files(){ } } } + + # create title index (needs to have same length as page.idx) + $file = $conf['indexdir'].'/title.idx'; + if(!@file_exists($file)){ + $pages = file($conf['indexdir'].'/page.idx'); + $pages = count($pages); + $fh = @fopen($file,'a'); + if($fh){ + for($i=0; $i<$pages; $i++){ + fwrite($fh,"\n"); + } + fclose($fh); + }else{ + nice_die("$file is not writable. Check your permissions settings!"); + } + } } /**