summaryrefslogtreecommitdiff
path: root/inc/indexer.php
diff options
context:
space:
mode:
authorMichael Hamann <michael@content-space.de>2013-01-26 11:18:52 +0100
committerMichael Hamann <michael@content-space.de>2013-01-26 11:18:52 +0100
commit25adeb91ff207452ebd6275707b8a0cc3121db6c (patch)
tree837a291b14497626a7ecc6386cbbd8c47cf6a5cb /inc/indexer.php
parentaf73bba62fb11d7872a8b108b156d451302695bd (diff)
downloadrpg-25adeb91ff207452ebd6275707b8a0cc3121db6c.tar.gz
rpg-25adeb91ff207452ebd6275707b8a0cc3121db6c.tar.bz2
Indexer: added internal deletePageNoLock method
The new deletePageNoLock method is used by renamePage and avoids that the index needs to be unlocked and locked again for deleting the page.
Diffstat (limited to 'inc/indexer.php')
-rw-r--r--inc/indexer.php25
1 files changed, 19 insertions, 6 deletions
diff --git a/inc/indexer.php b/inc/indexer.php
index 37ca92055..c08e438bf 100644
--- a/inc/indexer.php
+++ b/inc/indexer.php
@@ -360,10 +360,8 @@ class Doku_Indexer {
$new_id = array_search($newpage, $pages);
if ($new_id !== false) {
- $this->unlock();
// make sure the page is not in the index anymore
- $this->deletePage($newpage);
- if (!$this->lock()) return 'locked';
+ $this->deletePageNoLock($newpage);
$pages[$new_id] = 'deleted:'.time().rand(0, 9999);
}
@@ -440,6 +438,7 @@ class Doku_Indexer {
$this->unlock();
return true;
}
+
/**
* Remove a page from the index
*
@@ -453,10 +452,26 @@ class Doku_Indexer {
if (!$this->lock())
return "locked";
+ $result = $this->deletePageNoLock($page);
+
+ $this->unlock();
+
+ return $result;
+ }
+
+ /**
+ * Remove a page from the index without locking the index, only use this function if the index is already locked
+ *
+ * Erases entries in all known indexes.
+ *
+ * @param string $page a page name
+ * @return boolean the function completed successfully
+ * @author Tom N Harris <tnharris@whoopdedo.org>
+ */
+ protected function deletePageNoLock($page) {
// load known documents
$pid = $this->getPIDNoLock($page);
if ($pid === false) {
- $this->unlock();
return false;
}
@@ -482,7 +497,6 @@ class Doku_Indexer {
}
// Save the reverse index
if (!$this->saveIndexKey('pageword', '', $pid, "")) {
- $this->unlock();
return false;
}
@@ -499,7 +513,6 @@ class Doku_Indexer {
$this->saveIndexKey($metaname.'_p', '', $pid, '');
}
- $this->unlock();
return true;
}