From 345b1674b60537d4a68bce48f7cc106b771051c7 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Sat, 26 Jun 2010 12:11:13 +0200 Subject: [PATCH] create title.idx with the correct length FS#1978 The title.idx file needs to have exactly the same length as the page.idx. This patch creates the file with the correct length if it doesn't exist yet. If you upgrade in between you need to delete your data/index/title.idx file --- inc/init.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) 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!"); + } + } } /**