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
This commit is contained in:
Andreas Gohr 2010-06-26 12:11:13 +02:00
parent 80601d2689
commit 345b1674b6
1 changed files with 17 additions and 2 deletions

View File

@ -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!");
}
}
}
/**