73 if (!$packageManager->isPackageKeyValid(
$packageKey)) {
74 throw new \TYPO3\Flow\Package\Exception\InvalidPackageKeyException(
'"' .
$packageKey .
'" is not a valid package key.', 1217959511);
77 throw new \TYPO3\Flow\Package\Exception\InvalidPackagePathException(sprintf(
'Tried to instantiate a package object for package "%s" with a non-existing package path "%s". Either the package does not exist anymore, or the code creating this object contains an error.',
$packageKey,
$packagePath), 1166631890);
80 throw new \TYPO3\Flow\Package\Exception\InvalidPackagePathException(sprintf(
'The package path "%s" provided for package "%s" has no trailing forward slash.',
$packagePath,
$packageKey), 1166633722);
83 throw new \TYPO3\Flow\Package\Exception\InvalidPackagePathException(sprintf(
'The package classes path provided for package "%s" has a leading forward slash.',
$packageKey), 1334841321);
86 throw new \TYPO3\Flow\Package\Exception\InvalidPackageManifestException(sprintf(
'No ext_emconf file found for package "%s". Please create one at "%sext_emconf.php".',
$packageKey, $manifestPath), 1360403545);
99 if ($this->objectManagementEnabled === NULL) {
100 $this->objectManagementEnabled = FALSE;
112 if ($extraFlags !== NULL && isset($extraFlags->{
"typo3/cms"}->{
"Package"})) {
113 foreach ($extraFlags->{
"typo3/cms"}->{
"Package"} as $flagName => $flagValue) {
114 if (property_exists($this, $flagName)) {
115 $this->{$flagName} = $flagValue;
140 $path = $this->packagePath .
'/ext_emconf.php';
142 if (@file_exists($path)) {
145 $this->extensionManagerConfiguration =
$EM_CONF[$_EXTKEY];
156 if (is_array($this->extensionManagerConfiguration)) {
166 if (!empty($requiredPackageKey)) {
176 if (!empty($conflictingPackageKey)) {
177 $composerManifest->conflict->$conflictingPackageKey = $conflictingPackageVersion;
186 if (!empty($suggestedPackageKey)) {
202 if ($this->packageMetaData === NULL) {
203 parent::getPackageMetaData();
207 $version = $this->packageMetaData->getVersion();
208 if (empty($version)) {
210 $path = $this->packagePath .
'ext_emconf.php';
211 if (@file_exists($path)) {
213 if (isset(
$EM_CONF[$_EXTKEY][
'version'])) {
214 $this->packageMetaData->setVersion(
$EM_CONF[$_EXTKEY][
'version']);
220 if ($suggestions !== NULL) {
221 foreach ($suggestions as $suggestion => $version) {
226 $packageKey = $this->packageManager->getPackageKeyFromComposerName($suggestion);
227 $constraint = new \TYPO3\Flow\Package\MetaData\PackageConstraint(\
TYPO3\Flow\
Package\MetaDataInterface::CONSTRAINT_TYPE_SUGGESTS,
$packageKey);
228 $this->packageMetaData->addConstraint($constraint);
250 if(!$this->
namespace) {
252 if (isset($manifest->autoload->{
'psr-0'})) {
253 $namespaces = $manifest->autoload->{
'psr-0'};
254 if (count($namespaces) === 1) {
255 $this->
namespace = key($namespaces);
257 throw new \TYPO3\Flow\Package\Exception\InvalidPackageStateException(sprintf(
'The Composer manifest of package "%s" contains multiple namespace definitions in its autoload section but Flow does only support one namespace per package.', $this->packageKey), 1348053246);
263 $this->
namespace = '*\\
' . \TYPO3\CMS\Core\Utility\GeneralUtility::underscoredToUpperCamelCase($packageKey); 265 $this->namespace = str_replace('.
', '\\
', $packageKey); 269 return $this->namespace; 275 public function getClassFiles() { 276 if (!is_array($this->classFiles)) { 277 $this->classFiles = $this->filterClassFiles($this->buildArrayOfClassFiles($this->classesPath . '/
', $this->namespace . '\\
')); 279 return $this->classFiles; 286 protected function filterClassFiles(array $classFiles) { 287 $classesNotMatchingClassRule = array_filter(array_keys($classFiles), function($className) { 288 return preg_match('/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\\\x7f-\xff]*$/
', $className) !== 1; 290 foreach ($classesNotMatchingClassRule as $forbiddenClassName) { 291 unset($classFiles[$forbiddenClassName]); 293 foreach ($this->ignoredClassNames as $ignoredClassName) { 294 if (isset($classFiles[$ignoredClassName])) { 295 unset($classFiles[$ignoredClassName]); 304 public function getClassFilesFromAutoloadRegistry() { 305 $autoloadRegistryPath = $this->packagePath . 'ext_autoload.php
'; 306 if (@file_exists($autoloadRegistryPath)) { 307 return require $autoloadRegistryPath; 315 public function getClassAliases() { 316 if (!is_array($this->classAliases)) { 318 $extensionClassAliasMapPathAndFilename = \TYPO3\Flow\Utility\Files::concatenatePaths(array( 319 $this->getPackagePath(), 320 'Migrations/Code/ClassAliasMap.php
' 322 if (@file_exists($extensionClassAliasMapPathAndFilename)) { 323 $this->classAliases = require $extensionClassAliasMapPathAndFilename; 325 } catch (\BadFunctionCallException $e) { 327 if (!is_array($this->classAliases)) { 328 $this->classAliases = array(); 331 return $this->classAliases; 340 protected function packageRequirementIsComposerPackage($requirement) { 341 // According to http://getcomposer.org/doc/02-libraries.md#platform-packages 342 // the following regex should capture all non composer requirements. 343 // typo3 is included in the list because it's a meta
package and not supported for now.
346 return preg_match('/^(php(-64bit)?|ext-[^\/]+|lib-(curl|iconv|libxml|openssl|pcre|uuid|xsl)|typo3|typo3\/cms|composer\/installers)$/', $requirement) !== 1;
mapExtensionManagerConfigurationToComposerManifest()
static getNormalizedPath($path)
isPartOfMinimalUsableSystem()
packageRequirementIsComposerPackage($requirement)
getPackageReplacementKeys()
static is_link($pathAndFilename)
const PATTERN_MATCH_EXTENSIONKEY
static concatenatePaths(array $paths)
$extensionManagerConfiguration
getComposerManifest($key=NULL)
$partOfMinimalUsableSystem
loadFlagsFromComposerManifest()
__construct(\TYPO3\Flow\Package\PackageManager $packageManager, $packageKey, $packagePath, $classesPath=NULL, $manifestPath='')