47 public function create($packagesBasePath, $packagePath, $packageKey, $classesPath, $manifestPath =
'') {
49 $packageClassPathAndFilename =
Files::concatenatePaths(array($packagePath,
'Classes/' . str_replace(
'.',
'/', $packageKey) .
'/Package.php'));
51 $packageClassPathAndFilename = @file_exists($alternativeClassPathAndFilename) ? $alternativeClassPathAndFilename : $packageClassPathAndFilename;
52 if (@file_exists($packageClassPathAndFilename)) {
53 require_once($packageClassPathAndFilename);
54 if (substr($packagePath, 0, strlen(PATH_typo3)) === PATH_typo3 && strpos($packageKey,
'.') === FALSE) {
58 $packageClassName = str_replace(
'.',
'\\', $packageKey) .
'\Package';
60 if (!class_exists($packageClassName, FALSE)) {
61 throw new \TYPO3\Flow\Package\Exception\CorruptPackageException(sprintf(
'The package "%s" does not contain a valid package class. Check if the file "%s" really contains a class called "%s".', $packageKey, $packageClassPathAndFilename, $packageClassName), 1327587092);
65 $packageClassName = @file_exists($emConfPath) ?
'TYPO3\CMS\Core\Package\Package' :
'TYPO3\Flow\Package\Package';
69 $package =
new $packageClassName($this->packageManager, $packageKey, $packagePath, $classesPath, $manifestPath);
91 if (!is_object($manifest)) {
92 throw new \TYPO3\Flow\Package\Exception\InvalidPackageManifestException(
'Invalid composer manifest in package path: ' . $packagePath, 1348146451);
94 if (isset($manifest->type) && substr($manifest->type, 0, 10) ===
'typo3-cms-') {
95 $relativePackagePath = substr($packagePath, strlen($packagesBasePath));
96 $packageKey = substr($relativePackagePath, strpos($relativePackagePath,
'/') + 1, -1);
100 $packageKey = preg_replace(
'/[^A-Za-z0-9._-]/',
'', $packageKey);
103 return parent::getPackageKeyFromManifest($manifest, $packagePath, $packagesBasePath);
static getNormalizedPath($path)
static getPackageKeyFromManifest($manifest, $packagePath, $packagesBasePath)
static concatenatePaths(array $paths)
create($packagesBasePath, $packagePath, $packageKey, $classesPath, $manifestPath='')
static underscoredToUpperCamelCase($string)
__construct(PackageManager $packageManager)