Jump to content

[Solved] Upgrade to 8.1 : custom modules disappeared


Recommended Posts

Hello,

On our test site (offline) we tried an update from 1.7.8.9 to 8.1 with 1-Click upgrade (strangely the upgrade "the manual way", as described here https://devdocs.prestashop-project.org/8/basics/keeping-up-to-date/upgrade/, was impossible, it seems tu be a known problem : https://github.com/PrestaShop/PrestaShop/issues/31090 )

Everything seem to be fine but our custom modules are no more displayed. We have checked their conformity to PS 8.1 modules rules as described here https://devdocs.prestashop-project.org/8/modules/  and we don't see what could be wrong. Debug mode, log files... don't give any clue.

If someone has an idea... thanks in advance.

 

Offline test server:

Linux #44~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon May 22 13:39:36 UTC 2 x86_64

Apache/2.4.54 (Unix) OpenSSL/1.1.1q PHP/7.4.30 mod_perl/2.0.12 Perl/v5.34.1

PHP : 7.4.30

 

Link to comment
Share on other sites

Are you sure they are enabled? I noticed that  I can't see in the 8.1 backoffice modules page whether a module is enabled or not (it will always show "configure"). The only way to know it to click the button so that you see the other options - then you will see "activate" instead of "de-activate".

Otherwise I would suggest to add some echo text at the beginning of the main module file.

 

Link to comment
Share on other sites

Le 23/07/2023 à 9:12 PM, musicmaster a dit :

Are you sure they are enabled? I noticed that  I can't see in the 8.1 backoffice modules page whether a module is enabled or not (it will always show "configure"). The only way to know it to click the button so that you see the other options - then you will see "activate" instead of "de-activate".

Otherwise I would suggest to add some echo text at the beginning of the main module file.

 

Yes, the modules are activated.

I tried with a very simple module only echoing some <b>Hello World!</b> but nothing happens.

I tried a new upgrade without chosing "desactivation of non native modules": some errors occur, showing that this desactivation is needed. Something is wrong with non native modules, but even with the documentation, up to now I can't figure out where is the problem.

Link to comment
Share on other sites

  • 2 weeks later...

New attempt with the latest releases:

upgrade from PS 1.7.8.10 to 8.1.1 (PHP version 7.4)

Now I get an error:

[INTERNAL] /opt/lampp/htdocs/MYPSDIRECTORY/src/Adapter/ContainerFinder.php line 77 - PrestaShop\PrestaShop\Core\Exception\ContainerNotFoundException: Kernel Container is not available #0 /opt/lampp/htdocs/MYPSDIRECTORY/classes/module/Module.php(1671): PrestaShop\PrestaShop\Adapter\ContainerFinder->getContainer() #1 /opt/lampp/htdocs/MYPSDIRECTORY/classes/module/Module.php(1660): ModuleCore::getModuleRepository() #2 /opt/lampp/htdocs/MYPSDIRECTORY/classes/Hook.php(836): ModuleCore::getNativeModuleList() #3 /opt/lampp/htdocs/MYPSDIRECTORY/classes/Hook.php(632): HookCore::exec('actionModuleReg...', Array) #4 /opt/lampp/htdocs/MYPSDIRECTORY/classes/module/Module.php(1058): HookCore::registerHook(Object(ps_mbo), 'DisplayBackOffi...', Array) #5 /opt/lampp/htdocs/MYPSDIRECTORY/modules/ps_mbo/src/Traits/UseHooks.php(175): ModuleCore->registerHook(Array) #6 /opt/lampp/htdocs/MYPSDIRECTORY/modules/ps_mbo/upgrade/upgrade-4.1.0.php(33): ps_mbo->updateHooks() #7 /opt/lampp/htdocs/MYPSDIRECTORY/classes/module/Module.php(591): upgrade_module_4_1_0(Object(ps_mbo)) #8 /opt/lampp/htdocs/MYPSDIRECTORY/modules/autoupgrade/classes/UpgradeTools/ModuleAdapter.php(249): ModuleCore->runUpgradeModule() #9 /opt/lampp/htdocs/MYPSDIRECTORY/modules/autoupgrade/classes/UpgradeTools/ModuleAdapter.php(228): PrestaShop\Module\AutoUpgrade\UpgradeTools\ModuleAdapter->doUpgradeModule('ps_mbo') #10 /opt/lampp/htdocs/MYPSDIRECTORY/modules/autoupgrade/classes/TaskRunner/Upgrade/UpgradeModules.php(63): PrestaShop\Module\AutoUpgrade\UpgradeTools\ModuleAdapter->upgradeModule(39574, 'ps_mbo') #11 /opt/lampp/htdocs/MYPSDIRECTORY/MYPSADMIN/autoupgrade/ajax-upgradetab.php(53): PrestaShop\Module\AutoUpgrade\TaskRunner\Upgrade\UpgradeModules->run() #12 {main}

This occured while "Upgrading module ps_mbo…"

and "All files upgraded. Now upgrading database...

Database upgraded. Now upgrading your Addons modules...

5 module(s) seront mis à jour.

1 modules left to upgrade."

In fact the upgrade seems to have gone well. I go to Modules, an upgrade for ps_mbo is possible (2.3.1 to 4.5.1) : it goes OK.

Then I activate our custom modules + hook them: no custom module shown. Same result. In debug mode, no visible error. Even with a very simple module echoing "Hello World".

Any idea of what could be tried?

Link to comment
Share on other sites

Try to disable/uninstall the MBO module. MBO stands for "Marketpace in the Back Office".

In past Prestashop versions the marketplace was a part of the Prestashop installation. But with the reorganization that separated the core from the modules in two separate organizations it was taken from the core and turned into a separate module.

Unfortunately this module is rather unstable and the source of countless problems. As you can always access the Addons website you miss nothing by uninstalling MBO.

Link to comment
Share on other sites

Thank you, so I tried to uninstall ps_mbo:

1- trough Modules menu: an error appears: the module can easily be found, when I click on "Uninstall" a message appears: "Could not perform action uninstall for module undefined"

2- the bestial way, renaming ps_mbo in modules folder. The module does no more appear in modules menu. Then uninstall and reinstall test custom module, suppression of browser cache, reload: nothing has changed... 🤖

Link to comment
Share on other sites

  • 1 month later...

We performed new tests: this time, upgrade from 1.7.8.10 to 8.1.1 with 1-Click upgrade v4.16.4 (the configuration of the offline server remains identical).

1- with the option "disable non native modules". Everything OK... but reactivation of non native modules (including payment) is impossible;

2- without the option "disable non native modules". No error message. Connection to the back office is OK, but when we try to connect to the shop we get this error:
 

Fatal error: Uncaught PrestaShop\PrestaShop\Core\Exception\ContainerNotFoundException: Kernel Container is not available in /opt/lampp/htdocs/PS2023/src/Adapter/ContainerFinder.php:77 Stack trace:

#0 /opt/lampp/htdocs/PS2023/classes/module/Module.php(1671): PrestaShop\PrestaShop\Adapter\ContainerFinder->getContainer()

#1 /opt/lampp/htdocs/PS2023/classes/module/Module.php(1660): ModuleCore::getModuleRepository()

#2 /opt/lampp/htdocs/PS2023/classes/Hook.php(836): ModuleCore::getNativeModuleList()

#3 /opt/lampp/htdocs/PS2023/classes/Dispatcher.php(586): HookCore::exec('moduleRoutes', Array, NULL, true, false)

#4 /opt/lampp/htdocs/PS2023/classes/Dispatcher.php(243): DispatcherCore->loadRoutes()

#5 /opt/lampp/htdocs/PS2023/classes/Dispatcher.php(201): DispatcherCore->__construct(Object(Symfony\Component\HttpFoundation\Request))

#6 /opt/lampp/htdocs/PS2023/index.php(28): DispatcherCore::getInstance()

#7 {main} thrown in /opt/lampp/htdocs/PS2023/src/Adapter/ContainerFinder.php on line 77

According to

we try to modify non native modules with

public function __construct() 
{ 
parent::__construct(); 
// ... 
// ... 
global $kernel; 
if(!$kernel)
{ 
require_once _PS_ROOT_DIR_.'/app/AppKernel.php'; 
$kernel = new \AppKernel('prod', false); 
$kernel->boot(); 
} 
// ...

But the error remains. Then we add it to /opt/lampp/htdocs/PS2023/classes/module/Module.php before line 1671: the error disappears.

...the non native modules do not appear.

No success.

Link to comment
Share on other sites

New test:

according to

setting PS_DISABLE_NON_NATIVE_MODULE to 0 in table ps_configuration was the only way to get back non native modules. It is a mystery since

- PS_DISABLE_NON_NATIVE_MODULE had always been set to 1 on older Prestashop versions

- the upgrade was performed with the option "disable non native modules" set to NO.

At first, this generates a new error:

Unable to generate a URL for the named route "admin_addons_login" as such route does not exist.

and the connection to the back office is not possible. According to https://github.com/PrestaShop/PrestaShop/issues/30979 we renamed the module psaddonsconnect into something else such as old_psaddonsconnect (that is to say, uninstall it).

and things seem to be OK: payment module and other non native modules are back.

Edited by Marz12
detail (see edit history)
Link to comment
Share on other sites

  • Marz12 changed the title to [Solved] Upgrade to 8.1 : custom modules disappeared

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...