Search code examples
composer-phptypo3logfile

How to activate a TYPO3 logfile entry for extension activation errors


I am using a TYPO3 12.4 composer installation and there I activate a development version of an extension which still has errors and is not yet ready for usage. But I need a log file output about the errors which happen.

composer -v req jambagecom/party:dev-master

When I do the same in a classical installation where I use the Extension Manager, then I get this error:

(1/1) Error
Call to undefined method TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath()
in /var/www/html/globale_extensions/party/ext_localconf.php line 16

    define('PATH_BE_PARTY', ExtensionManagementUtility::extPath('party'));
}

if (!defined('PATH_BE_PARTY_REL')) {
    define('PATH_BE_PARTY_REL', ExtensionManagementUtility::extRelPath('party'));
}

The Composer based TYPO3 website does not show any error. It just did not activate this buggy extension without any notice. What must I do to see these error messages produced after activation in the Extension Manager of a classic TYPO3 website also in a Composer based TYPO3 website in any logfile or somewhere else?


Solution

  • First, the error you have stated is more than enough to find the issue.

    The TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath() is deprecated in TYPO3 v8.4 [1] and removed (breaking) with TYPO3 v9 [2].

    That simply means, that the called method in the ext_localconf.php simply does not exists any more. You need to replace this.

    Secondly, ext_localconf.php is used during a TYPO3 boostrap (FE, BE, CLI) if the early safe boot cycle has been finished and all extension are used. The ExtensionManger in a legacy (non-composer) installation triggerss the extension activation/setup, and therefore booting the new extension stuff like the malformed configuration and badly fails on the nose.

    With TYPO3 v12.4 a extension required with composer should be "always" enabled. That a composer package is regonized and used as a TYPO3 extension there are basically 3 things which needs to exists:

    1. composer.json must exist and be valid
    2. composer.json needs a type entry with type typo3-cms-extension
    3. composer.json needs to have a extra configuration with the typo3-cms.extensionKey configuration.

    In non-composer mode all uploaded extension / extension sitting in typo3conf/ext/ are considerable extensions (always).

    Looking up the composer package name on packagist.org and following the trace to the GitHub repository and looking into the composer.json point 3. is missing and would bet, that this is the reason it has not been enabled as TYPO3 extension and therefore the ext_localconf.php is never touched, read and executed by TYPO3. As it is not run, it could not through any error. Simply as that.

    With TYPO3 v12.0 in composer mode, extensions are no longer symlinked to public/typo3conf/ext/<extension-key> which makes it a little bit harder to detect if it has been properly regonized or not. Someone could look up the PackageArtifact file (composer mode) if it is stated there or not (should be missing).

    As the missing class method has been removed with TYPO3 v9.0 from the core, the extension seems really outdated. I did not checked the repository further - as there could be a huge can of worms hidden and would exceed the possibility to answer here.

    I'd suggest that your should read up and get familiar how to properly process project and extension updates and what resources are use-full.

    For example, you really should take all TYPO3 Changelog into account, at least all from 8.4 up to v12 (which is a really really huge step).

    In the TYPO3 extension and project ecosystem quite some helper tools are making their round which can support to get the extension in shape before trying to install it into a running instance. The TYPO3 extension scanner kicks in if the extension is installed and active, so I guess could not help you much. You also could try the sections in the Admin Tool -> Upgrade section:

    • Check for Broken Extensions
    • Check TCA in ext_tables.php
    • Check TCA Migrations
    • Scan Extension Files

    The extension scanner also exists as a standalone tool provided by the TYPO3 community (not the core).

    I guess, you would hit a lot of stuff like for example:

    • defined('TYPO3_MODE') || die() => defined('TYPO3') || die(); in several files
    • Using TYPO3_MODE constant in condition to register stuff condition bases, which also does no longer work
    • Extbase persistance registration
    • code style
    • interfaces

    As a basic start, a pure php linting could be a good start to at least find PHP related issues (ending in FATAL errors) first. (some find and php binary command magic).

    Also rector/rector (the TYPO3 variang) is used to help with upgrades of projects and extensions.

    Taking all this and putting it on the table - trying to install that extension is a little bit early.