2 namespace TYPO3\CMS\Core\Package;
98 throw new Exception\InvalidPackageKeyException(
'"' .
$packageKey .
'" is not a valid package key.', 1217959511);
101 throw new 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);
104 throw new Exception\InvalidPackagePathException(sprintf(
'The package path "%s" provided for package "%s" has no trailing forward slash.',
$packagePath,
$packageKey), 1166633722);
122 if ($extraFlags !== null && isset($extraFlags->{
"typo3/cms"}->{
"Package"})) {
123 foreach ($extraFlags->{
"typo3/cms"}->{
"Package"} as $flagName => $flagValue) {
124 if (property_exists($this, $flagName)) {
125 $this->{$flagName} = $flagValue;
134 public function isPartOfFactoryDefault()
136 return $this->partOfFactoryDefault;
142 public function isPartOfMinimalUsableSystem()
144 return $this->partOfMinimalUsableSystem;
153 public function getPackageKey()
155 return $this->packageKey;
164 public function isProtected()
166 return $this->protected;
176 public function setProtected($protected)
178 $this->
protected = (bool)$protected;
187 public function getPackagePath()
189 return $this->packagePath;
197 public function getPackageMetaData()
199 if ($this->packageMetaData === null) {
200 $this->packageMetaData =
new MetaData($this->getPackageKey());
201 $this->packageMetaData->setDescription($this->getValueFromComposerManifest(
'description'));
202 $this->packageMetaData->setVersion($this->getValueFromComposerManifest(
'version'));
203 $requirements = $this->getValueFromComposerManifest(
'require');
204 if ($requirements !== null) {
205 foreach ($requirements as $requirement => $version) {
206 $packageKey = $this->packageManager->getPackageKeyFromComposerName($requirement);
209 if ($packageKey ===
'cms') {
210 GeneralUtility::deprecationLog(
'Extension "' . $this->packageKey .
'" defines a dependency on ext:cms, which has been removed. Please remove the dependency.');
211 $packageKey =
'core';
213 $constraint =
new MetaData\PackageConstraint(MetaData::CONSTRAINT_TYPE_DEPENDS, $packageKey);
214 $this->packageMetaData->addConstraint($constraint);
217 $suggestions = $this->getValueFromComposerManifest(
'suggest');
218 if ($suggestions !== null) {
219 foreach ($suggestions as $suggestion => $version) {
220 $packageKey = $this->packageManager->getPackageKeyFromComposerName($suggestion);
221 $constraint =
new MetaData\PackageConstraint(MetaData::CONSTRAINT_TYPE_SUGGESTS, $packageKey);
222 $this->packageMetaData->addConstraint($constraint);
226 return $this->packageMetaData;
234 public function getPackageReplacementKeys()
237 return (array)$this->getValueFromComposerManifest(
'replace') ?: array();
247 public function getValueFromComposerManifest($key = null)
250 return $this->composerManifest;
253 if (isset($this->composerManifest->{$key})) {
254 $value = $this->composerManifest->{$key};
273 public function __sleep()
275 $properties = get_class_vars(get_class($this));
276 unset($properties[
'packageManager']);
277 return array_keys($properties);
290 public function __wakeup()
292 if (isset(
$GLOBALS[
'TYPO3_currentPackageManager'])) {
293 $this->packageManager =
$GLOBALS[
'TYPO3_currentPackageManager'];