Commit 64c46b91 authored by Thomas Maroschik's avatar Thomas Maroschik Committed by Ernesto Baschny
Browse files

[TASK] Improve performance of Bootstrap/PackageManager

This patch is a combined patch which tries to address
the findings from the Bootstrap/PackageManager/ClassLoader
performance analysis.

Resolves: #56934
Resolves: #56310
Resolves: #56331
Resolves: #56341
Resolves: #56538
Releases: 6.2
Change-Id: I269159906534f58eff59973ab30e170fadac10e4
Reviewed-on: https://review.typo3.org/28329
Reviewed-by: Ernesto Baschny
Tested-by: Ernesto Baschny
parent 6e32f103
<?php
namespace TYPO3\CMS\About;
/***************************************************************
* Copyright notice
*
* (c) 2013 Christian Kuhn <lolli@schwarzbu.ch>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the text file GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\Package\Package as BasePackage;
/**
* This is the About package
*/
class Package extends BasePackage {
/**
* @var bool
*/
protected $partOfFactoryDefault = TRUE;
}
......@@ -11,5 +11,12 @@
},
"replace": {
"about": "*"
},
"extra": {
"typo3/cms": {
"Package": {
"partOfFactoryDefault": true
}
}
}
}
\ No newline at end of file
<?php
namespace TYPO3\CMS\Aboutmodules;
/***************************************************************
* Copyright notice
*
* (c) 2013 Christian Kuhn <lolli@schwarzbu.ch>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the text file GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\Package\Package as BasePackage;
/**
* This is the Aboutmodules package
*/
class Package extends BasePackage {
/**
* @var bool
*/
protected $partOfFactoryDefault = TRUE;
}
......@@ -11,5 +11,12 @@
},
"replace": {
"aboutmodules": "*"
},
"extra": {
"typo3/cms": {
"Package": {
"partOfFactoryDefault": true
}
}
}
}
\ No newline at end of file
<?php
namespace TYPO3\CMS\Backend;
/***************************************************************
* Copyright notice
*
* (c) 2013 Thomas Maroschik <tmaroschik@dfau.de>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the text file GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\Package\Package as BasePackage;
/**
* This is the backend package
*
* @author Thomas Maroschik <tmaroschik@dfau.de>
*/
class Package extends BasePackage {
/**
* @var boolean
*/
protected $protected = TRUE;
/**
* @var bool
*/
protected $partOfFactoryDefault = TRUE;
/**
* @var bool
*/
protected $partOfMinimalUsableSystem = TRUE;
}
......@@ -11,5 +11,14 @@
},
"replace": {
"backend": "*"
},
"extra": {
"typo3/cms": {
"Package": {
"protected": true,
"partOfFactoryDefault": true,
"partOfMinimalUsableSystem": true
}
}
}
}
<?php
namespace TYPO3\CMS\Belog;
/***************************************************************
* Copyright notice
*
* (c) 2013 Christian Kuhn <lolli@schwarzbu.ch>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the text file GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\Package\Package as BasePackage;
/**
* This is the Belog package
*/
class Package extends BasePackage {
/**
* @var bool
*/
protected $partOfFactoryDefault = TRUE;
}
......@@ -11,5 +11,12 @@
},
"replace": {
"belog": "*"
},
"extra": {
"typo3/cms": {
"Package": {
"partOfFactoryDefault": true
}
}
}
}
<?php
namespace TYPO3\CMS\Beuser;
/***************************************************************
* Copyright notice
*
* (c) 2013 Christian Kuhn <lolli@schwarzbu.ch>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the text file GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\Package\Package as BasePackage;
/**
* This is the Beuser package
*/
class Package extends BasePackage {
/**
* @var bool
*/
protected $partOfFactoryDefault = TRUE;
}
......@@ -11,5 +11,12 @@
},
"replace": {
"beuser": "*"
},
"extra": {
"typo3/cms": {
"Package": {
"partOfFactoryDefault": true
}
}
}
}
<?php
namespace TYPO3\CMS\Cms;
/***************************************************************
* Copyright notice
*
* (c) 2013 Thomas Maroschik <tmaroschik@dfau.de>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the text file GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\Package\Package as BasePackage;
/**
* This is the cms package
*
* @author Thomas Maroschik <tmaroschik@dfau.de>
*/
class Package extends BasePackage {
/**
* @var boolean
*/
protected $protected = TRUE;
/**
* @var bool
*/
protected $partOfFactoryDefault = TRUE;
/**
* @var bool
*/
protected $partOfMinimalUsableSystem = TRUE;
}
\ No newline at end of file
......@@ -11,5 +11,14 @@
},
"replace": {
"cms": "*"
},
"extra": {
"typo3/cms": {
"Package": {
"protected": true,
"partOfFactoryDefault": true,
"partOfMinimalUsableSystem": true
}
}
}
}
<?php
namespace TYPO3\CMS\ContextHelp;
/***************************************************************
* Copyright notice
*
* (c) 2013 Christian Kuhn <lolli@schwarzbu.ch>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the text file GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\Package\Package as BasePackage;
/**
* This is the ContextHelp package
*/
class Package extends BasePackage {
/**
* @var bool
*/
protected $partOfFactoryDefault = TRUE;
}
......@@ -11,5 +11,12 @@
},
"replace": {
"context_help": "*"
},
"extra": {
"typo3/cms": {
"Package": {
"partOfFactoryDefault": true
}
}
}
}
......@@ -222,4 +222,11 @@ class LoadedExtensionArrayElement implements \IteratorAggregate, \ArrayAccess, \
public function count() {
return count($this->extensionInformation);
}
/**
* @return array
*/
public function toArray() {
return iterator_to_array($this);
}
}
......@@ -215,4 +215,16 @@ class LoadedExtensionsArray implements \Iterator, \ArrayAccess, \Serializable, \
public function hasPackageManager() {
return $this->packageManager !== NULL;
}
/**
* @return array
*/
public function toArray() {
return array_map(
function($loadedExtElement) {
return $loadedExtElement->toArray();
},
iterator_to_array($this)
);
}
}
......@@ -169,6 +169,7 @@ class Bootstrap {
*/
public function redirectToInstallerIfEssentialConfigurationDoesNotExist($pathUpToDocumentRoot = '') {
$configurationManager = new \TYPO3\CMS\Core\Configuration\ConfigurationManager;
$this->setEarlyInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager', $configurationManager);
if (!file_exists($configurationManager->getLocalConfigurationFileLocation()) || !file_exists(PATH_typo3conf . 'PackageStates.php')) {
require_once __DIR__ . '/../Utility/HttpUtility.php';
Utility\HttpUtility::redirect($pathUpToDocumentRoot . 'typo3/sysext/install/Start/Install.php');
......@@ -317,7 +318,6 @@ class Bootstrap {
$packageManager->injectDependencyResolver(Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Package\\DependencyResolver'));
$packageManager->initialize($this);
Utility\GeneralUtility::setSingletonInstance('TYPO3\\CMS\\Core\\Package\\PackageManager', $packageManager);
$GLOBALS['TYPO3_LOADED_EXT'] = new \TYPO3\CMS\Core\Compatibility\LoadedExtensionsArray($packageManager);
return $this;
}
......@@ -388,8 +388,12 @@ class Bootstrap {
* @return Bootstrap
*/
public function populateLocalConfiguration() {
$configurationManager = new \TYPO3\CMS\Core\Configuration\ConfigurationManager();
$this->setEarlyInstance('TYPO3\CMS\Core\Configuration\ConfigurationManager', $configurationManager);
try {
$configurationManager = $this->getEarlyInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager');
} catch(\TYPO3\CMS\Core\Exception $exception) {
$configurationManager = new \TYPO3\CMS\Core\Configuration\ConfigurationManager();
$this->setEarlyInstance('TYPO3\\CMS\\Core\\Configuration\\ConfigurationManager', $configurationManager);
}
$configurationManager->exportConfiguration();
return $this;
}
......
<?php
namespace TYPO3\CMS\Core;
/***************************************************************
* Copyright notice
*
* (c) 2013 Thomas Maroschik <tmaroschik@dfau.de>
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
* A copy is found in the text file GPL.txt and important notices to the license
* from the author is found in LICENSE.txt distributed with these scripts.
*
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\Package\Package as BasePackage;
/**
* This is the core package
*/
class Package extends BasePackage {
/**
* @var boolean
*/
protected $protected = TRUE;
/**
* @var bool
*/
protected $partOfFactoryDefault = TRUE;
/**
* @var bool
*/
protected $partOfMinimalUsableSystem = TRUE;
}
<?php
namespace TYPO3\CMS\Core\Package\Exception;
// Copyright header is left out here by intention and should be restored once
// this file is committed.
/**
* A package cache unavailable exception
*/
class PackageManagerCacheUnavailableException extends \TYPO3\CMS\Core\Package\Exception {
// @TODO remove this comment once it is committed
// This comment is here to prevent false positive git rename detection
// It has to have a certain length to get around the 90% similarity limit.
// It can be removed at any time and all text is just here for that case.
}
\ No newline at end of file
......@@ -95,11 +95,29 @@ class Package extends \TYPO3\Flow\Package\Package implements PackageInterface {
} catch (\TYPO3\Flow\Package\Exception\MissingPackageManifestException $exception) {
$this->getExtensionEmconf($packageKey, $this->packagePath);
}
$this->loadFlagsFromComposerManifest();
if ($this->objectManagementEnabled === NULL) {
$this->objectManagementEnabled = FALSE;
}
}
/**
* Loads package management related flags from the "extra:typo3/cms:Package" section
* of extensions composer.json files into local properties
*
* @return void
*/
protected function loadFlagsFromComposerManifest() {
$extraFlags = $this->getComposerManifest('extra');
if ($extraFlags !== NULL && isset($extraFlags->{"typo3/cms"}->{"Package"})) {
foreach ($extraFlags->{"typo3/cms"}->{"Package"} as $flagName => $flagValue) {
if (property_exists($this, $flagName)) {
$this->{$flagName} = $flagValue;
}
}
}
}
/**
* @return bool
*/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment