Closed ticket #39: Invalidating region lists when new entry was added.
authorphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Sun, 1 Feb 2009 20:01:01 +0000 (20:01 +0000)
committerphilipp <philipp@7aebc617-e5e2-0310-91dc-80fb5f6d2477>
Sun, 1 Feb 2009 20:01:01 +0000 (20:01 +0000)
git-svn-id: http://www.winterrodeln.org/svn/servermediawiki/trunk/extensions/wrreport@393 7aebc617-e5e2-0310-91dc-80fb5f6d2477

wrreport.body.php

index 526e44d17a57b60bcfcbadd39c6905a9d6db7ce4..62f7c93f815a0498627f0802e92259a0a2b84496 100644 (file)
@@ -17,17 +17,17 @@ function wrReportParserInit() {
 // Tool functions
 // --------------
 
-/// Forces a regeneration of region overview pages
+/// Forces a regeneration of region overview pages ('Tirol', 'Vorarlberg', ...)
 function wrRecacheRegions() {
-       // TODO: Better implementation - it's a "quick fix" now.
-       $title = Title::newFromText('Tirol');
-       $title->invalidateCache();
-       
-       $title = Title::newFromText('Vorarlberg');
-       $title->invalidateCache();
+       $dbr = wfGetDB(DB_SLAVE);
+       // SELECT cl_from FROM categorylinks where cl_to = 'Region'
+       $res = $dbr->select('categorylinks', 'cl_from', array('cl_to' => 'Region'));
+       $page_ids = array();
+       while ($row = $dbr->fetchObject($res)) $page_ids[] = $row->cl_from;
+       $dbr->freeResult($res);
 
-       $title = Title::newFromText('Steiermark');
-       $title->invalidateCache();
+       $titles = Title::newFromIDs($page_ids);
+       foreach ($titles as $title) $title->invalidateCache();
 }