summaryrefslogtreecommitdiff
path: root/inc/init.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2010-06-26 12:11:13 +0200
committerAndreas Gohr <andi@splitbrain.org>2010-06-26 12:11:13 +0200
commit345b1674b60537d4a68bce48f7cc106b771051c7 (patch)
treeafbbe987f488c9c8a646bd1d449b3abeb3823b35 /inc/init.php
parent80601d26897c5dced80645aaf904085aa08b7bb9 (diff)
downloadrpg-345b1674b60537d4a68bce48f7cc106b771051c7.tar.gz
rpg-345b1674b60537d4a68bce48f7cc106b771051c7.tar.bz2
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
Diffstat (limited to 'inc/init.php')
-rw-r--r--inc/init.php19
1 files 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!");
+ }
+ }
}
/**