Commit 939f07bd authored by Thomas Maroschik's avatar Thomas Maroschik Committed by Helmut Hummel
Browse files

[TASK] Clean up class alias mechanism

* adopt class loader to load the class alias map from a location
  Migrations/Code/ClassAliasMap.php in every extensions path
* split up core class alias map into extension class alias maps
* adopt tests to the compound class loader cache

Change-Id: I7102fd5aab7a6364d5bcb5603f011dfcdb859ec9
Resolves: #41012
Resolves: #41013
Related: #40095
Releases: 6.0
Reviewed-on: http://review.typo3.org/15085
Reviewed-by: Thomas Maroschik
Tested-by: Thomas Maroschik
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
parent d967075e
<?php
return array(
'Tx_About_Controller_AboutController' => 'TYPO3\\CMS\\About\\Controller\\AboutController',
'tx_about_customSections' => 'TYPO3\\CMS\\About\\CustomSectionsInterface',
'Tx_About_Domain_Model_Extension' => 'TYPO3\\CMS\\About\\Domain\\Model\\Extension',
'Tx_About_Domain_Repository_ExtensionRepository' => 'TYPO3\\CMS\\About\\Domain\\Repository\\ExtensionRepository',
'Tx_About_ViewHelpers_SkinImageViewHelper' => 'TYPO3\\CMS\\About\\ViewHelpers\\SkinImageViewHelper',
);
?>
\ No newline at end of file
<?php
return array(
'Tx_Aboutmodules_Controller_ModulesController' => 'TYPO3\\CMS\\Aboutmodules\\Controller\\ModulesController',
'tx_aboutmodules_Functions' => 'TYPO3\\CMS\\Aboutmodules\\Utility\\FunctionsUtility',
);
?>
\ No newline at end of file
<?php
return array(
'tx_adodb_tceforms' => 'TYPO3\\CMS\\Adodb\\DataHandling\\DatabaseTypeItemsFunction',
'tx_adodb_checkconnectionwizard' => 'TYPO3\\CMS\\Adodb\\View\\CheckConnectionWizardView',
);
?>
\ No newline at end of file
<?php
return array(
'AjaxLogin' => 'TYPO3\\CMS\\Backend\\AjaxLoginHandler',
'clickMenu' => 'TYPO3\\CMS\\Backend\\ClickMenu\\ClickMenu',
't3lib_clipboard' => 'TYPO3\\CMS\\Backend\\Clipboard\\Clipboard',
't3lib_transl8tools' => 'TYPO3\\CMS\\Backend\\Configuration\\TranslationConfigurationProvider',
't3lib_TSparser_TSconfig' => 'TYPO3\\CMS\\Backend\\Configuration\\TsConfigParser',
't3lib_matchCondition_backend' => 'TYPO3\\CMS\\Backend\\Configuration\\TypoScript\\ConditionMatching\\ConditionMatcher',
't3lib_contextmenu_AbstractContextMenu' => 'TYPO3\\CMS\\Backend\\ContextMenu\\AbstractContextMenu',
't3lib_contextmenu_AbstractDataProvider' => 'TYPO3\\CMS\\Backend\\ContextMenu\\AbstractContextMenuDataProvider',
't3lib_contextmenu_Action' => 'TYPO3\\CMS\\Backend\\ContextMenu\\ContextMenuAction',
't3lib_contextmenu_ActionCollection' => 'TYPO3\\CMS\\Backend\\ContextMenu\\ContextMenuActionCollection',
't3lib_contextmenu_extdirect_ContextMenu' => 'TYPO3\\CMS\\Backend\\ContextMenu\\Extdirect\\AbstractExtdirectContextMenu',
't3lib_contextmenu_pagetree_DataProvider' => 'TYPO3\\CMS\\Backend\\ContextMenu\\Pagetree\\ContextMenuDataProvider',
't3lib_contextmenu_pagetree_extdirect_ContextMenu' => 'TYPO3\\CMS\\Backend\\ContextMenu\\Pagetree\\Extdirect\\ContextMenuConfiguration',
't3lib_contextmenu_renderer_Abstract' => 'TYPO3\\CMS\\Backend\\ContextMenu\\Renderer\\AbstractContextMenuRenderer',
'TYPO3backend' => 'TYPO3\\CMS\\Backend\\Controller\\BackendController',
'SC_wizard_backend_layout' => 'TYPO3\\CMS\\Backend\\Controller\\BackendLayoutWizardController',
'SC_alt_clickmenu' => 'TYPO3\\CMS\\Backend\\Controller\\ClickMenuController',
'SC_show_rechis' => 'TYPO3\\CMS\\Backend\\Controller\\ContentElement\\ElementHistoryController',
'SC_show_item' => 'TYPO3\\CMS\\Backend\\Controller\\ContentElement\\ElementInformationController',
'SC_move_el' => 'TYPO3\\CMS\\Backend\\Controller\\ContentElement\\MoveElementController',
'SC_db_new_content_el' => 'TYPO3\\CMS\\Backend\\Controller\\ContentElement\\NewContentElementController',
'SC_dummy' => 'TYPO3\\CMS\\Backend\\Controller\\DummyController',
'SC_alt_doc' => 'TYPO3\\CMS\\Backend\\Controller\\EditDocumentController',
'SC_file_newfolder' => 'TYPO3\\CMS\\Backend\\Controller\\File\\CreateFolderController',
'SC_file_edit' => 'TYPO3\\CMS\\Backend\\Controller\\File\\EditFileController',
'TYPO3_tcefile' => 'TYPO3\\CMS\\Backend\\Controller\\File\\FileController',
'SC_file_upload' => 'TYPO3\\CMS\\Backend\\Controller\\File\\FileUploadController',
'SC_file_rename' => 'TYPO3\\CMS\\Backend\\Controller\\File\\RenameFileController',
'SC_alt_file_navframe' => 'TYPO3\\CMS\\Backend\\Controller\\FileSystemNavigationFrameController',
'SC_listframe_loader' => 'TYPO3\\CMS\\Backend\\Controller\\ListFrameLoaderController',
'SC_index' => 'TYPO3\\CMS\\Backend\\Controller\\LoginController',
'SC_login_frameset' => 'TYPO3\\CMS\\Backend\\Controller\\LoginFramesetController',
'SC_logout' => 'TYPO3\\CMS\\Backend\\Controller\\LogoutController',
'SC_db_new' => 'TYPO3\\CMS\\Backend\\Controller\\NewRecordController',
'SC_alt_doc_nodoc' => 'TYPO3\\CMS\\Backend\\Controller\\NoDocumentsOpenController',
'SC_db_layout' => 'TYPO3\\CMS\\Backend\\Controller\\PageLayoutController',
'SC_alt_db_navframe' => 'TYPO3\\CMS\\Backend\\Controller\\PageTreeNavigationController',
'SC_alt_shortcut' => 'TYPO3\\CMS\\Backend\\Controller\\ShortcutFrameController',
'SC_tce_db' => 'TYPO3\\CMS\\Backend\\Controller\\SimpleDataHandlerController',
'SC_wizard_add' => 'TYPO3\\CMS\\Backend\\Controller\\Wizard\\AddController',
'SC_wizard_colorpicker' => 'TYPO3\\CMS\\Backend\\Controller\\Wizard\\ColorpickerController',
'SC_wizard_edit' => 'TYPO3\\CMS\\Backend\\Controller\\Wizard\\EditController',
'SC_wizard_forms' => 'TYPO3\\CMS\\Backend\\Controller\\Wizard\\FormsController',
'SC_wizard_list' => 'TYPO3\\CMS\\Backend\\Controller\\Wizard\\ListController',
'SC_wizard_rte' => 'TYPO3\\CMS\\Backend\\Controller\\Wizard\\RteController',
'SC_wizard_table' => 'TYPO3\\CMS\\Backend\\Controller\\Wizard\\TableController',
't3lib_transferData' => 'TYPO3\\CMS\\Backend\\Form\\DataPreprocessor',
't3lib_TCEforms_inline' => 'TYPO3\\CMS\\Backend\\Form\\Element\\InlineElement',
't3lib_tceformsInlineHook' => 'TYPO3\\CMS\\Backend\\Form\\Element\\InlineElementHookInterface',
't3lib_TCEforms_FE' => 'TYPO3\\CMS\\Backend\\Form\\FrontendFormEngine',
't3lib_TCEforms_dbFileIconsHook' => 'TYPO3\\CMS\\Backend\\Form\\DatabaseFileIconsHookInterface',
't3lib_TCEforms_Suggest_DefaultReceiver' => 'TYPO3\\CMS\\Backend\\Form\\Element\\SuggestDefaultReceiver',
't3lib_TCEforms_Suggest' => 'TYPO3\\CMS\\Backend\\Form\\Element\\SuggestElement',
't3lib_TCEforms_Tree' => 'TYPO3\\CMS\\Backend\\Form\\Element\\TreeElement',
't3lib_TCEforms_ValueSlider' => 'TYPO3\\CMS\\Backend\\Form\\Element\\ValueSlider',
't3lib_TCEforms_Flexforms' => 'TYPO3\\CMS\\Backend\\Form\\FlexFormsHelper',
't3lib_TCEforms' => 'TYPO3\\CMS\\Backend\\Form\\FormEngine',
't3lib_tsfeBeUserAuth' => 'TYPO3\\CMS\\Backend\\FrontendBackendUserAuthentication',
'recordHistory' => 'TYPO3\\CMS\\Backend\\History\\RecordHistory',
'extDirect_DataProvider_State' => 'TYPO3\\CMS\\Backend\\InterfaceState\\ExtDirect\\DataProvider',
't3lib_extobjbase' => 'TYPO3\\CMS\\Backend\\Module\\AbstractFunctionModule',
't3lib_SCbase' => 'TYPO3\\CMS\\Backend\\Module\\BaseScriptClass',
't3lib_loadModules' => 'TYPO3\\CMS\\Backend\\Module\\ModuleLoader',
'Typo3_ModuleStorage' => 'TYPO3\\CMS\\Backend\\Module\\ModuleStorage',
't3lib_modSettings' => 'TYPO3\\CMS\\Backend\\ModuleSettings',
't3lib_recordList' => 'TYPO3\\CMS\\Backend\\RecordList\\AbstractRecordList',
'TBE_browser_recordList' => 'TYPO3\\CMS\\Backend\\RecordList\\ElementBrowserRecordList',
't3lib_localRecordListGetTableHook' => 'TYPO3\\CMS\\Backend\\RecordList\\RecordListGetTableHookInterface',
't3lib_rteapi' => 'TYPO3\\CMS\\Backend\\Rte\\AbstractRte',
'extDirect_dataProvider_BackendLiveSearch' => 'TYPO3\\CMS\\Backend\\Search\\LiveSearch\\ExtDirect\\LiveSearchDataProvider',
't3lib_search_liveSearch' => 'TYPO3\\CMS\\Backend\\Search\\LiveSearch\\LiveSearch',
't3lib_search_liveSearch_queryParser' => 'TYPO3\\CMS\\Backend\\Search\\LiveSearch\\QueryParser',
't3lib_spritemanager_AbstractHandler' => 'TYPO3\\CMS\\Backend\\Sprite\\AbstractSpriteHandler',
't3lib_spritemanager_SimpleHandler' => 'TYPO3\\CMS\\Backend\\Sprite\\SimpleSpriteHandler',
't3lib_spritemanager_SpriteBuildingHandler' => 'TYPO3\\CMS\\Backend\\Sprite\\SpriteBuildingHandler',
't3lib_spritemanager_SpriteGenerator' => 'TYPO3\\CMS\\Backend\\Sprite\\SpriteGenerator',
't3lib_spritemanager_SpriteIconGenerator' => 'TYPO3\\CMS\\Backend\\Sprite\\SpriteIconGeneratorInterface',
't3lib_SpriteManager' => 'TYPO3\\CMS\\Backend\\Sprite\\SpriteManager',
'bigDoc' => 'TYPO3\\CMS\\Backend\\Template\\BigDocumentTemplate',
'template' => 'TYPO3\\CMS\\Backend\\Template\\DocumentTemplate',
'frontendDoc' => 'TYPO3\\CMS\\Backend\\Template\\FrontendDocumentTemplate',
'mediumDoc' => 'TYPO3\\CMS\\Backend\\Template\\MediumDocumentTemplate',
'smallDoc' => 'TYPO3\\CMS\\Backend\\Template\\SmallDocumentTemplate',
'noDoc' => 'TYPO3\\CMS\\Backend\\Template\\StandardDocumentTemplate',
'backend_cacheActionsHook' => 'TYPO3\\CMS\\Backend\\Toolbar\\ClearCacheActionsHookInterface',
'ClearCacheMenu' => 'TYPO3\\CMS\\Backend\\Toolbar\\ClearCacheToolbarItem',
'LiveSearch' => 'TYPO3\\CMS\\Backend\\Toolbar\\LiveSearchToolbarItem',
'ShortcutMenu' => 'TYPO3\\CMS\\Backend\\Toolbar\\ShortcutToolbarItem',
'backend_toolbarItem' => 'TYPO3\\CMS\\Backend\\Toolbar\\ToolbarItemHookInterface',
't3lib_tree_ExtDirect_AbstractExtJsTree' => 'TYPO3\\CMS\\Backend\\Tree\\AbstractExtJsTree',
't3lib_tree_AbstractTree' => 'TYPO3\\CMS\\Backend\\Tree\\AbstractTree',
't3lib_tree_AbstractDataProvider' => 'TYPO3\\CMS\\Backend\\Tree\\AbstractTreeDataProvider',
't3lib_tree_AbstractStateProvider' => 'TYPO3\\CMS\\Backend\\Tree\\AbstractTreeStateProvider',
't3lib_tree_ComparableNode' => 'TYPO3\\CMS\\Backend\\Tree\\ComparableNodeInterface',
't3lib_tree_DraggableAndDropable' => 'TYPO3\\CMS\\Backend\\Tree\\DraggableAndDropableNodeInterface',
't3lib_tree_LabelEditable' => 'TYPO3\\CMS\\Backend\\Tree\\EditableNodeLabelInterface',
't3lib_tree_extdirect_Node' => 'TYPO3\\CMS\\Backend\\Tree\\ExtDirectNode',
't3lib_tree_pagetree_interfaces_CollectionProcessor' => 'TYPO3\\CMS\\Backend\\Tree\\Pagetree\\CollectionProcessorInterface',
't3lib_tree_pagetree_Commands' => 'TYPO3\\CMS\\Backend\\Tree\\Pagetree\\Commands',
't3lib_tree_pagetree_DataProvider' => 'TYPO3\\CMS\\Backend\\Tree\\Pagetree\\DataProvider',
't3lib_tree_pagetree_extdirect_Commands' => 'TYPO3\\CMS\\Backend\\Tree\\Pagetree\\ExtdirectTreeCommands',
't3lib_tree_pagetree_extdirect_Tree' => 'TYPO3\\CMS\\Backend\\Tree\\Pagetree\\ExtdirectTreeDataProvide',
't3lib_tree_pagetree_Indicator' => 'TYPO3\\CMS\\Backend\\Tree\\Pagetree\\Indicator',
't3lib_tree_pagetree_interfaces_IndicatorProvider' => 'TYPO3\\CMS\\Backend\\Tree\\Pagetree\\IndicatorProviderInterface',
't3lib_tree_pagetree_Node' => 'TYPO3\\CMS\\Backend\\Tree\\Pagetree\\PagetreeNode',
't3lib_tree_pagetree_NodeCollection' => 'TYPO3\\CMS\\Backend\\Tree\\Pagetree\\PagetreeNodeCollection',
't3lib_tree_Renderer_Abstract' => 'TYPO3\\CMS\\Backend\\Tree\\Renderer\\AbstractTreeRenderer',
't3lib_tree_Renderer_ExtJsJson' => 'TYPO3\\CMS\\Backend\\Tree\\Renderer\\ExtJsJsonTreeRenderer',
't3lib_tree_Renderer_UnorderedList' => 'TYPO3\\CMS\\Backend\\Tree\\Renderer\\UnorderedListTreeRenderer',
't3lib_tree_SortedNodeCollection' => 'TYPO3\\CMS\\Backend\\Tree\\SortedTreeNodeCollection',
't3lib_tree_Node' => 'TYPO3\\CMS\\Backend\\Tree\\TreeNode',
't3lib_tree_NodeCollection' => 'TYPO3\\CMS\\Backend\\Tree\\TreeNodeCollection',
't3lib_tree_RepresentationNode' => 'TYPO3\\CMS\\Backend\\Tree\\TreeRepresentationNode',
't3lib_treeView' => 'TYPO3\\CMS\\Backend\\Tree\\View\\AbstractTreeView',
't3lib_browseTree' => 'TYPO3\\CMS\\Backend\\Tree\\View\\BrowseTreeView',
't3lib_folderTree' => 'TYPO3\\CMS\\Backend\\Tree\\View\\FolderTreeView',
't3lib_positionMap' => 'TYPO3\\CMS\\Backend\\Tree\\View\\PagePositionMap',
't3lib_pageTree' => 'TYPO3\\CMS\\Backend\\Tree\\View\\PageTreeView',
'extDirect_DataProvider_BackendUserSettings' => 'TYPO3\\CMS\\Backend\\User\\ExtDirect\\BackendUserSettingsDataProvider',
't3lib_BEfunc' => 'TYPO3\\CMS\\Backend\\Utility\\BackendUtility',
't3lib_iconWorks' => 'TYPO3\\CMS\\Backend\\Utility\\IconUtility',
'tx_cms_BackendLayout' => 'TYPO3\\CMS\\Backend\\View\\BackendLayoutView',
'ModuleMenu' => 'TYPO3\\CMS\\Backend\\View\\ModuleMenuView',
'tx_cms_layout' => 'TYPO3\\CMS\\Backend\\View\\PageLayoutView',
'tx_cms_layout_tt_content_drawItemHook' => 'TYPO3\\CMS\\Backend\\View\\PageLayoutViewDrawItemHookInterface',
'webPageTree' => 'TYPO3\\CMS\\Backend\\View\\PageTreeView',
'SC_t3lib_thumbs' => 'TYPO3\\CMS\\Backend\\View\\ThumbnailView',
'TYPO3Logo' => 'TYPO3\\CMS\\Backend\\View\\LogoView',
'cms_newContentElementWizardsHook' => 'TYPO3\\CMS\\Backend\\Wizard\\NewContentElementWizardHookInterface',
'SC_wizard_tsconfig' => 'TYPO3\\CMS\\Backend\\Wizard\\TsconfigWizard',
);
?>
\ No newline at end of file
......@@ -78,7 +78,7 @@ class CompatbilityClassLoaderPhpBelow50307 extends \TYPO3\CMS\Core\Core\ClassLoa
} else {
$cacheIdentifier = static::getClassPathCacheIdentifier($classPath);
/** @var $phpCodeCache \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend */
$phpCodeCache = $GLOBALS['typo3CacheManager']->getCache('cache_phpcode');
$phpCodeCache = $GLOBALS['typo3CacheManager']->getCache('cache_core');
if (!$phpCodeCache->has($cacheIdentifier)) {
$classCode = static::rewriteMethodTypeHintsFromClassPath($classPath);
$phpCodeCache->set($cacheIdentifier, $classCode, array(), 0);
......@@ -102,7 +102,7 @@ class CompatbilityClassLoaderPhpBelow50307 extends \TYPO3\CMS\Core\Core\ClassLoa
// The class content has to be part of the identifier too
// otherwise the old class files get loaded from cache
$fileSha1 = sha1_file($classPath);
$cacheIdentifier = $fileNameWithoutExtension . '_' . substr(sha1($fileSha1 . '|' . $relativeClassPath), 0, 20);
$cacheIdentifier = 'ClassLoader_' . $fileNameWithoutExtension . '_' . substr(sha1($fileSha1 . '|' . $relativeClassPath), 0, 20);
// Clean up identifier to be a valid cache entry identifier
$cacheIdentifier = preg_replace('/[^a-zA-Z0-9_%\-&]/i', '_', $cacheIdentifier);
return $cacheIdentifier;
......
......@@ -29,7 +29,7 @@ use \TYPO3\CMS\Core\Utility\GeneralUtility;
***************************************************************/
/**
* This class contains TYPO3 autoloader for classes.
* This class contains TYPO3 class loader for classes.
* It handles:
* - The core of TYPO3
* - All extensions with an ext_autoload.php file
......@@ -82,7 +82,7 @@ class ClassLoader {
*
* @var string
*/
static protected $autoloadCacheIdentifier = NULL;
static protected $classLoaderCacheIdentifier = NULL;
/**
* Track if the cache file written to disk should be updated.
......@@ -96,28 +96,24 @@ class ClassLoader {
static protected $cacheUpdateRequired = FALSE;
/**
* The autoloader is static, thus we do not allow instances of this class.
* The class loader is static, thus we do not allow instances of this class.
*/
private function __construct() {
}
/**
* Installs TYPO3 autoloader, and loads the autoload registry for the core.
* Installs TYPO3 class loader, and loads the autoload registry for the core.
*
* @return boolean TRUE in case of success
*/
static public function registerAutoloader() {
if (!static::$mappingLoaded) {
static::loadCoreClassAliasMapping();
static::$mappingLoaded = TRUE;
}
static::loadCoreAndExtensionRegistry();
static::loadClassLoaderCache();
return spl_autoload_register(static::$className . '::autoload', TRUE, TRUE);
}
/**
* Unload TYPO3 autoloader and write any additional classes
* Unload TYPO3 class loader and write any additional classes
* found during the script run to the cache file.
*
* This method is called during shutdown of the framework.
......@@ -126,10 +122,12 @@ class ClassLoader {
*/
static public function unregisterAutoloader() {
if (static::$cacheUpdateRequired) {
static::updateRegistryCacheEntry(static::$classNameToFileMapping);
static::updateClassLoaderCacheEntry(array(static::$classNameToFileMapping, static::$aliasToClassNameMapping));
static::$cacheUpdateRequired = FALSE;
}
static::$classNameToFileMapping = array();
static::$aliasToClassNameMapping = array();
static::$classNameToAliasMapping = array();
return spl_autoload_unregister(static::$className . '::autoload');
}
......@@ -182,22 +180,29 @@ class ClassLoader {
*
* @return void
*/
static protected function loadCoreAndExtensionRegistry() {
static protected function loadClassLoaderCache() {
$classRegistry = NULL;
$aliasToClassNameMapping = NULL;
/** @var $phpCodeCache \TYPO3\CMS\Core\Cache\Frontend\PhpFrontend */
$phpCodeCache = $GLOBALS['typo3CacheManager']->getCache('cache_core');
// Create autoload cache file if it does not exist yet
if ($phpCodeCache->has(static::getAutoloadCacheIdentifier())) {
$classRegistry = $phpCodeCache->requireOnce(static::getAutoloadCacheIdentifier());
} else {
static::$cacheUpdateRequired = TRUE;
$classRegistry = static::lowerCaseClassRegistry(static::createCoreAndExtensionRegistry());
if ($phpCodeCache->has(static::getClassLoaderCacheIdentifier())) {
list($classRegistry, $aliasToClassNameMapping) = $phpCodeCache->requireOnce(static::getClassLoaderCacheIdentifier());
}
// This can only happen if the autoloader was already registered
// This can only happen if the class loader was already registered
// in the same call once, the requireOnce of the cache file then
// does not give the cached array back. In this case we just read
// all cache entries manually again.
// This can happen in unit tests and if the cache backend was
// switched to NullBackend for example to simplify development
if (!is_array($aliasToClassNameMapping)) {
static::$cacheUpdateRequired = TRUE;
$aliasToClassNameMapping = static::createCoreAndExtensionClassAliasMap();
}
static::$aliasToClassNameMapping = $aliasToClassNameMapping;
static::$classNameToAliasMapping = array_flip($aliasToClassNameMapping);
self::setAliasesForEarlyInstances();
if (!is_array($classRegistry)) {
static::$cacheUpdateRequired = TRUE;
$classRegistry = static::lowerCaseClassRegistry(static::createCoreAndExtensionRegistry());
......@@ -205,28 +210,62 @@ class ClassLoader {
static::$classNameToFileMapping = $classRegistry;
}
static public function loadCoreClassAliasMapping() {
static::$aliasToClassNameMapping = require __DIR__ . '/../../Migrations/Code/ClassAliasMap201208221700.php';
// Create aliases for early loaded classes
$classedLoadedPriorToAutoloader = array_intersect(static::$aliasToClassNameMapping, get_declared_classes());
if (!empty($classedLoadedPriorToAutoloader)) {
foreach ($classedLoadedPriorToAutoloader as $oldClassName => $newClassName) {
class_alias($newClassName, $oldClassName);
/**
* Collects and merges the class alias maps of extensions
*
* @return array The class alias map
*/
static protected function createCoreAndExtensionClassAliasMap() {
$aliasToClassNameMapping = array();
foreach (\TYPO3\CMS\Core\Extension\ExtensionManager::getLoadedExtensionListArray() as $extensionKey) {
try {
$extensionClassAliasMap = \TYPO3\CMS\Core\Extension\ExtensionManager::extPath($extensionKey, 'Migrations/Code/ClassAliasMap.php');
if (@file_exists($extensionClassAliasMap)) {
$aliasToClassNameMapping = array_merge($aliasToClassNameMapping, require $extensionClassAliasMap);
}
} catch (\BadFunctionCallException $e) {
}
}
foreach (static::$aliasToClassNameMapping as $oldClassName => $newClassName) {
static::$aliasToClassNameMapping[strtolower($oldClassName)] = $newClassName;
foreach ($aliasToClassNameMapping as $oldClassName => $newClassName) {
$aliasToClassNameMapping[GeneralUtility::strtolower($oldClassName)] = $newClassName;
}
static::$classNameToAliasMapping = array_flip(static::$aliasToClassNameMapping);
// Order by key length longest first
uksort($aliasToClassNameMapping, function($a, $b) {
return strlen($b) - strlen($a);
});
return $aliasToClassNameMapping;
}
static public function getClassNameForAlias($className) {
$lookUpClassName = strtolower($className);
return isset(static::$aliasToClassNameMapping[$lookUpClassName]) ? static::$aliasToClassNameMapping[$lookUpClassName] : $className;
/**
* Create aliases for early loaded classes
*/
protected static function setAliasesForEarlyInstances() {
$classedLoadedPriorToClassLoader = array_intersect(static::$aliasToClassNameMapping, get_declared_classes());
if (!empty($classedLoadedPriorToClassLoader)) {
foreach ($classedLoadedPriorToClassLoader as $oldClassName => $newClassName) {
if (!class_exists($oldClassName, FALSE)) {
class_alias($newClassName, $oldClassName);
}
}
}
}
static public function getAliasForClassName($alias) {
return isset(static::$classNameToAliasMapping[$alias]) ? static::$classNameToAliasMapping[$alias] : $alias;
/**
* @param string $alias
* @return mixed
*/
static public function getClassNameForAlias($alias) {
$lookUpClassName = GeneralUtility::strtolower($alias);
return isset(static::$aliasToClassNameMapping[$lookUpClassName]) ? static::$aliasToClassNameMapping[$lookUpClassName] : $alias;
}
/**
* @param string $className
* @return mixed
*/
static public function getAliasForClassName($className) {
return isset(static::$classNameToAliasMapping[$className]) ? static::$classNameToAliasMapping[$className] : $className;
}
/**
......@@ -325,7 +364,7 @@ class ClassLoader {
}
/**
* Adds a single class to autoloader cache.
* Adds a single class to class loader cache.
*
* @static
* @param string $classFilePathAndName Physical path of file containing $className
......@@ -340,20 +379,15 @@ class ClassLoader {
}
/**
* Set or update autoloader cache entry.
* Set or update class loader cache entry.
* It is expected that all class names (keys) are already lowercased!
*
* @param array $registry Current registry entries
* @param array $cacheContent Current class loader cache entries
* @return void
*/
static protected function updateRegistryCacheEntry(array $registry) {
$cachedFileContent = 'return array(';
foreach ($registry as $className => $classLocation) {
$nullOrLocation = is_string($classLocation) ? '\'' . $classLocation . '\',' : 'NULL,';
$cachedFileContent .= LF . '\'' . $className . '\' => ' . $nullOrLocation;
}
$cachedFileContent .= LF . ');';
$GLOBALS['typo3CacheManager']->getCache('cache_core')->set(static::getAutoloadCacheIdentifier(), $cachedFileContent);
static protected function updateClassLoaderCacheEntry(array $cacheContent) {
$cachedFileContent = 'return ' . var_export($cacheContent, TRUE) . ';';
$GLOBALS['typo3CacheManager']->getCache('cache_core')->set(static::getClassLoaderCacheIdentifier(), $cachedFileContent);
}
/**
......@@ -367,11 +401,11 @@ class ClassLoader {
*
* @return string identifier
*/
static protected function getAutoloadCacheIdentifier() {
if (is_null(static::$autoloadCacheIdentifier)) {
static::$autoloadCacheIdentifier = 'autoload_' . sha1((TYPO3_version . PATH_site . 'autoload'));
static protected function getClassLoaderCacheIdentifier() {
if (is_null(static::$classLoaderCacheIdentifier)) {
static::$classLoaderCacheIdentifier = 'ClassLoader_' . sha1((TYPO3_version . PATH_site . 'ClassLoader'));
}
return static::$autoloadCacheIdentifier;
return static::$classLoaderCacheIdentifier;
}
/**
......
<?php
return array(
't3lib_cli' => 'TYPO3\\CMS\\Core\\Controller\\CommandLineController',
'extDirect_DataProvider_ContextHelp' => 'TYPO3\\CMS\\ContextHelp\\ExtDirect\\ContextHelpDataProvider',
't3lib_userAuth' => 'TYPO3\\CMS\\Core\\Authentication\\AbstractUserAuthentication',
't3lib_beUserAuth' => 'TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication',
't3lib_autoloader' => 'TYPO3\\CMS\\Core\\Core\\ClassLoader',
't3lib_cache_backend_AbstractBackend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\AbstractBackend',
't3lib_cache_backend_ApcBackend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\ApcBackend',
't3lib_cache_backend_Backend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\BackendInterface',
't3lib_cache_backend_FileBackend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\FileBackend',
't3lib_cache_backend_MemcachedBackend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\MemcachedBackend',
't3lib_cache_backend_NullBackend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\NullBackend',
't3lib_cache_backend_PdoBackend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\PdoBackend',
't3lib_cache_backend_PhpCapableBackend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\PhpCapableBackendInterface',
't3lib_cache_backend_RedisBackend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\RedisBackend',
't3lib_cache_backend_TransientMemoryBackend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\TransientMemoryBackend',
't3lib_cache_backend_DbBackend' => 'TYPO3\\CMS\\Core\\Cache\\Backend\\Typo3DatabaseBackend',
't3lib_cache' => 'TYPO3\\CMS\\Core\\Cache\\Cache',
't3lib_cache_Factory' => 'TYPO3\\CMS\\Core\\Cache\\CacheFactory',
't3lib_cache_Manager' => 'TYPO3\\CMS\\Core\\Cache\\CacheManager',
't3lib_cache_Exception' => 'TYPO3\\CMS\\Core\\Cache\\Exception',
't3lib_cache_exception_ClassAlreadyLoaded' => 'TYPO3\\CMS\\Core\\Cache\\Exception\\ClassAlreadyLoadedException',
't3lib_cache_exception_DuplicateIdentifier' => 'TYPO3\\CMS\\Core\\Cache\\Exception\\DuplicateIdentifierException',
't3lib_cache_exception_InvalidBackend' => 'TYPO3\\CMS\\Core\\Cache\\Exception\\InvalidBackendException',
't3lib_cache_exception_InvalidCache' => 'TYPO3\\CMS\\Core\\Cache\\Exception\\InvalidCacheException',
't3lib_cache_exception_InvalidData' => 'TYPO3\\CMS\\Core\\Cache\\Exception\\InvalidDataException',
't3lib_cache_exception_NoSuchCache' => 'TYPO3\\CMS\\Core\\Cache\\Exception\\NoSuchCacheException',
't3lib_cache_frontend_AbstractFrontend' => 'TYPO3\\CMS\\Core\\Cache\\Frontend\\AbstractFrontend',
't3lib_cache_frontend_Frontend' => 'TYPO3\\CMS\\Core\\Cache\\Frontend\\FrontendInterface',
't3lib_cache_frontend_PhpFrontend' => 'TYPO3\\CMS\\Core\\Cache\\Frontend\\PhpFrontend',
't3lib_cache_frontend_StringFrontend' => 'TYPO3\\CMS\\Core\\Cache\\Frontend\\StringFrontend',
't3lib_cache_frontend_VariableFrontend' => 'TYPO3\\CMS\\Core\\Cache\\Frontend\\VariableFrontend',
't3lib_cs' => 'TYPO3\\CMS\\Core\\Charset\\CharsetConverter',
't3lib_collection_AbstractRecordCollection' => 'TYPO3\\CMS\\Core\\Collection\\AbstractRecordCollection',
't3lib_collection_Collection' => 'TYPO3\\CMS\\Core\\Collection\\CollectionInterface',
't3lib_collection_Editable' => 'TYPO3\\CMS\\Core\\Collection\\EditableCollectionInterface',
't3lib_collection_Nameable' => 'TYPO3\\CMS\\Core\\Collection\\NameableCollectionInterface',
't3lib_collection_Persistable' => 'TYPO3\\CMS\\Core\\Collection\\PersistableCollectionInterface',
't3lib_collection_RecordCollection' => 'TYPO3\\CMS\\Core\\Collection\\RecordCollectionInterface',
't3lib_collection_RecordCollectionRepository' => 'TYPO3\\CMS\\Core\\Collection\\RecordCollectionRepository',
't3lib_collection_Sortable' => 'TYPO3\\CMS\\Core\\Collection\\SortableCollectionInterface',
't3lib_collection_StaticRecordCollection' => 'TYPO3\\CMS\\Core\\Collection\\StaticRecordCollection',
't3lib_flexformtools' => 'TYPO3\\CMS\\Core\\Configuration\\FlexForm\\FlexFormTools',
't3lib_matchCondition_abstract' => 'TYPO3\\CMS\\Core\\Configuration\\TypoScript\\ConditionMatching\\AbstractConditionMatcher',
't3lib_DB' => 'TYPO3\\CMS\\Core\\Database\\DatabaseConnection',
't3lib_PdoHelper' => 'TYPO3\\CMS\\Core\\Database\\PdoHelper',
't3lib_DB_postProcessQueryHook' => 'TYPO3\\CMS\\Core\\Database\\PostProcessQueryHookInterface',
't3lib_db_PreparedStatement' => 'TYPO3\\CMS\\Core\\Database\\PreparedStatement',
't3lib_DB_preProcessQueryHook' => 'TYPO3\\CMS\\Core\\Database\\PreProcessQueryHookInterface',
't3lib_queryGenerator' => 'TYPO3\\CMS\\Core\\Database\\QueryGenerator',
't3lib_fullsearch' => 'TYPO3\\CMS\\Core\\Database\\QueryView',
't3lib_refindex' => 'TYPO3\\CMS\\Core\\Database\\ReferenceIndex',
't3lib_loadDBGroup' => 'TYPO3\\CMS\\Core\\Database\\RelationHandler',
't3lib_softrefproc' => 'TYPO3\\CMS\\Core\\Database\\SoftReferenceIndex',
't3lib_sqlparser' => 'TYPO3\\CMS\\Core\\Database\\SqlParser',
't3lib_extTables_PostProcessingHook' => 'TYPO3\\CMS\\Core\\Database\\TableConfigurationPostProcessingHookInterface',
't3lib_TCEmain' => 'TYPO3\\CMS\\Core\\DataHandling\\DataHandler',
't3lib_TCEmain_checkModifyAccessListHook' => 'TYPO3\\CMS\\Core\\DataHandling\\DataHandlerCheckModifyAccessListHookInterface',
't3lib_TCEmain_processUploadHook' => 'TYPO3\\CMS\\Core\\DataHandling\\DataHandlerProcessUploadHookInterface',
't3lib_browseLinksHook' => 'TYPO3\\CMS\\Core\\ElementBrowser\\ElementBrowserHookInterface',
't3lib_codec_JavaScriptEncoder' => 'TYPO3\\CMS\\Core\\Encoder\\JavaScriptEncoder',
't3lib_error_AbstractExceptionHandler' => 'TYPO3\\CMS\\Core\\Error\\AbstractExceptionHandler',
't3lib_error_DebugExceptionHandler' => 'TYPO3\\CMS\\Core\\Error\\DebugExceptionHandler',
't3lib_error_ErrorHandler' => 'TYPO3\\CMS\\Core\\Error\\ErrorHandler',
't3lib_error_ErrorHandlerInterface' => 'TYPO3\\CMS\\Core\\Error\\ErrorHandlerInterface',
't3lib_error_Exception' => 'TYPO3\\CMS\\Core\\Error\\Exception',
't3lib_error_ExceptionHandlerInterface' => 'TYPO3\\CMS\\Core\\Error\\ExceptionHandlerInterface',
't3lib_error_http_AbstractClientErrorException' => 'TYPO3\\CMS\\Core\\Error\\Http\\AbstractClientErrorException',
't3lib_error_http_AbstractServerErrorException' => 'TYPO3\\CMS\\Core\\Error\\Http\\AbstractServerErrorException',
't3lib_error_http_BadRequestException' => 'TYPO3\\CMS\\Core\\Error\\Http\\BadRequestException',
't3lib_error_http_ForbiddenException' => 'TYPO3\\CMS\\Core\\Error\\Http\\ForbiddenException',
't3lib_error_http_PageNotFoundException' => 'TYPO3\\CMS\\Core\\Error\\Http\\PageNotFoundException',
't3lib_error_http_ServiceUnavailableException' => 'TYPO3\\CMS\\Core\\Error\\Http\\ServiceUnavailableException',
't3lib_error_http_StatusException' => 'TYPO3\\CMS\\Core\\Error\\Http\\StatusException',
't3lib_error_http_UnauthorizedException' => 'TYPO3\\CMS\\Core\\Error\\Http\\UnauthorizedException',
't3lib_error_ProductionExceptionHandler' => 'TYPO3\\CMS\\Core\\Error\\ProductionExceptionHandler',
't3lib_exception' => 'TYPO3\\CMS\\Core\\Exception',
't3lib_extjs_ExtDirectApi' => 'TYPO3\\CMS\\Core\\ExtDirect\\ExtDirectApi',
't3lib_extjs_ExtDirectDebug' => 'TYPO3\\CMS\\Core\\ExtDirect\\ExtDirectDebug',
't3lib_extjs_ExtDirectRouter' => 'TYPO3\\CMS\\Core\\ExtDirect\\ExtDirectRouter',
't3lib_extMgm' => 'TYPO3\\CMS\\Core\\Extension\\ExtensionManager',
't3lib_formprotection_Abstract' => 'TYPO3\\CMS\\Core\\FormProtection\\AbstractFormProtection',
't3lib_formprotection_BackendFormProtection' => 'TYPO3\\CMS\\Core\\FormProtection\\BackendFormProtection',
't3lib_formprotection_DisabledFormProtection' => 'TYPO3\\CMS\\Core\\FormProtection\\DisabledFormProtection',
't3lib_formprotection_InvalidTokenException' => 'TYPO3\\CMS\\Core\\FormProtection\\Exception',
't3lib_formprotection_Factory' => 'TYPO3\\CMS\\Core\\FormProtection\\FormProtectionFactory',
't3lib_formprotection_InstallToolFormProtection' => 'TYPO3\\CMS\\Core\\FormProtection\\InstallToolFormProtection',
't3lib_frontendedit' => 'TYPO3\\CMS\\Core\\FrontendEditing\\FrontendEditingController',
't3lib_parsehtml' => 'TYPO3\\CMS\\Core\\Html\\HtmlParser',
't3lib_parsehtml_proc' => 'TYPO3\\CMS\\Core\\Html\\RteHtmlParser',
'TYPO3AJAX' => 'TYPO3\\CMS\\Core\\Http\\AjaxRequestHandler',
't3lib_http_Request' => 'TYPO3\\CMS\\Core\\Http\\HttpRequest',
't3lib_http_observer_Download' => 'TYPO3\\CMS\\Core\\Http\\Observer\\Download',
't3lib_stdGraphic' => 'TYPO3\\CMS\\Core\\Imaging\\GraphicalFunctions',
't3lib_admin' => 'TYPO3\\CMS\\Core\\Integrity\\DatabaseIntegrityCheck',
't3lib_l10n_exception_FileNotFound' => 'TYPO3\\CMS\\Core\\Localization\\Exception\\FileNotFoundException',
't3lib_l10n_exception_InvalidParser' => 'TYPO3\\CMS\\Core\\Localization\\Exception\\InvalidParserException',
't3lib_l10n_exception_InvalidXmlFile' => 'TYPO3\\CMS\\Core\\Localization\\Exception\\InvalidXmlFileException',
't3lib_l10n_Store' => 'TYPO3\\CMS\\Core\\Localization\\LanguageStore',
't3lib_l10n_Locales' => 'TYPO3\\CMS\\Core\\Localization\\Locales',
't3lib_l10n_Factory' => 'TYPO3\\CMS\\Core\\Localization\\LocalizationFactory',
't3lib_l10n_parser_AbstractXml' => 'TYPO3\\CMS\\Core\\Localization\\Parser\\AbstractXmlParser',
't3lib_l10n_parser' => 'TYPO3\\CMS\\Core\\Localization\\Parser\\LocalizationParserInterface',
't3lib_l10n_parser_Llphp' => 'TYPO3\\CMS\\Core\\Localization\\Parser\\LocallangArrayParser',
't3lib_l10n_parser_Llxml' => 'TYPO3\\CMS\\Core\\Localization\\Parser\\LocallangXmlParser',
't3lib_l10n_parser_Xliff' => 'TYPO3\\CMS\\Core\\Localization\\Parser\\XliffParser',
't3lib_lock' => 'TYPO3\\CMS\\Core\\Locking\\Locker',
't3lib_mail_Mailer' => 'TYPO3\\CMS\\Core\\Mail\\Mailer',
't3lib_mail_MailerAdapter' => 'TYPO3\\CMS\\Core\\Mail\\MailerAdapterInterface',
't3lib_mail_Message' => 'TYPO3\\CMS\\Core\\Mail\\MailMessage',
't3lib_mail_MboxTransport' => 'TYPO3\\CMS\\Core\\Mail\\MboxTransport',
't3lib_mail_Rfc822AddressesParser' => 'TYPO3\\CMS\\Core\\Mail\\Rfc822AddressesParser',
't3lib_mail_SwiftMailerAdapter' => 'TYPO3\\CMS\\Core\\Mail\\SwiftMailerAdapter',
't3lib_message_AbstractMessage' => 'TYPO3\\CMS\\Core\\Messaging\\AbstractMessage',
't3lib_message_AbstractStandaloneMessage' => 'TYPO3\\CMS\\Core\\Messaging\\AbstractStandaloneMessage',
't3lib_message_ErrorpageMessage' => 'TYPO3\\CMS\\Core\\Messaging\\ErrorpageMessage',
't3lib_FlashMessage' => 'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
't3lib_FlashMessageQueue' => 'TYPO3\\CMS\\Core\\Messaging\\FlashMessageQueue',
't3lib_PageRenderer' => 'TYPO3\\CMS\\Core\\Page\\PageRenderer',
't3lib_Registry' => 'TYPO3\\CMS\\Core\\Registry',
't3lib_Compressor' => 'TYPO3\\CMS\\Core\\Resource\\ResourceCompressor',
't3lib_svbase' => 'TYPO3\\CMS\\Core\\Service\\AbstractService',
't3lib_Singleton' => 'TYPO3\\CMS\\Core\\SingletonInterface',
't3lib_TimeTrackNull' => 'TYPO3\\CMS\\Core\\TimeTracker\\NullTimeTracker',
't3lib_timeTrack' => 'TYPO3\\CMS\\Core\\TimeTracker\\TimeTracker',
't3lib_tree_Tca_AbstractTcaTreeDataProvider' => 'TYPO3\\CMS\\Core\\Tree\\TableConfiguration\\AbstractTableConfigurationTreeDataProvider',
't3lib_tree_Tca_DatabaseTreeDataProvider' => 'TYPO3\\CMS\\Core\\Tree\\TableConfiguration\\DatabaseTreeDataProvider',
't3lib_tree_Tca_DatabaseNode' => 'TYPO3\\CMS\\Core\\Tree\\TableConfiguration\\DatabaseTreeNode',
't3lib_tree_Tca_ExtJsArrayRenderer' => 'TYPO3\\CMS\\Core\\Tree\\TableConfiguration\\ExtJsArrayTreeRenderer',
't3lib_tree_Tca_TcaTree' => 'TYPO3\\CMS\\Core\\Tree\\TableConfiguration\\TableConfigurationTree',
't3lib_tree_Tca_DataProviderFactory' => 'TYPO3\\CMS\\Core\\Tree\\TableConfiguration\\TreeDataProviderFactory',
't3lib_tsStyleConfig' => 'TYPO3\\CMS\\Core\\TypoScript\\ConfigurationForm',
't3lib_tsparser_ext' => 'TYPO3\\CMS\\Core\\TypoScript\\ExtendedTemplateService',
't3lib_TSparser' => 'TYPO3\\CMS\\Core\\TypoScript\\Parser\\TypoScriptParser',
't3lib_TStemplate' => 'TYPO3\\CMS\\Core\\TypoScript\\TemplateService',
't3lib_utility_Array' => 'TYPO3\\CMS\\Core\\Utility\\ArrayUtility',
't3lib_utility_Client' => 'TYPO3\\CMS\\Core\\Utility\\ClientUtility',
't3lib_exec' => 'TYPO3\\CMS\\Core\\Utility\\CommandUtility',
't3lib_utility_Command' => 'TYPO3\\CMS\\Core\\Utility\\CommandUtility',
't3lib_utility_Debug' => 'TYPO3\\CMS\\Core\\Utility\\DebugUtility',
't3lib_diff' => 'TYPO3\\CMS\\Core\\Utility\\DiffUtility',
't3lib_basicFileFunctions' => 'TYPO3\\CMS\\Core\\Utility\\File\\BasicFileUtility',
't3lib_extFileFunctions' => 'TYPO3\\CMS\\Core\\Utility\\File\\ExtendedFileUtility',
't3lib_extFileFunctions_processDataHook' => 'TYPO3\\CMS\\Core\\Utility\\File\\ExtendedFileUtilityProcessDataHookInterface',
't3lib_div' => 'TYPO3\\CMS\\Core\\Utility\\GeneralUtility',
't3lib_utility_Http' => 'TYPO3\\CMS\\Core\\Utility\\HttpUtility',
't3lib_utility_Mail' => 'TYPO3\\CMS\\Core\\Utility\\MailUtility',
't3lib_utility_Math' => 'TYPO3\\CMS\\Core\\Utility\\MathUtility',
't3lib_utility_Monitor' => 'TYPO3\\CMS\\Core\\Utility\\MonitorUtility',
't3lib_utility_Path' => 'TYPO3\\CMS\\Core\\Utility\\PathUtility',
't3lib_utility_PhpOptions' => 'TYPO3\\CMS\\Core\\Utility\\PhpOptionsUtility',
't3lib_utility_VersionNumber' => 'TYPO3\\CMS\\Core\\Utility\\VersionNumberUtility',
);
?>
\ No newline at end of file
......@@ -209,7 +209,7 @@ class ClassLoaderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
$GLOBALS['typo3CacheManager'] = $this->getMock('TYPO3\\CMS\\Core\\Cache\\CacheManager', array('getCache'));
$GLOBALS['typo3CacheManager']->expects($this->any())->method('getCache')->will($this->returnValue($mockCache));
$mockCache->expects($this->any())->method('has')->will($this->returnValue(TRUE));
$mockCache->expects($this->once())->method('requireOnce')->will($this->returnValue(array(strtolower($class) => $file)));
$mockCache->expects($this->once())->method('requireOnce')->will($this->returnValue(array(array(strtolower($class) => $file))));
// Re-initialize autoloader registry to force it to recognize the new extension
\TYPO3\CMS\Core\Core\ClassLoader::unregisterAutoloader();
\TYPO3\CMS\Core\Core\ClassLoader::registerAutoloader();
......@@ -416,14 +416,15 @@ class ClassLoaderTest extends \TYPO3\CMS\Core\Tests\UnitTestCase {
$autoloaderFile = $extPath . 'ext_autoload.php';
// A case sensitive key (FooBar) in ext_autoload file
$namespacedClass = '\\Tx\\' . $extKey . '\\' . $pathSegment . '\\' . $fileName;
file_put_contents($autoloaderFile, '<?php' . LF . 'return array(\'' . $namespacedClass . '\' => \'EXT:someExt/Classes/Foo/bar.php\');' . LF . '?>');
$classFile = 'EXT:someExt/Classes/Foo/bar.php';
file_put_contents($autoloaderFile, '<?php' . LF . 'return ' . var_export(array($namespacedClass => $classFile), TRUE) . ';' . LF . '?>');
// Inject a dummy for the core_phpcode cache to force the autoloader