‪TYPO3CMS  10.4
MirrorListUtility.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
24 
29 class ‪MirrorListUtility implements \SplObserver
30 {
36  protected ‪$parser;
37 
43  protected ‪$arrTmpMirrors = [];
44 
51  public function ‪__construct()
52  {
53  // @todo catch parser exception
54  $this->parser = ‪XmlParserFactory::getParserInstance('mirror');
55  if (is_object($this->parser)) {
56  $this->parser->attach($this);
57  } else {
59  static::class . ': No XML parser available.',
60  1476108687
61  );
62  }
63  }
64 
72  public function ‪getMirrors($localMirrorListFile)
73  {
74  $zlibStream = 'compress.zlib://';
75  $this->parser->parseXml($zlibStream . $localMirrorListFile);
76  $objRepositoryMirrors = GeneralUtility::makeInstance(Mirrors::class);
77  $objRepositoryMirrors->setMirrors($this->arrTmpMirrors);
78  $this->arrTmpMirrors = [];
79  return $objRepositoryMirrors;
80  }
81 
87  public function ‪update(\SplSubject $subject)
88  {
89  // @todo mirrorxml_abstract_parser
90  if (is_subclass_of($subject, AbstractXmlParser::class)) {
91  $this->arrTmpMirrors[] = $subject->getAll();
92  }
93  }
94 }
‪TYPO3\CMS\Extensionmanager\Utility\Importer\MirrorListUtility
Definition: MirrorListUtility.php:30
‪TYPO3\CMS\Extensionmanager\Utility\Importer
Definition: ExtensionListUtility.php:16
‪TYPO3\CMS\Extensionmanager\Utility\Importer\MirrorListUtility\__construct
‪__construct()
Definition: MirrorListUtility.php:49
‪TYPO3\CMS\Extensionmanager\Utility\Importer\MirrorListUtility\$arrTmpMirrors
‪array $arrTmpMirrors
Definition: MirrorListUtility.php:41
‪TYPO3\CMS\Extensionmanager\Utility\Importer\MirrorListUtility\$parser
‪AbstractMirrorXmlParser $parser
Definition: MirrorListUtility.php:35
‪TYPO3\CMS\Extensionmanager\Utility\Importer\MirrorListUtility\update
‪update(\SplSubject $subject)
Definition: MirrorListUtility.php:85
‪TYPO3\CMS\Extensionmanager\Domain\Model\Mirrors
Definition: Mirrors.php:25
‪TYPO3\CMS\Extensionmanager\Utility\Parser\AbstractXmlParser
Definition: AbstractXmlParser.php:23
‪TYPO3\CMS\Extensionmanager\Utility\Parser\XmlParserFactory
Definition: XmlParserFactory.php:25
‪TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException
Definition: ExtensionManagerException.php:24
‪TYPO3\CMS\Extensionmanager\Utility\Parser\XmlParserFactory\getParserInstance
‪static AbstractExtensionXmlParser getParserInstance($parserType, $excludeClassNames='')
Definition: XmlParserFactory.php:61
‪TYPO3\CMS\Extensionmanager\Utility\Parser\AbstractMirrorXmlParser
Definition: AbstractMirrorXmlParser.php:23
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Extensionmanager\Utility\Importer\MirrorListUtility\getMirrors
‪Mirrors getMirrors($localMirrorListFile)
Definition: MirrorListUtility.php:70