Feature #21144

Remove ext_autoload.php files for extensions using Extbase naming convention

Added by Xavier Perseguers almost 6 years ago. Updated about 2 years ago.

Status:Closed Start date:2009-09-25
Priority:Should have Due date:
Assigned To:Xavier Perseguers % Done:

100%

Category:- Spent time: -
Target version:-
PHP Version:5.2 Sprint Focus:
Complexity:

Description

The use of ext_autoload.php files was once supposed to be used only for old-fashioned extensions that did not used Extbase naming convention (Classes directory, class component parts as subdirectories).

Nowadays, all new extensions (starting with Extbase itself) are polluted with a never-ending growing ext_autoload.php file and we slowly start adding all our classes there to be sure all will work fine without exactly knowing what really needs to be in.

The patch allows not less than the removal of the ext_autoload.php file for all extensions sticking to using only the Extbase naming convention. This file may still be used for some third-party classes that may be included in a pure Extbase-styled extension.

Note: This has nothing to do with extensions relying on Extbase itself, only on its naming convention.

(issue imported from #M12067)

12067.diff Magnifier (1.4 kB) Administrator Admin, 2009-09-25 22:05


Related issues

related to Core - Feature #25337: Add PHP 5.3 namespace support Resolved 2011-03-16

Associated revisions

Revision 9b9ce42e
Added by Xavier Perseguers about 4 years ago

[FEATURE] Implement extbase naming scheme in core autoloader

The patch enables the core autoloader to find class files that are named
according to the exbase class and file location naming scheme.
This renders ext_autoload.php entries obsolete for class locations
that stick to the extbase scheme even if extbase is not used
for an extension. The autoloaders within fluid and extbase are not
needed anymore.
Additionally, the class-to-file information is cached in the core
autoloader cache in order to reduce the number of file system lookups
for consecutive calls.
The patch is covered by unit tests to verify the complex logic.

Change-Id: I1af68a2d95cfc590eecffe6d06ea4e4eb58e11ec
Resolves: #21144
Related: #28249
Related: #28250
Reviewed-on: http://review.typo3.org/2985
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel

Revision 0c86446c
Added by Christian Kuhn about 4 years ago

[-TASK] Remove autoloader

With core issue #21144 the extbase autoloader was moved to the core.
This patch removes the according code from extbase since class file locations
based on the extbase class naming scheme is now handled and cached by the core.

Thanks to Christian Kuhn.

Change-Id: I73b5fc592882f142726fbb4962845e57aa7c1dfe
Resolves: #28249
Depends: #21144

Revision ac347d43
Added by Christian Kuhn almost 4 years ago

[TASK] Remove fluid autoloader

With core issue #21144 the extbase autoloader was moved to the core.
This patch removes the according code from fluid since class file locations
based on the extbase naming scheme is now handled and cached by the core.

Change-Id: Ib81cd2d4ec63b84aea0de5186e53e22e12f2be64
Resolves: #28250
Depends: #21144

History

#1 Updated by Steffen Kamper over 4 years ago

Good one! This also helps to use correct naming for classes and a well defined file structure.
Kickstarter has to be aware of this, i would like if kickstarter could produce compatible base.

#2 Updated by Kay Strobach over 4 years ago

fully agree - started question about this in the dev mailinglist

#3 Updated by Xavier Perseguers over 4 years ago

As this is new feature, this should go to 4.6. We could even go one step further a make it compatible with PHP 5.3 namespaces.

#4 Updated by Kay Strobach over 4 years ago

but it should be compatible to extbase!

#5 Updated by Kay Strobach over 4 years ago

perhaps the autoloader can be backported as extension similar to extbase ;)

#6 Updated by Sebastian Fischer over 4 years ago

There is one incorrect thing:

$extensionKey = strtolower(array_shift($classNameParts));

As extenionkeys could contain an underscore the conversion needs to replace uppercase to _lowercase. beside that all looks fine.

#7 Updated by Xavier Perseguers about 4 years ago

  • Tracker changed from Bug to Feature
  • Target version changed from 4.6.0-beta1 to 1281
  • TYPO3 Version changed from 4.3 to 4.6

#8 Updated by Mr. Hudson about 4 years ago

Patch set 1 of change I1af68a2d95cfc590eecffe6d06ea4e4eb58e11ec has been pushed to the review server.
It is available at http://review.typo3.org/2985

#9 Updated by Xavier Perseguers about 4 years ago

  • Status changed from New to Under Review
  • Assigned To set to Xavier Perseguers

How to test:

  1. Take one of your extension where you stick to naming convention but still need an ext_autoload.php file.
  2. Remove one of the class
  3. TYPO3 will fail to instantiate your class
  4. Apply patch
  5. Retry

#10 Updated by Xavier Perseguers about 4 years ago

  • Target version changed from 1281 to 4.6.0-beta1

#11 Updated by Mr. Hudson about 4 years ago

Patch set 2 of change I1af68a2d95cfc590eecffe6d06ea4e4eb58e11ec has been pushed to the review server.
It is available at http://review.typo3.org/2985

#12 Updated by Mr. Hudson about 4 years ago

Patch set 3 of change I1af68a2d95cfc590eecffe6d06ea4e4eb58e11ec has been pushed to the review server.
It is available at http://review.typo3.org/2985

#13 Updated by Mr. Hudson about 4 years ago

Patch set 4 of change I1af68a2d95cfc590eecffe6d06ea4e4eb58e11ec has been pushed to the review server.
It is available at http://review.typo3.org/2985

#14 Updated by Mr. Hudson about 4 years ago

Patch set 5 of change I1af68a2d95cfc590eecffe6d06ea4e4eb58e11ec has been pushed to the review server.
It is available at http://review.typo3.org/2985

#15 Updated by Mr. Hudson about 4 years ago

Patch set 6 of change I1af68a2d95cfc590eecffe6d06ea4e4eb58e11ec has been pushed to the review server.
It is available at http://review.typo3.org/2985

#16 Updated by Xavier Perseguers about 4 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

#17 Updated by Xavier Perseguers over 3 years ago

  • Status changed from Resolved to Closed

#18 Updated by Ernesto Baschny about 2 years ago

  • Target version deleted (4.6.0-beta1)

Also available in: Atom PDF