Overide getDB() method to make sure to make sure the repo's DB is used which may...
authorBryan Tong Minh <btongminh@users.mediawiki.org>
Tue, 4 Aug 2009 08:40:38 +0000 (08:40 +0000)
committerBryan Tong Minh <btongminh@users.mediawiki.org>
Tue, 4 Aug 2009 08:40:38 +0000 (08:40 +0000)
includes/api/ApiQueryAllimages.php

index a4962c8..88261af 100644 (file)
@@ -38,6 +38,17 @@ class ApiQueryAllimages extends ApiQueryGeneratorBase {
 
        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() {
@@ -52,7 +63,7 @@ class ApiQueryAllimages extends ApiQueryGeneratorBase {
        }
 
        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');