Project

General

Profile

Actions

Bug #54014

closed

cli_dispatch.phpsh scheduler won't run because of BackendUserAuthentication?

Added by David Gurk over 10 years ago. Updated over 9 years ago.

Status:
Closed
Priority:
Must have
Assignee:
-
Category:
Backend User Interface
Target version:
-
Start date:
2013-11-27
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
6.1
PHP Version:
5.3
Tags:
Complexity:
Is Regression:
No
Sprint Focus:

Description

System:
- TYPO3 v6.1.6
- PHP Version 5.3.10

First of all, I'm not a coding master. But I try too understand what happens in the TYPO3 Core. ;-)

To test the scheduler functionality, I added a Scheduler-Example-TestTask with recurring ("*/1 * * * *"). If I run this manually, the test email arrived. Now I wait a few minutes an refresh the scheduler page. The TestTask is now displayed as delayed (as expected with none existing cronjob).

Now if I run "typo3\cli_dispatch.phpsh scheduler" manually in the SSH console, nothing happen. Normally this work (in older TYPO3-Versions like 4.7). I have tried to trace down the problem. I have added "// => the skript stops here" in the code below.

In "typo3_src-6.1.6/typo3/cli_dispatch.phpsh":

\TYPO3\CMS\Core\Core\Bootstrap::getInstance()
    ->loadExtensionTables(TRUE)
    ->initializeBackendUser()
    ->initializeBackendUserMounts() // => the skript stops here
    ->initializeLanguageObject();

So the next step is "typo3_src-6.1.6/typo3/sysext/core/Classes/Core/Bootstrap.php":

/**
 * Initialize backend user mount points
 *
 * @return \TYPO3\CMS\Core\Core\Bootstrap
 * @internal This is not a public API method, do not use in own extensions  */ 
 public function initializeBackendUserMounts() {
    // Includes deleted mount pages as well! @TODO: Figure out why ...
    $GLOBALS['WEBMOUNTS'] = $GLOBALS['BE_USER']->returnWebmounts();
    $GLOBALS['BE_USER']->getFileStorages();  // => the skript stops here
    $GLOBALS['FILEMOUNTS'] = $GLOBALS['BE_USER']->groupData['filemounts'];
    return $this;
}

And the next step is "typo3_src-6.1.6/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php":

/**
 * Returns an array with the filemounts for the user.
 * Each filemount is represented with an array of a "name", "path" and "type".
 * If no filemounts an empty array is returned.
 *
 * @api
 * @return \TYPO3\CMS\Core\Resource\ResourceStorage[]
 */
public function getFileStorages() {
    // Initializing file mounts after the groups are fetched
    if ($this->fileStorages === NULL) {
        $this->initializeFileStorages(); // => the skript stops here
    }
    return $this->fileStorages;
}

And the next step is again "typo3_src-6.1.6/typo3/sysext/core/Classes/Authentication/BackendUserAuthentication.php":

/**
 * Sets up all file storages for a user.
 * Needs to be called AFTER the groups have been loaded.
 *
 * @return void
 */
protected function initializeFileStorages() {
    $this->fileStorages = array();
    /** @var $storageRepository \TYPO3\CMS\Core\Resource\StorageRepository */
    var_dump('TEST'); // => this is shown in the console
    $storageRepository = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Resource\\StorageRepository'); // => the skript stops here
    // Admin users have all file storages visible, without any filters
    if ($this->isAdmin()) {
        $storageObjects = $storageRepository->findAll();
        foreach ($storageObjects as $storageObject) {
            $this->fileStorages[$storageObject->getUid()] = $storageObject;
        }
    } else {
        // Regular users only have storages that are defined in their filemounts
        // Permissions and file mounts for the storage are added in StoragePermissionAspect
        foreach ($this->getFileMountRecords() as $row) {
            if (!array_key_exists(intval($row['base']), $this->fileStorages)) {
                $storageObject = $storageRepository->findByUid($row['base']);
                $this->fileStorages[$storageObject->getUid()] = $storageObject;
            }
        }
    }

    // This has to be called always in order to set certain filters
    $this->evaluateUserSpecificFileFilterSettings();
}

In my opinion, "\TYPO3\CMS\Core\Utility\GeneralUtility" isn't available at this time, when the cli-script is call the functionallity.

If I comment out the line "$this->initializeFileStorages()" in "BackendUserAuthentication->getFileStorages()" the scheduler works as it should and I recieve the Testmail from the TestTask.

So I consult you all. What is to do? How can I help?

Actions

Also available in: Atom PDF