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

Installed plugin list is cached excessively #4593

Open Jimmi08 opened 2 years ago

Jimmi08 commented 2 years ago

Moving to a separate issue because it is not related to PHP 8. It just happened to me on PHP 7.4. installation.

With not installed PM plugin (installation fixed this), latest sync:

Fatal error: Uncaught Error: Call to a member function sc_pm_nav() on null in C:\xampp8\htdocs\***\e107_plugins\signin\signin_shortcodes.php:243 Stack trace: #0 C:\xampp8\htdocs\***\e107_handlers\shortcode_handler.php(1130): plugin_signin_signin_shortcodes->sc_signin_pm_nav(Array, '') #1 [internal function]: e_parse_shortcode->doCode(Array) #2 C:\xampp8\htdocs\***\e107_handlers\shortcode_handler.php(996): preg_replace_callback('#\\{([A-Z][^\\x02...', Array, '\n\n\t\t<ul class="...') #3 C:\xampp8\htdocs\***\e107_handlers\e_parse_class.php(823): e_parse_shortcode->parseCodes('\n\n\t\t<ul class="...', true, Object(plugin_signin_signin_shortcodes), NULL) #4 C:\xampp8\htdocs\***\e107_plugins\signin\e_shortcode.php(70): e_parse->parseTemplate('\n\n\t\t<ul class="...', true, Object(plugin_signin_signin_shortcodes)) #5 C:\xampp8\htdocs\***\e107_plugins\signin\e_shortcode.php(35): signin_shortcodes->signOut(Array) #6 C:\xampp8\htdocs\***\e107_handlers\shortcode_handler.php(275): signin_shortcodes->sc_signin(Array, '') #7 C:\xampp8\htdocs\***\e107_handlers\shortcode_handler.php(1215): e_parse_shortcode->callScFuncA('signin_shortcod...', 'sc_signin', Array) #8 [internal function]: e_parse_shortcode->doCode(Array) #9 C:\xampp8\htdocs\***\e107_handlers\shortcode_handler.php(996): preg_replace_callback('#\\{([A-Z][^\\x02...', Array, '\t\t\t\t{SIGNIN}\r') #10 C:\xampp8\htdocs\***\e107_handlers\e_parse_class.php(823): e_parse_shortcode->parseCodes('\t\t\t\t{SIGNIN}\r', true, NULL, NULL) #11 C:\xampp8\htdocs\***\e107_handlers\e107_class.php(373): e_parse->parseTemplate('\t\t\t\t{SIGNIN}\r', true, Object(theme_shortcodes)) #12 C:\xampp8\htdocs\***\e107_core\templates\header_default.php(791): e107::renderLayout('<body id="page-...', Array) #13 C:\xampp8\htdocs\***\index.php(189): include_once('C:\\xampp8\\htdoc...') #14 {main} thrown in C:\xampp8\htdocs\***\e107_plugins\signin\signin_shortcodes.php on line 243

Originally posted by @Jimmi08 in https://github.com/e107inc/e107/issues/4299#issuecomment-801487560

Bug Description

The list of installed plugins is cached somewhere. If you switch to the database (for example from backup) without installed plugin PM, that cached list is used and you got a fatal error.

@Jimmi08 Okay thank you. Please let me know if it happens again.

It happened again.

PM plugin was listed in plug_installed prefs, but it wasn't listed between uninstalled plugins. 'pm' => '3.0',

When this happens...

I have the localhost copy of the site, it can be different, mostly used for testing. Before the real update, I export the database from live site (via hosting, not via e107) a then I import it to the localhost version (create a new one and change the config file). So the database is always actual. Then I run the update on localhost.
I have set $E107_CONFIG['site_path'] to have the same system and media folders names. I noticed now that plug_installed is different on localhost, that plugin pm shouldn't be installed at all (it probably was on the local version before changing the database). I cleared the cache. I run plugins scan. plug_installed stayed wrong (outdated).

Originally posted by @Jimmi08 in https://github.com/e107inc/e107/issues/4299#issuecomment-900467389

Now, I just replaced the database from the backup. In this backup PM plugin wasn't installed, in the latest version it was.

Thanks

Jimmi08 commented 2 years ago

I can see this in plugin admin area: image