Bug #88506
closed
Scheduler generated URLs contain absolute unix paths
Added by Nils Vindice over 5 years ago.
Updated almost 5 years ago.
Description
I use Typo3 v8 with the Aimeos shop extension, which uses \TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder for URL generation. When using the scheduler like recommended by Typo3 docs:
*/15 * * * * /usr/local/bin/php /home/user/www/typo3/sysext/core/bin/typo3 scheduler:run
all URLs generated contain the absolute unix path, eg:
https://mypage.com*/home/user/www/typo3/htdocs/*product/....
When switching to the typo3 directory and calling cli_dispatcher from there directly, eg:
* * * * * cd /home/user/www/typo3 && ./cli_dispatcher.phpsh scheduler
all URLs are created correctly. Same when calling the scheduler manually from the backend.
IMHO, all scheduler calls should return the same results.
The code for initializing the frontend to be able to generate the URLs is the same, regardless which script is used:
if( !is_object( $GLOBALS['TT'] ) )
{
$GLOBALS['TT'] = GeneralUtility::makeInstance( 'TYPO3\CMS\Core\TimeTracker\TimeTracker' );
$GLOBALS['TT']->start();
}
$page = GeneralUtility::makeInstance( 'TYPO3\CMS\Frontend\Page\PageRepository' );
$page->init( true );
$name = 'TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController';
$GLOBALS['TSFE'] = GeneralUtility::makeInstance( $name, $GLOBALS['TYPO3_CONF_VARS'], $pageid, 0 );
$GLOBALS['TSFE']->connectToDB();
$GLOBALS['TSFE']->initFEuser();
$GLOBALS['TSFE']->no_cache = true;
$GLOBALS['TSFE']->sys_page = $page;
$GLOBALS['TSFE']->rootLine = $page->getRootLine( $pageid );
$GLOBALS['TSFE']->determineId();
$GLOBALS['TSFE']->initTemplate();
$GLOBALS['TSFE']->getConfigArray();
$rootline = BackendUtility::BEgetRootLine( $pageid );
$_SERVER['HTTP_HOST'] = BackendUtility::firstDomainRecord( $rootline );
GeneralUtility::flushInternalRuntimeCaches();
IMHO, TYPO3 should offer a way to generate URLs in CLI tasks by default.
- Related to Bug #72706: Manually instantiated UriBuilder is incomplete added
- Status changed from New to Closed
Starting with TYPO3 v9, Site Handling does support creating proper links through the PageRouter API. See the linked ticket for a code snippet on how to do this. I will close this issue, as we can continue discussing this in the other issue.
Also available in: Atom
PDF