[TYPO3-dev] Extension with custom entry point
Axel Dörfler
axeld at pinc-software.de
Mon Mar 13 16:08:49 CET 2017
Hi there,
I'm trying to update an existing (internal) extension to work with 7.6.15.
I need to set up the backend in order to update the database and
create/update pages automatically via an URL within my extension.
I used to do the following:
-----------8<-----------
define('TYPO3_cliMode', TRUE);
define('PATH_thisScript', __FILE__);
define('TYPO3_MOD_PATH', '../typo3conf/ext/myext/');
$MCONF['name'] = '_CLI_myext';
$BACK_PATH = '../../../typo3/';
require(dirname(PATH_thisScript) . '/' . $BACK_PATH . 'init.php');
-----------8<-----------
This used to work fine, but no longer does (besides the fact that using
init.php is now deprecated).
I tried to follow the deprecation ticket for init.php as a first step
[1], but that does not work, most notably, it rightfully complaints that
it does not have a method called "run".
I've now changed it as follows, which at least seems to work at first:
-----------8<-----------
$classLoader = require dirname(PATH_thisScript) . '/' . $BACK_PATH .
'/../vendor/autoload.php';
require dirname(PATH_thisScript) . '/' . $BACK_PATH .
'/sysext/core/Classes/Core/Bootstrap.php';
\TYPO3\CMS\Core\Core\Bootstrap::getInstance()->setEarlyInstance("Composer\Autoload\ClassLoader",
$classLoader);
\TYPO3\CMS\Core\Core\Bootstrap::getInstance()->baseSetup('typo3conf/ext/esign_mm/');
-----------8<-----------
However, the first try to access $GLOBALS['TYPO3_DB'] fails, which hints
to the fact that the above is not correct either.
Is there any backend only way to authenticate a user, btw?
I failed to find any documentation of how to any of this properly.
Thanks for any help!
Kind regards,
Axel.
[1]
https://docs.typo3.org/typo3cms/extensions/core/Changelog/7.4/Deprecation-67471-InitPhp.html
More information about the TYPO3-dev
mailing list