Merge lp:~yoboy-leguesh/ubuntu-fr-doc/patch-index into lp:ubuntu-fr-doc

Proposed by YoBoY
Status: Merged
Merged at revision: 108
Proposed branch: lp:~yoboy-leguesh/ubuntu-fr-doc/patch-index
Merge into: lp:ubuntu-fr-doc
Diff against target: 73 lines (+16/-14)
2 files modified
inc/indexer.php (+16/-12)
inc/template.php (+0/-2)
To merge this branch: bzr merge lp:~yoboy-leguesh/ubuntu-fr-doc/patch-index
Reviewer Review Type Date Requested Status
Ubuntu-fr-webteam Pending
Review via email: mp+97805@code.launchpad.net

Description of the change

Correctif permettant de nettoyer les index quand une page est supprimée
(comportement attendu mais en défaut)
Nécessite une ré-indexation complète.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'inc/indexer.php'
2--- inc/indexer.php 2012-01-29 10:04:35 +0000
3+++ inc/indexer.php 2012-03-16 07:44:18 +0000
4@@ -351,7 +351,7 @@
5 return "locked";
6
7 // load known documents
8- $pid = $this->getIndexKey('page', '', $page);
9+ $pid = $this->addIndexKey('page', '', $page);
10 if ($pid === false) {
11 $this->unlock();
12 return false;
13@@ -389,6 +389,7 @@
14 $val_idx = explode(':', $this->getIndexKey($metaname.'_p', '', $pid));
15 $meta_idx = $this->getIndex($metaname.'_i', '');
16 foreach ($val_idx as $id) {
17+ if ($id === '') continue;
18 $meta_idx[$id] = $this->updateTuple($meta_idx[$id], $pid, 0);
19 }
20 $this->saveIndex($metaname.'_i', '', $meta_idx);
21@@ -1174,18 +1175,8 @@
22 * @author Tom N Harris <tnharris@whoopdedo.org>
23 */
24 function idx_addPage($page, $verbose=false, $force=false) {
25- // check if indexing needed
26 $idxtag = metaFN($page,'.indexed');
27- if(!$force && @file_exists($idxtag)){
28- if(trim(io_readFile($idxtag)) == idx_get_version()){
29- $last = @filemtime($idxtag);
30- if($last > @filemtime(wikiFN($page))){
31- if ($verbose) print("Indexer: index for $page up to date".DOKU_LF);
32- return false;
33- }
34- }
35- }
36-
37+ // check if page was deleted but is still in the index
38 if (!page_exists($page)) {
39 if (!@file_exists($idxtag)) {
40 if ($verbose) print("Indexer: $page does not exist, ignoring".DOKU_LF);
41@@ -1200,6 +1191,19 @@
42 @unlink($idxtag);
43 return $result;
44 }
45+
46+ // check if indexing needed
47+ if(!$force && @file_exists($idxtag)){
48+ if(trim(io_readFile($idxtag)) == idx_get_version()){
49+ $last = @filemtime($idxtag);
50+ if($last > @filemtime(wikiFN($page))){
51+ if ($verbose) print("Indexer: index for $page up to date".DOKU_LF);
52+ return false;
53+ }
54+ }
55+ }
56+
57+
58 $indexenabled = p_get_metadata($page, 'internal index', METADATA_RENDER_UNLIMITED);
59 if ($indexenabled === false) {
60 $result = false;
61
62=== modified file 'inc/template.php'
63--- inc/template.php 2012-01-29 10:23:34 +0000
64+++ inc/template.php 2012-03-16 07:44:18 +0000
65@@ -990,8 +990,6 @@
66 */
67 function tpl_indexerWebBug(){
68 global $ID;
69- global $INFO;
70- if(!$INFO['exists']) return false;
71
72 $p = array();
73 $p['src'] = DOKU_BASE.'lib/exe/indexer.php?id='.rawurlencode($ID).

Subscribers

People subscribed via source and target branches

to all changes: