示例#1
0
 public function getComposerInformation($identifier)
 {
     $this->buildNameMapping();
     $composerInformation = parent::getComposerInformation($identifier);
     if (!$composerInformation) {
         $resource = sprintf('%s:ext_emconf.php', escapeshellarg($identifier));
         $this->process->execute(sprintf('git show %s', $resource), $emConf, $this->repoDir);
         if (!trim($emConf)) {
             // No emconf at all, we skip
             return;
         }
         $emConfConverter = new EmConfReader();
         $extensionConfig = $emConfConverter->readFromString($emConf);
         if (empty($extensionConfig) || !preg_match('/^[\\d]+\\.[\\d]+(\\.[\\d])*$/', str_replace('-dev', '', $extensionConfig['version']))) {
             // Could not read extension config or invalid version number, we skip
             return;
         }
         $composerInformation = $this->getComposerInformationFromEmConf($extensionConfig, $identifier);
         if (false === json_encode($composerInformation, 448)) {
             // Most likely wrong encoding (not UTF-8) which we cannot fix here
             return;
         }
         if (preg_match('{[a-f0-9]{40}}i', $identifier)) {
             $this->cache->write($identifier, json_encode($composerInformation));
         }
         $this->infoCache[$identifier] = $composerInformation;
     }
     return $composerInformation;
 }
示例#2
0
 /**
  * @param string $extensionKey
  * @param integer $timestamp
  * @param string $emConfContent
  * @return ExtensionVersion
  */
 public static function createFromKeyAndTimestampAndEmConfContent($extensionKey, $timestamp, $emConfContent)
 {
     if (!is_string($emConfContent)) {
         // throw new Exception
     }
     $reader = new EmConfReader();
     $configuration = $reader->readFromString($emConfContent);
     $configuration['extensionKey'] = $extensionKey;
     $configuration['timestamp'] = $timestamp;
     return new ExtensionVersion($configuration);
 }
示例#3
0
 /**
  * @param string $emConfString
  * @test
  * @dataProvider emConfDataProvider
  */
 public function testConversion($emConfString)
 {
     $extensionConfiguration = $this->subject->readFromString($emConfString);
     $this->assertTrue(is_array($extensionConfiguration));
 }