/**
  * @param Package $package
  * @return array
  */
 public function getChecksumsForExtension(Package $package)
 {
     $_EXTKEY = $package->getPackageKey();
     $configurationFile = $package->getPackagePath() . 'ext_emconf.php';
     $EM_CONF = null;
     if (file_exists($configurationFile)) {
         include $configurationFile;
         if (!empty($EM_CONF[$_EXTKEY]['_md5_values_when_last_written'])) {
             return unserialize($EM_CONF[$_EXTKEY]['_md5_values_when_last_written']);
         }
     }
     return array();
 }
Example #2
0
 /**
  * @param \TYPO3\Flow\Package\PackageManager $packageManager
  * @param string $packageKey
  * @param string $packagePath
  * @param string|null $classesPath
  * @param string $manifestPath
  */
 public function __construct(\TYPO3\Flow\Package\PackageManager $packageManager, $packageKey, $packagePath, $classesPath = NULL, $manifestPath = '')
 {
     \TYPO3\CMS\Core\Package\Package::__construct($packageManager, $packageKey, $packagePath, $classesPath, $manifestPath);
     if (!file_exists(PATH_site . 'typo3conf/PackageStates.php')) {
         // Force loading of the console in case we do not have a package states file yet (pre-install)
         $this->protected = TRUE;
     }
 }
Example #3
0
 /**
  * Register the cli request handler only when in cli mode
  *
  * @param \TYPO3\Flow\Core\Bootstrap $bootstrap
  */
 public function boot(\TYPO3\Flow\Core\Bootstrap $bootstrap)
 {
     if (defined('TYPO3_cliMode') && TYPO3_cliMode && is_callable(array($bootstrap, 'registerRequestHandler'))) {
         parent::boot($bootstrap);
         $bootstrap->registerRequestHandler(new RequestHandler($bootstrap));
         $this->registerCommands($bootstrap);
     }
 }
Example #4
0
 /**
  * @test
  */
 public function aPackageCanBeFlaggedAsProtected()
 {
     $packagePath = 'vfs://Packages/Application/Vendor/Dummy/';
     mkdir($packagePath, 0700, TRUE);
     file_put_contents($packagePath . 'composer.json', '{"name": "vendor/dummy", "type": "flow-test"}');
     file_put_contents($packagePath . 'ext_emconf.php', '');
     $packageManagerMock = $this->getMock(\TYPO3\CMS\Core\Package\PackageManager::class);
     $packageManagerMock->expects($this->any())->method('isPackageKeyValid')->willReturn(TRUE);
     $package = new Package($packageManagerMock, 'Vendor.Dummy', $packagePath);
     $this->assertFalse($package->isProtected());
     $package->setProtected(TRUE);
     $this->assertTrue($package->isProtected());
 }
 /**
  * @param Package $package
  * @return array
  */
 public function fetchExtensionInformation(Package $package)
 {
     return array('timestamp' => time(), 'checksums' => $this->checksumGenerator->getChecksumsForPath($package->getPackagePath(), static::$vcsPatterns));
 }
Example #6
0
 /**
  * @test
  */
 public function getClassesPathReturnsPathToClasses()
 {
     $packageManagerMock = $this->getMock('TYPO3\\CMS\\Core\\Package\\PackageManager');
     $packageManagerMock->expects($this->any())->method('isPackageKeyValid')->willReturn(TRUE);
     $package = new TYPO3Package($packageManagerMock, 'core', PATH_typo3 . 'sysext/core/', TYPO3Package::DIRECTORY_CLASSES);
     $packageClassesPath = $package->getClassesPath();
     $expected = $package->getPackagePath() . TYPO3Package::DIRECTORY_CLASSES;
     $this->assertEquals($expected, $packageClassesPath);
 }