summaryrefslogtreecommitdiff
path: root/inc/indexer.php
diff options
context:
space:
mode:
authorMichael Hamann <michael@content-space.de>2011-01-22 23:06:00 +0100
committerMichael Hamann <michael@content-space.de>2011-01-22 23:06:00 +0100
commit4373c7b59390347515bcf9615f4e9133a5b88aee (patch)
tree744063170558dc6b95e3100215a9f2db55f59ca5 /inc/indexer.php
parentd64516f5d992bb47a765949743506d8433a07d55 (diff)
downloadrpg-4373c7b59390347515bcf9615f4e9133a5b88aee.tar.gz
rpg-4373c7b59390347515bcf9615f4e9133a5b88aee.tar.bz2
Indexer v3 Rewrite: _saveIndexKey now really writes on the desired line
Now _saveIndexKey inserts empty lines when the index isn't long enough. This is necessary because the page ids are taken from the global page index, but there is not every page in the metadata key specific index so e.g. line 10 might be the first entry in the index.
Diffstat (limited to 'inc/indexer.php')
-rw-r--r--inc/indexer.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/inc/indexer.php b/inc/indexer.php
index 087113587..34ce0cdd0 100644
--- a/inc/indexer.php
+++ b/inc/indexer.php
@@ -620,10 +620,16 @@ class Doku_Indexer {
while (($curline = fgets($ih)) !== false) {
fwrite($fh, (++$ln == $id) ? $line : $curline);
}
- if ($id > $ln)
+ if ($id > $ln) {
+ while ($id > ++$ln)
+ fwrite($fh, "\n");
fwrite($fh, $line);
+ }
fclose($ih);
} else {
+ $ln = -1;
+ while ($id > ++$ln)
+ fwrite($fh, "\n");
fwrite($fh, $line);
}
fclose($fh);