Esempio n. 1
0
 /**
  * @param DOMElement $root
  *
  * @return Site[]
  */
 private function makeSiteList(DOMElement $root)
 {
     $sites = array();
     // Old sites, to get the row IDs that correspond to the global site IDs.
     // TODO: Get rid of internal row IDs, they just get in the way. Get rid of ORMRow, too.
     $oldSites = $this->store->getSites();
     $current = $root->firstChild;
     while ($current) {
         if ($current instanceof DOMElement && $current->tagName === 'site') {
             try {
                 $site = $this->makeSite($current);
                 $key = $site->getGlobalId();
                 if ($oldSites->hasSite($key)) {
                     $oldSite = $oldSites->getSite($key);
                     $site->setInternalId($oldSite->getInternalId());
                 }
                 $sites[$key] = $site;
             } catch (Exception $ex) {
                 $this->handleException($ex);
             }
         }
         $current = $current->nextSibling;
     }
     return $sites;
 }
 /**
  * @see SiteStore::getSites
  *
  * @since 1.25
  *
  * @return SiteList
  */
 public function getSites()
 {
     if ($this->sites === null) {
         $this->sites = $this->cache->get($this->getCacheKey());
         if (!is_object($this->sites)) {
             $this->sites = $this->siteStore->getSites();
             $this->cache->set($this->getCacheKey(), $this->sites, $this->cacheTimeout);
         }
     }
     return $this->sites;
 }