Geeklog-Core / geeklog

Geeklog - The Secure CMS.
https://www.geeklog.net
24 stars 19 forks source link

Install will add cached files in Install directory instead of where it should be as specified in the config #980

Closed eSilverStrike closed 4 years ago

eSilverStrike commented 4 years ago

Error is apparent if you enable root debug and turn on developer_mode (and set $_CONF['developer_mode_php']['error_reporting'] = -1) in siteconfig before running Geeklog install.

If you do a new install/upgrade/migrate and it loads the Geeklog lib-common.php in a number of spots for plugin install, etc..

The problem is the TEMPLATE_OPTIONS array doesn't get loaded for some reason in lib-common (like the rest of $_CONF it looks like) which results in the following error:

E_NOTICE(8) - Undefined index: path_prefixes @ E:\inetpub\TestGeeklog\system\classes\template.class.php line 1823
Call Stack
#   Function    File    Line
1   check_cache     E:\inetpub\TestGeeklog\system\classes\template.class.php    570
2   set_file    E:\inetpub\TestGeeklog\system\classes\article.class.php     1274
3   renderImageTags     E:\inetpub\TestGeeklog\system\classes\article.class.php     1838
4   DisplayElements     E:\inetpub\TestGeeklog\system\lib-syndication.php   398
5   SYND_getFeedContentAll  E:\inetpub\TestGeeklog\system\lib-syndication.php   480
6   SYND_updateFeed     E:\inetpub\TestGeeklog\public_html\lib-common.php   2034
7   COM_rdfUpToDateCheck    E:\inetpub\TestGeeklog\public_html\lib-common.php   622
8   require     E:\inetpub\TestGeeklog\public_html\admin\install\classes\installer.class.php    4778
9   installEngine   E:\inetpub\TestGeeklog\public_html\admin\install\classes\installer.class.php    4987
10  run     E:\inetpub\TestGeeklog\public_html\admin\install\index.php  44

This error above is happening on a new Geeklog install when lib-common is required just before the plugins install.

eSilverStrike commented 4 years ago

Note the error location can changed based on a number of things:

eSilverStrike commented 4 years ago

@mystralkk Okay I fixed all the e_notice errors that could cause a cascade of small errors when the Geeklog Install loads lib-common. These are variable scope issues but I couldn't figure out the fix within the install itself so I ended up setting the following in lib-common:

// *********************************************************
// IMPORTANT: Have to redeclare the variables below as Global here for Geeklog Install/Upgrade/Migrate.
// For some reason the scope is not correct for these variables when lib-common is included in the Geeklog Install
// For more info see https://github.com/Geeklog-Core/geeklog/issues/980
// Once install is fixed this can be removed...
global $_RIGHTS; // For Geeklog install when lib-common included  SEC_getUserPermissions fails as $_RIGHTS doesn't get loaded
global $_USER; // For Geeklog install when lib-common included when current user may already be logged an error happens because of $_USER not retrieved when SESS_sessionCheck is called
global $TEMPLATE_OPTIONS; // For Geeklog install when lib-common included - COM_rdfUpToDateCheck is called when the template class is used an error happens because of $TEMPLATE_OPTIONS being empty.
// *********************************************************

This fixed all the issues i found. I ran the install many times doing installs, upgrades (from as far back as Geeklog v2.0.0 with actual live data in the database) and migrates. While this fix doesn't actually fix the scope issue we are having in the Geeklog install (like with XMLSMAP_update and its config as well) it does let it run through without issues.

@mystralkk What do you think? Is it good enough for now until the installer gets a major overhaul (like for feature #957) which we can then remove these temp fixes?

mystralkk commented 4 years ago

It seems good to me.

2019年11月7日(木) 3:33 Tom notifications@github.com:

@mystralkk https://github.com/mystralkk Okay I fixed all the e_notice errors that could cause a cascade of small errors when the Geeklog Install loads lib-common. These are variable scope issues but I couldn't figure out the fix within the install itself so I ended up setting the following in lib-common:

// // IMPORTANT: Have to redeclare the variables below as Global here for Geeklog Install/Upgrade/Migrate. // For some reason the scope is not correct for these variables when lib-common is included in the Geeklog Install // For more info see https://github.com/Geeklog-Core/geeklog/issues/980 // Once install is fixed this can be removed... global $_RIGHTS; // For Geeklog install when lib-common included SEC_getUserPermissions fails as $_RIGHTS doesn't get loaded global $_USER; // For Geeklog install when lib-common included when current user may already be logged an error happens because of $_USER not retrieved when SESS_sessionCheck is called global $TEMPLATE_OPTIONS; // For Geeklog install when lib-common included - COM_rdfUpToDateCheck is called when the template class is used an error happens because of $TEMPLATE_OPTIONS being empty. //

This fixed all the issues i found. I ran the install many times doing installs, upgrades (from as far back as Geeklog v2.0.0 with actual live data in the database) and migrates. While this fix doesn't actually fix the scope issue we are having in the Geeklog install (like with XMLSMAP_update and its config as well) it does let it run through without issues.

@mystralkk https://github.com/mystralkk What do you think? Is it good enough for now until the installer gets a major overhaul (like for feature

957 https://github.com/Geeklog-Core/geeklog/issues/957) which we can

then remove these temp fixes?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Geeklog-Core/geeklog/issues/980?email_source=notifications&email_token=AAPMBEMVQQ3CYSOVMPJ5W4DQSMEYXA5CNFSM4JJEW3V2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEDHRKLY#issuecomment-550442287, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPMBEMM3MNZ5YGZPYN4R7TQSMEYXANCNFSM4JJEW3VQ .

-- mystral-kk http://mystral-kk.net/ mystralkk@gmail.com

eSilverStrike commented 4 years ago

For your info, I also updated the code to use the Geeklog install constant GL_INSTALL_ACTIVE so these global variables are only set if the install is active and it is the one requiring lib-common. See #982 for more info.