Bug #14622
closedBad file paths when using cron
0%
Description
When accessing Typo3 via a cron script to perform operations from the behind the scenes, issues arise in handling of absolute paths principally in loading templates and language file.
Despite creating a cron script that builds up a tslib_fe object whose tstemplate ojbect having the getFileName_backPath member set; the tstemplate::fileContent() method doesn't return an absolute file path. This in turns means that tslib_content methods calling tstemplate::fileContent() don't get a working file path, they get the relative filepath that works normally when accessing Typo3 via the web.
To resolve these issues, I recommend the following changes.
In t3lib/class.t3lib_tstemplate.php prefix the filepath. I would prefer seeing getFileName prepend PATH_site. However, getFileName has the "security" path checking that's incompatible with PATH_site. Possibly including PATH_site in the allowPaths might alleviate this issue.
-----
function fileContent($fName) {
// MLC ensure absolute path
$incFile = PATH_site . $this->getFileName($fName);
-----
In tslib/class.tslib_pibase.php the base path needs correction along with the include statement.
-----
function pi_loadLL() {
if (!$this->LOCAL_LANG_loaded && $this->scriptRelPath) {
// MLC make path absolute
$basePath = PATH_site . t3lib_extMgm::siteRelPath($this->extKey).dirname($this->scriptRelPath).'/locallang.php';
if (@is_file($basePath)) {
// MLC path is absolute no need for ./
include($basePath);
-----
Updated by Benni Mack over 16 years ago
hey, isn't this one fixed with kasper's new CLI_MODE stuff (since 4.1) ?
Updated by Michael Cannon over 16 years ago
Ben, I'm not sure, but probably given this is from 2005.
Updated by Christian Kuhn over 15 years ago
Resolved, no change required:
- Very old issue and the whole cli script solution changed a lot meanwhile
- No feedback for half a year
Please open a new issue if there are still path problems with cli scripts in current versions.