Beispiel #1
0
 /**
  * Fetches the site from the database and loads them into the sites field.
  *
  * @since 1.21
  */
 protected function loadSites()
 {
     $this->sites = new SiteArray(SitesTable::singleton()->select());
     // Batch load the local site identifiers.
     $dbr = wfGetDB(SitesTable::singleton()->getReadDb());
     $ids = $dbr->select('site_identifiers', array('si_site', 'si_type', 'si_key'), array(), __METHOD__);
     foreach ($ids as $id) {
         if ($this->sites->hasInternalId($id->si_site)) {
             $site = $this->sites->getSiteByInternalId($id->si_site);
             $site->addLocalId($id->si_type, $id->si_key);
             $this->sites->setSite($site);
         }
     }
     $cache = wfGetMainCache();
     $cache->set('sites-cache', $this->sites);
 }