kaystrobach / TYPO3.piwikintegration

Piwik backend integration for TYPO3
http://forge.typo3.org/projects/extension-piwikintegration/
GNU General Public License v2.0
6 stars 10 forks source link

Unnecessary LocalConfiguration.php inclusion? #47

Closed AnatoliZich closed 7 years ago

AnatoliZich commented 9 years ago

Hey,

while rebuilding my TYPO3 instance because of deployment reasons i stumbled upon an exception which is thrown by the Auth.php file in the TYPO3Login Piwik Plugin. I traced it back to this snipped:

    /**
 *  Fix some problems with external DB usage  
 */ 
/**
 * for version 3.0.9
 */

    if(!defined('TYPO3_MODE')) {
        define('TYPO3_MODE', 'BE');
    }
    if(file_exists(PIWIK_INCLUDE_PATH.'/../../LocalConfiguration.php')) {
        $TYPO3config = include(PIWIK_INCLUDE_PATH.'/../../LocalConfiguration.php');
        // Try AdditionalConfiguration.php if database was not defined in LocalConfiguration.php
        if (empty($TYPO3config['DB']['database']) && file_exists(PIWIK_INCLUDE_PATH . '/../../AdditionalConfiguration.php')) {
            // Load AdditionalConfiguration.php via closure to avoid variable leak
            call_user_func(function() use (&$TYPO3config) {
                // Allow for e.g. array_merge calls within AdditionalConfiguration.php
                $GLOBALS['TYPO3_CONF_VARS'] = $TYPO3config;
                include PIWIK_INCLUDE_PATH.'/../../AdditionalConfiguration.php';
                $TYPO3config['DB']['database'] = $GLOBALS['TYPO3_CONF_VARS']['DB']['database'];
            });
        }
        define('TYPO3DB', $TYPO3config['DB']['database']);
    } elseif(file_exists(PIWIK_INCLUDE_PATH.'/../../localconf.php')) {
        include(PIWIK_INCLUDE_PATH.'/../../localconf.php');
        define('TYPO3DB',$typo_db);
    } else {
        throw new \Exception('Can´t include TYPO3-config file');
    }

This is caused by my piwik folder which is just linked into the typo3conf folder which works just fine except for this. Well, thats leads to the Exception in the else branch as the LocalConfiguration can't be resolved using relative paths anymore. I then tried to understand what the purpose of this snipped is and could not find any solution. It generates a TYPO3DB constant which is not used anywhere. Could this be obsolete? Deleting these lines fixes my problem without any side effects.

DavidBruchmann commented 9 years ago

Don't know if information of localconf.php is required or not. Fact is in later Versions (6.x ?) the file is not existing anymore and replaced by LocalConfiguration.php.

kaystrobach commented 9 years ago

will check lateron, we atleast needed it in earlier versions to avoid the some sync operations

astehlik commented 7 years ago

Sorry, I overlooked this one when I created #75 I have created a pull request: #76