Beispiel #1
0
 /**
  * Returns "System", "Global" or "Local" based on extension position in filesystem.
  *
  * @param PackageInterface $package
  * @return string
  */
 protected function getInstallTypeForPackage(PackageInterface $package)
 {
     foreach (\TYPO3\CMS\Extensionmanager\Domain\Model\Extension::returnInstallPaths() as $installType => $installPath) {
         if (GeneralUtility::isFirstPartOfStr($package->getPackagePath(), $installPath)) {
             return $installType;
         }
     }
     return '';
 }
 /**
  * Returns class alias map for given package
  *
  * @param PackageInterface $package The package to generate the class alias info for
  * @throws \TYPO3\CMS\Core\Error\Exception
  * @return array
  */
 public function buildClassAliasMapForPackage(PackageInterface $package)
 {
     $aliasToClassNameMapping = [];
     $classNameToAliasMapping = [];
     $possibleClassAliasFiles = [];
     $manifest = $package->getValueFromComposerManifest();
     if (!empty($manifest->extra->{'typo3/class-alias-loader'}->{'class-alias-maps'})) {
         $possibleClassAliasFiles = $manifest->extra->{'typo3/class-alias-loader'}->{'class-alias-maps'};
         if (!is_array($possibleClassAliasFiles)) {
             throw new \TYPO3\CMS\Core\Error\Exception('"typo3/class-alias-loader"/"class-alias-maps" must return an array!', 1444142481);
         }
     } else {
         $possibleClassAliasFiles[] = 'Migrations/Code/ClassAliasMap.php';
     }
     $packagePath = $package->getPackagePath();
     foreach ($possibleClassAliasFiles as $possibleClassAliasFile) {
         $possiblePathToClassAliasFile = $packagePath . $possibleClassAliasFile;
         if (file_exists($possiblePathToClassAliasFile)) {
             $packageAliasMap = (require $possiblePathToClassAliasFile);
             if (!is_array($packageAliasMap)) {
                 throw new \TYPO3\CMS\Core\Error\Exception('"class alias maps" must return an array', 1422625075);
             }
             foreach ($packageAliasMap as $aliasClassName => $className) {
                 $lowerCasedAliasClassName = strtolower($aliasClassName);
                 $aliasToClassNameMapping[$lowerCasedAliasClassName] = $className;
                 $classNameToAliasMapping[$className][$lowerCasedAliasClassName] = $lowerCasedAliasClassName;
             }
         }
     }
     return array('aliasToClassNameMapping' => $aliasToClassNameMapping, 'classNameToAliasMapping' => $classNameToAliasMapping);
 }
 /**
  * @param PackageInterface $package
  * @return void
  */
 protected function buildPackageClassPathsForLegacyExtension(PackageInterface $package)
 {
     $this->packageClassesPaths[$package->getPackageKey()] = $package->getClassesPath();
     foreach ($package->getPackageReplacementKeys() as $packageToReplace => $_) {
         $this->packageClassesPaths[$packageToReplace] = $package->getClassesPath();
     }
 }
Beispiel #4
0
 /**
  * Unregisters a package from the list of available packages
  *
  * @param PackageInterface $package The package to be unregistered
  * @return void
  * @throws Exception\InvalidPackageStateException
  */
 public function unregisterPackage(PackageInterface $package)
 {
     $packageKey = $package->getPackageKey();
     if (!$this->isPackageAvailable($packageKey)) {
         throw new Exception\InvalidPackageStateException('Package "' . $packageKey . '" is not registered.', 1338996142);
     }
     $this->unregisterPackageByPackageKey($packageKey);
 }
 /**
  * Check if the package is a framework package (located in typo3/sysext)
  *
  * @param PackageInterface $package
  * @return bool
  */
 protected static function isFrameworkPackage(PackageInterface $package)
 {
     return strpos($package->getPackagePath(), self::SYSEXT_FOLDER) !== FALSE;
 }
 /**
  * Check if the package is a framework package (located in typo3/sysext)
  *
  * @param PackageInterface $package
  * @return bool
  */
 protected static function isFrameworkPackage(PackageInterface $package)
 {
     return $package->getValueFromComposerManifest('type') === 'typo3-cms-framework';
 }