Project

General

Profile

Actions

Bug #14622

closed

Bad file paths when using cron

Added by Michael Cannon over 19 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Category:
-
Target version:
-
Start date:
2005-03-20
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
4.0
PHP Version:
4
Tags:
Complexity:
Is Regression:
Sprint Focus:

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);
-----

News even cron script
Actions

Also available in: Atom PDF