‪TYPO3CMS  9.5
MirrorListUtility.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
21 class ‪MirrorListUtility implements \SplObserver
22 {
28  protected ‪$parser;
29 
35  protected ‪$arrTmpMirrors = [];
36 
43  public function ‪__construct()
44  {
45  // @todo catch parser exception
47  if (is_object($this->parser)) {
48  $this->parser->attach($this);
49  } else {
50  throw new \TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException(
51  static::class . ': No XML parser available.',
52  1476108687
53  );
54  }
55  }
56 
64  public function ‪getMirrors($localMirrorListFile)
65  {
66  $zlibStream = 'compress.zlib://';
67  $this->parser->parseXml($zlibStream . $localMirrorListFile);
69  $objRepositoryMirrors = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\‪TYPO3\CMS\Extensionmanager\Domain\Model\Mirrors::class);
70  $objRepositoryMirrors->setMirrors($this->arrTmpMirrors);
71  $this->arrTmpMirrors = [];
72  return $objRepositoryMirrors;
73  }
74 
80  public function ‪update(\SplSubject $subject)
81  {
82  // @todo mirrorxml_abstract_parser
83  if (is_subclass_of($subject, \‪TYPO3\CMS\Extensionmanager\Utility\Parser\AbstractXmlParser::class)) {
84  $this->arrTmpMirrors[] = $subject->getAll();
85  }
86  }
87 }
‪TYPO3\CMS\Extensionmanager\Utility\Importer\MirrorListUtility
Definition: MirrorListUtility.php:22
‪TYPO3\CMS\Extensionmanager\Utility\Importer
Definition: ExtensionListUtility.php:2
‪TYPO3\CMS\Extensionmanager\Utility\Importer\MirrorListUtility\__construct
‪__construct()
Definition: MirrorListUtility.php:41
‪TYPO3\CMS\Extensionmanager\Utility\Importer\MirrorListUtility\$arrTmpMirrors
‪array $arrTmpMirrors
Definition: MirrorListUtility.php:33
‪TYPO3
‪TYPO3\CMS\Extensionmanager\Utility\Importer\MirrorListUtility\update
‪update(\SplSubject $subject)
Definition: MirrorListUtility.php:78
‪TYPO3\CMS\Extensionmanager\Utility\Importer\MirrorListUtility\$parser
‪TYPO3 CMS Extensionmanager Utility Parser AbstractMirrorXmlParser $parser
Definition: MirrorListUtility.php:27
‪TYPO3\CMS\Extensionmanager\Utility\Importer\MirrorListUtility\getMirrors
‪TYPO3 CMS Extensionmanager Domain Model Mirrors getMirrors($localMirrorListFile)
Definition: MirrorListUtility.php:62
‪TYPO3\CMS\Extensionmanager\Utility\Parser\XmlParserFactory\getParserInstance
‪static TYPO3 CMS Extensionmanager Utility Parser AbstractExtensionXmlParser getParserInstance($parserType, $excludeClassNames='')
Definition: XmlParserFactory.php:58