http://www.mediawiki.org/wiki/Special:Code/MediaWiki/54350

Revision: 54350
Author:   btongminh
Date:     2009-08-04 08:40:38 +0000 (Tue, 04 Aug 2009)

Log Message:
-----------
Overide getDB() method to make sure to make sure the repo's DB is used which 
may not necesarilly be the same as the local DB.

Modified Paths:
--------------
    trunk/phase3/includes/api/ApiQueryAllimages.php

Modified: trunk/phase3/includes/api/ApiQueryAllimages.php
===================================================================
--- trunk/phase3/includes/api/ApiQueryAllimages.php     2009-08-04 08:29:17 UTC 
(rev 54349)
+++ trunk/phase3/includes/api/ApiQueryAllimages.php     2009-08-04 08:40:38 UTC 
(rev 54350)
@@ -38,7 +38,18 @@
 
        public function __construct($query, $moduleName) {
                parent :: __construct($query, $moduleName, 'ai');
+               $this->mRepo = RepoGroup::singleton()->getLocalRepo();
        }
+       
+       /**
+        * Overide parent method to make sure to make sure the repo's DB is used
+        * which may not necesarilly be the same as the local DB.
+        * 
+        * TODO: allow querying non-local repos.
+        */
+       protected function getDB() {
+               return $this->mRepo->getSlaveDB();
+       }
 
        public function execute() {
                $this->run();
@@ -52,7 +63,7 @@
        }
 
        private function run($resultPageSet = null) {
-               $repo = RepoGroup::singleton()->getLocalRepo();
+               $repo = $this->mRepo;
                if ( !$repo instanceof LocalRepo )
                        $this->dieUsage('Local file repository does not support 
querying all images', 'unsupportedrepo');
 



_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to