Feature #31893
Allow XCLASSes to be defined via ext_autoload.php
Status: | Resolved | Start date: | 2012-04-16 | |
---|---|---|---|---|
Priority: | Should have | Due date: | ||
Assigned To: | Benjamin Mack | % Done: | 100% |
|
Category: | - | Spent time: | - | |
Target version: | - | |||
PHP Version: | 5.3 | Sprint Focus: | ||
Complexity: |
Description
For XCLASSes to work currently, one needs to
a) set the according XCLASS statement in every PHP file that can/should be subclassed
b) use this XCLASS statement in an extensions' ext_localconf.php to include the subclass statement
This process is somehow unflexible, produces code, and as it is somehow incomplete for some classes, a hassle to maintain.
The attached change does the following:
1) It makes use of the autoloader to search for classes of the XCLASS prefix "ux_*" as well.
2) It provides a way to also include the XCLASS paths via the "old way", but sends a deprecation warning for that.
There is one drawback however right now: There is no how an admin can see which XCLASSes are currently in use with "the new way" as the admin cannot browse the ext_autoload.php files of all extensions through the backend in a nice way.
Also: Beware that you might need to clear your autoload cache when trying out this feature, which you can do with a simple "rm -rf Cache/Code/cache_phpcode/*"
There is a small extension that I've built that you can use to try out. This extension should work without the patch on a plain introduction package as it just includes the XCLASS statement in ext_localconf.php. The extension XCLASSes tslib_fe and replaces the title "Introduction Package" before outputting the content. Now, you should remove the XCLASS statement in typo3/sysext/cms/tslib/class.tslib_fe.php at the very last lines. Now, the XCLASS (of course) does not work anymore. However, the extension itself has a ext_autoload.php, so after applying the patchset the XCLASS will work again, as the autoloader loads the XCLASS now. Maybe you need to clear your autoloader-cache for that though (see above).
Everything works as before now, even the limitation that only one XCLASS can be used of course still applies. The XCLASS to use is of course the one of the last extension installed, same principle as before, just not in the ext_localconf.php anymore, but in ext_autoload.php.
The advantages of "the new XCLASS way":
- "faster?" - Less initialization in ext_localconf.php, only when it is needed
- "more flexible" - XCLASS every class in use now
- "more transparent" - no XCLASS statement on the bottom of each core class anymore
I'm also interested how this affects the overall performance.
Further jobs once this is included in the TYPO3 Core:
- Update documentation properly, add it to the release notes of TYPO3 4.7
- Remove XCLASS statements from all core files
- Create a Status Report about it that an installation still uses wrong XCLASS syntax
- Talk about it, Blog about it
Subtasks
Related issues
Associated revisions
[FEATURE] Allow XCLASSes to be defined via ext_autoload.php
For XCLASSes to work currently, one needs to
a) set the according XCLASS statement in every PHP file that
can/should be subclassed
b) use this XCLASS statement in an extensions' ext_localconf.php
to include the subclass statement
This process is somehow unflexible, requires more code, and since
it is missing for some classes, it's also a hassle to maintain.
The attached change does the following:
1) Use the autoloader to search for classes prefixed by "ux_*"
2) Provide a backwards compatibility layer
TODO: Provide a possibility for BE admins to see which XCLASSes
are currently in use with this new method.
Change-Id: I4af4116108fecd9df0874c3e07e10b86f74d556e
Resolves: #31893
Releases: 6.0
Reviewed-on: http://review.typo3.org/6717
Reviewed-by: Tolleiv Nietsch
Tested-by: Tolleiv Nietsch
Reviewed-by: Jigal van Hemert
Tested-by: Jigal van Hemert
[TASK] Add unit tests to new autoloader XCLASS handling
Add missing tests to the autoloader test case to test the new XCLASS
handling of issue #31893. The patch also fixes a minor error when writing
registered XCLASS files to the autoloader cache file. This error is
covered by the third added test.
Change-Id: I394c05a48ee2a2796299e72b17840689432212a2
Resolves: #36690
Related: #31893
Releases: 6.0
Reviewed-on: http://review.typo3.org/10843
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
[TASK] Clean up XCLASS handling and comments
Clean up some of the comments of the new XCLASS handling, separate
the deprecation handling to an own method and add a NEWS.txt entry.
Change-Id: I16a828e15c8e3d347b8b331ffb554ac42aa82644
Resolves: #36698
Related: #31893
Releases: 6.0
Reviewed-on: http://review.typo3.org/10865
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
[FEATURE] Allow XCLASSes to be defined via ext_autoload.php
For XCLASSes to work currently, one needs to
a) set the according XCLASS statement in every PHP file that
can/should be subclassed
b) use this XCLASS statement in an extensions' ext_localconf.php
to include the subclass statement
This process is somehow unflexible, requires more code, and since
it is missing for some classes, it's also a hassle to maintain.
The attached change does the following:
1) Use the autoloader to search for classes prefixed by "ux_*"
2) Provide a backwards compatibility layer
TODO: Provide a possibility for BE admins to see which XCLASSes
are currently in use with this new method.
Change-Id: I4af4116108fecd9df0874c3e07e10b86f74d556e
Resolves: #31893
Releases: 6.0
Reviewed-on: http://review.typo3.org/6717
Reviewed-by: Tolleiv Nietsch
Tested-by: Tolleiv Nietsch
Reviewed-by: Jigal van Hemert
Tested-by: Jigal van Hemert
[TASK] Add unit tests to new autoloader XCLASS handling
Add missing tests to the autoloader test case to test the new XCLASS
handling of issue #31893. The patch also fixes a minor error when writing
registered XCLASS files to the autoloader cache file. This error is
covered by the third added test.
Change-Id: I394c05a48ee2a2796299e72b17840689432212a2
Resolves: #36690
Related: #31893
Releases: 6.0
Reviewed-on: http://review.typo3.org/10843
Reviewed-by: Susanne Moog
Tested-by: Susanne Moog
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
[TASK] Clean up XCLASS handling and comments
Clean up some of the comments of the new XCLASS handling, separate
the deprecation handling to an own method and add a NEWS.txt entry.
Change-Id: I16a828e15c8e3d347b8b331ffb554ac42aa82644
Resolves: #36698
Related: #31893
Releases: 6.0
Reviewed-on: http://review.typo3.org/10865
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
[TASK] Remove XCLASS definitions from typo3/
Remove all XCLASS definitions in typo3/ and all system extension
that are not handled as git submodules.
Change-Id: Ib9e1d8db31f91f5f1453deb694f2441ef41130f2
Resolves: #36821
Related: #31893
Releases: 6.0
Reviewed-on: http://review.typo3.org/10981
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
[TASK] Remove XCLASS definitions in ext:workspace
All XCLASS definitions can be removed in TYPO3 6.0
Change-Id: I2c168307f2d23dfad8151db7c68e9140993b691d
Resolves: #38271
Related: #31893
Releases: 6.0
Reviewed-on: http://review.typo3.org/12277
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
[TASK] Remove last XCLASS statements
Remove last XCLASS statements that were left out during first cleanup.
Change-Id: I475725926f9ab0bb4e0c484811eb5d59971177b6
Resolves: #38273
Related: #31893
Releases: 6.0
Reviewed-on: http://review.typo3.org/12279
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
[TASK] Remove XCLASS definitions from typo3/
Remove all XCLASS definitions in typo3/ and all system extension
that are not handled as git submodules.
Change-Id: Ib9e1d8db31f91f5f1453deb694f2441ef41130f2
Resolves: #36821
Related: #31893
Releases: 6.0
Reviewed-on: http://review.typo3.org/10981
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
[TASK] Remove last XCLASS statements
Remove last XCLASS statements that were left out during first cleanup.
Change-Id: I475725926f9ab0bb4e0c484811eb5d59971177b6
Resolves: #38273
Related: #31893
Releases: 6.0
Reviewed-on: http://review.typo3.org/12279
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
History
#1 Updated by Mr. Hudson over 3 years ago
Patch set 1 of change I4af4116108fecd9df0874c3e07e10b86f74d556e has been pushed to the review server.
It is available at http://review.typo3.org/6717
#2 Updated by Steffen Ritter over 3 years ago
- Target version set to 4.7.0-alpha2
#3 Updated by Gerrit Code Review over 3 years ago
Patch set 2 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/6717
#4 Updated by Oliver Hader over 3 years ago
- Target version changed from 4.7.0-alpha2 to 4.7.0-alpha3
#5 Updated by Steffen Ritter over 3 years ago
- Target version changed from 4.7.0-alpha3 to 4.7.0-beta1
#6 Updated by Steffen Ritter over 3 years ago
- Target version deleted (
4.7.0-beta1)
#7 Updated by Gerrit Code Review over 3 years ago
Patch set 3 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/6717
#8 Updated by Gerrit Code Review over 3 years ago
Patch set 4 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/6717
#9 Updated by Gerrit Code Review over 3 years ago
Patch set 5 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/6717
#10 Updated by Michael Stucki over 3 years ago
Regarding backwards compatibility:
Let's add an update wizard to scan all ext_localconf.php files in loaded extensions.
Additionally, extdeveval might be used to convert these inclusions automatically.
#11 Updated by Gerrit Code Review over 3 years ago
Patch set 6 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/6717
#12 Updated by Gerrit Code Review over 3 years ago
Patch set 7 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/6717
#13 Updated by Benjamin Mack over 3 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 59328ee9aee6141a68259cc3196f06731b678277.