Jump to content

Problems during upgrade 2.7 to 2.8


valan
 Share

Recommended Posts

I'm upgrading from 2.7.2 to 2.8.35

As usual I've replaced /wire and index.php, but this time upgrade failed.

During bootstrap system generates "Call to a member function get() on null" on this code in my custom module

class ProcessCustom extends Process {
    public static function getModuleInfo() {
        $permission = wire('permissions')->get(self::someId); // error occures here
...

I have few thoughts:

- either wire('permissions') is not supported in 2.8.35

- or error caused by index.php which significantly changed. In 2.7.2 I've used index.config.php (multi-domain config) and now I'm not sure that bootstrap uses it...

Please advice where could be a source of the problem. 
 

Link to comment
Share on other sites

Why are you loading a permission in the getModuleInfo? This should a static a.k.a. self-contained function which returns information about the module independent of the installed system. Also permissions are usually referenced by name. I mean it's technically correct, but still curious.

  • Like 1
Link to comment
Share on other sites

@LostKobrakai's question is a good one. You shouldn't run any logic inside getModuleInfo() since it is executed by the module cache update routine long before the system is ready and things like permissions, roles, users and session have been wire()d. I guess one cou could say it used to work accidentally. I don't think there's a way around moving your logic into __construct(), init() or ready() in recent PW versions.

  • Like 1
Link to comment
Share on other sites

That was legacy... Changed code to to static, error disappeared. Getting now another error in ProDrafts module. It says "Class 'ProDrafts' not found in /var/www/pw/mechanics/modules/ProDrafts/ProcessProDrafts.module:28". It's here:

    public static function getModuleInfo() {
        return array(
            'title' => 'ProDrafts',
            'version' => 2,
            'summary' => 'List, manage and compare draft pages.',
            'icon' => ProDrafts::defaultIcon, // error here

Edit: issue is fixed by reinstalling the module.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...