Closed kopq closed 10 years ago
can you try the current master? (hash 823acdecd7a36f4839a3411558eed5e601c1af88)
Thanks for your changes, but it doesn't work for me, because I'm using TYPO3 Version 6.1.9, but your fix applies only to versions >= 6.2
if (version_compare(TYPO3_branch, '6.2', '>=')) {
a temporary dirty hack taken from https://forge.typo3.org/attachments/26999/class.tx_cal_treeview.php.patch could be
--- class.tx_seobasics_sitemap_ORG.php
+++ class.tx_seobasics_sitemap.php
@@ -99,7 +99,11 @@
// create the tree from starting point
+ # temp. dirty hack similar to https://forge.typo3.org/attachments/26999/class.tx_cal_treeview.php.patch
+ $lockBeUserToDBmounts = $GLOBALS['TYPO3_CONF_VARS']['BE']['lockBeUserToDBmounts'];
+ $GLOBALS['TYPO3_CONF_VARS']['BE']['lockBeUserToDBmounts'] = 0;
$tree->getTree($id, $depth, '');
+ $GLOBALS['TYPO3_CONF_VARS']['BE']['lockBeUserToDBmounts'] = $lockBeUserToDBmounts;
$treeRecords = $tree->tree;
array_unshift($treeRecords, array('row' => $treeStartingRecord));
seems to work fine on a test-typo3 6.1.10 installation and seo_basics 0.8.6 keep in mind that this could cause security issues.
ciao paolo
Addendum: This works not as expected. I had forgotten that I was still logged in in a browser tab in the TYPO3 backend. Without login "PHP Fatal error: Call to a member function isInWebMount() on a non-object" still exists.
This should work better:
--- class.tx_seobasics_sitemap_ORG.php
+++ class.tx_seobasics_sitemap.php
@@ -99,7 +99,25 @@
// create the tree from starting point
- $tree->getTree($id, $depth, '');
+ if (version_compare(TYPO3_branch, '6.1', '>=') && empty($GLOBALS['BE_USER'])) {
+ $BE_USER = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Authentication\\BackendUserAuthentication');
+ $BE_USER->OS = TYPO3_OS;
+ $BE_USER->dontSetCookie = TRUE;
+ #$BE_USER->setBeUserByUid(1);
+ $BE_USER->setBeUserByName('_cli_lowlevel');
+ $BE_USER->fetchGroupData();
+ $BE_USER->backendSetUC();
+ unset($GLOBALS['BE_USER']);
+ $GLOBALS['BE_USER'] = $BE_USER;
+ $lockBeUserToDBmounts = $GLOBALS['TYPO3_CONF_VARS']['BE']['lockBeUserToDBmounts'];
+ $GLOBALS['TYPO3_CONF_VARS']['BE']['lockBeUserToDBmounts'] = 0;
+ $tree->getTree($id, $depth, '');
+ $GLOBALS['TYPO3_CONF_VARS']['BE']['lockBeUserToDBmounts'] = $lockBeUserToDBmounts;
+ unset($GLOBALS['BE_USER']);
+ $GLOBALS['BE_USER'] = NULL;
+ } else {
+ $tree->getTree($id, $depth, '');
+ }
$treeRecords = $tree->tree;
array_unshift($treeRecords, array('row' => $treeStartingRecord));
The '_cli_lowlevel' user must exist or it can be replaced by another. The code is not tested with TYPO3 6.2
I disagree on using _cli_lowlevel as a dummy BE User. Instead we need a Tree class for FE functionality. For the time being we extend the PageTree and remove the BE_USER calls, which I did in the last commit. Please test.
Hi,
first of all thanks for your extension which is easy to use, has well written code and works like a charm - at least most of the time, because when using the sitemap feature together with TYPO3 6.1.9 the following error occurs:
This has something to do with this commit: https://github.com/TYPO3/TYPO3.CMS/commit/c59d89f809898784aaedd507db61a4d380bc27a8 because since that commit, the function getTree calls:
and because you are calling this method in class.tx_seobasics_sitemap.php line 102:
when no backend user is available, the corresponding var is null.
Should the TYPO3 core class be extended with an additional null check, or do you want to find a new way to retrieve the page tree? Can I help you somehow?
Cheers Ben