TYPO3 CMS  TYPO3_6-2
MirrorListUtility.php
Go to the documentation of this file.
1 <?php
3 
29 class MirrorListUtility implements \SplObserver {
30 
36  protected $parser;
37 
43  protected $arrTmpMirrors = array();
44 
51  public function __construct() {
52  // TODO catch parser exception
54  if (is_object($this->parser)) {
55  $this->parser->attach($this);
56  } else {
57  throw new \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException(get_class($this) . ': No XML parser available.', 1342640390);
58  }
59  }
60 
68  public function getMirrors($localMirrorListFile) {
69  $zlibStream = 'compress.zlib://';
70  $this->parser->parseXml($zlibStream . $localMirrorListFile);
72  $objRepositoryMirrors = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Extensionmanager\\Domain\\Model\\Mirrors');
73  $objRepositoryMirrors->setMirrors($this->arrTmpMirrors);
74  $this->arrTmpMirrors = array();
75  return $objRepositoryMirrors;
76  }
77 
84  public function update(\SplSubject $subject) {
85  // TODO mirrorxml_abstract_parser
86  if (is_subclass_of($subject, 'TYPO3\\CMS\\Extensionmanager\\Utility\\Parser\\AbstractXmlParser')) {
87  $this->arrTmpMirrors[] = $subject->getAll();
88  }
89  }
90 
91 }
static getParserInstance($parserType, $excludeClassNames='')