Exemplo n.º 1
0
 /**
  * @since 1.21
  *
  * @param integer $globalId
  *
  * @return MediaWikiSite
  */
 public static function newFromGlobalId($globalId)
 {
     return SitesTable::singleton()->newRow(array('type' => Site::TYPE_MEDIAWIKI, 'global_key' => $globalId), true);
 }
 public function testFactoryConstruction()
 {
     $this->assertInstanceOf('MediaWikiSite', MediaWikiSite::newFromGlobalId('enwiki'));
     $this->assertInstanceOf('Site', MediaWikiSite::newFromGlobalId('enwiki'));
     $this->assertInstanceOf('MediaWikiSite', SitesTable::singleton()->newRow(array('type' => Site::TYPE_MEDIAWIKI)));
 }
Exemplo n.º 3
0
 /**
  * @see ORMRowTest::getTableInstance
  * @since 1.21
  * @return IORMTable
  */
 protected function getTableInstance()
 {
     return SitesTable::singleton();
 }
Exemplo n.º 4
0
 /**
  * Returns the site with provided global id, or false if there is no such site.
  *
  * @since 1.21
  *
  * @param string $globalId
  * @param string $source
  *
  * @return Site|false
  */
 public function getSite($globalId, $source = 'cache')
 {
     if ($source === 'cache' && $this->sites !== false) {
         return $this->sites->hasSite($globalId) ? $this->sites->getSite($globalId) : false;
     }
     return SitesTable::singleton()->selectRow(null, array('global_key' => $globalId));
 }