e107inc / e107

e107 Bootstrap CMS (Content Management System) v2 with PHP, MySQL, HTML5, jQuery and Twitter Bootstrap. Issue Discussion Room: https://gitter.im/e107inc/e107
https://e107.org
GNU General Public License v3.0
321 stars 213 forks source link

[Question]: new config way is possible only for not changed folders name? #5323

Open Jimmi08 opened 1 month ago

Jimmi08 commented 1 month ago

Question

Is it intentional or a bug?

in class2.php

$config = include(e_ROOT.'e107_config.php');
    'plugins'    => 'eplugins/',
    'handlers'   => 'ehandlers/',

if(empty($HANDLERS_DIRECTORY))
{
    $HANDLERS_DIRECTORY = 'e107_handlers/';
}

if(empty($PLUGINS_DIRECTORY))
{
    $PLUGINS_DIRECTORY = 'e107_plugins/';
}

only then are set e107 constants correctly

With the new way of config, $HANDLERS_DIRECTORY is not set and if you use a different folder, this fails.

Thanks

Expected Source

source code

Additional Context

No response

Jimmi08 commented 1 month ago

I would recommend testing core (not for using in code by default, just test) with install.php

$ret = array( 'ADMIN_DIRECTORY' => 'customadmin/', 'IMAGES_DIRECTORY' => 'customimages/', 'THEMES_DIRECTORY' => 'customthemes/', 'PLUGINS_DIRECTORY' => 'customplugins/', 'FILES_DIRECTORY' => 'customfiles/', // DEPRECATED!!! 'HANDLERS_DIRECTORY' => 'customhandlers/', 'LANGUAGES_DIRECTORY' => 'customlanguages/', 'DOCS_DIRECTORY' => 'customdocs/', 'MEDIA_DIRECTORY' => 'custommedia/', 'SYSTEM_DIRECTORY' => 'customsystem/', 'CORE_DIRECTORY' => 'customcore/', 'WEB_DIRECTORY' => 'customweb/', );

$e107_paths = $e107->defaultDirs($ret);

Then you will find that there is an issue with the site hash, I fixed it by setting:

$e107->site_path = (isset($tmp['paths']) && isset($tmp['paths']['hash'])) ? $tmp['paths']['hash'] : "[hash]"; // placeholder 
- $override was not working 
$e107_paths = $e107->defaultDirs($ret);  

and that you have mistypo in

        $this->e107->e107_dirs['SYSTEM_DIRECTORY'] = str_replace("[hash]",$this->e107->site_path,$this->e107->e107_dirs['SYSTEM_DIRECTORY']);   
        $this->e107->e107_dirs['CACHE_DIRECTORY']  = str_replace("[hash]",$this->e107->site_path,$this->e107->e107_dirs['CACHE_DIRECTORY']);
        $this->e107->e107_dirs['SYSTEM_DIRECTORY'] = str_replace("/".$this->e107->site_path,"",$this->e107->e107_dirs['SYSTEM_DIRECTORY']);
        $this->e107->e107_dirs['MEDIA_DIRECTORY']  = str_replace("/".$this->e107->site_path,"",$this->e107->e107_dirs['MEDIA_DIRECTORY']);

CACHE_DIRECTORY is not used in the config file, it should be MEDIA_DIRECTORY

The point is not to use custom folders, the point is that there are hidden issues that can backfire anytime.
Thanks