ERROR: Elgg\Exceptions\PluginException: <some bootstrap class of a plugin> must implement Elgg\PluginBootstrapInterface. in <some file> on Update to Elgg 6

Hey there!

We're currently trying to migrate our Elgg 3.3 installation all the way up to the latest 6 version. Updating it using composer was no problem but when we try to run the elgg-cli we get a bunch of errors as described in the subject of this post.

The mentioned bootstrap classes HAVE implemented that interface. There were even official 6-compatible plugins by ColdTrick in that list for example, so I don't believe it's something related to the plugins.

Any ideas what could cause this?

Thanks

Kind regards

Dennis

  • Maybe a caching issue. Since you used Composer the autoloader should be OK.

    If you have a custom cache location defined in the `elgg-config/settings.php` check there. Otherwise check in the `dataroot` folder for a folder named `caches` or `fastcache` and remove that folder.

  • Thanks, but that didn't work. I removed the caches subfolder of the dataroot and even the system_caches and view_simplecache but to no avail.

    The message stays the same.

    Any other idea?

    For example, this is the output concerning your menu builder:

     ERROR: Elgg\Exceptions\PluginException: ColdTrick\MenuBuilder\Bootstrap muss Elgg\PluginBootstrapInterface implementieren. in /var/www/localhost/htdocs
    /vendor/elgg/elgg/engine/classes/Elgg/Exceptions/PluginException.php:43 
    Stack trace: 
    #0 /var/www/localhost/htdocs/vendor/elgg/elgg/engine/classes/ElggPlugin.php(694): Elgg\Exceptions\PluginException::factory() 
    #1 /var/www/localhost/htdocs/vendor/elgg/elgg/engine/classes/Elgg/Database/Plugins.php(563): ElggPlugin->getBootstrap() 
    #2 [internal function]: Elgg\Database\Plugins->shutdown() 
    #3 /var/www/localhost/htdocs/vendor/elgg/elgg/engine/classes/Elgg/HandlersService.php(66): call_user_func() 
    #4 /var/www/localhost/htdocs/vendor/elgg/elgg/engine/classes/Elgg/EventsService.php(589): Elgg\HandlersService->call() 
    #5 /var/www/localhost/htdocs/vendor/elgg/elgg/engine/classes/Elgg/EventsService.php(90): Elgg\EventsService->callHandler() 
    #6 /var/www/localhost/htdocs/vendor/elgg/elgg/engine/classes/Elgg/Application/ShutdownHandler.php(76): Elgg\EventsService->trigger() 
    #7 /var/www/localhost/htdocs/vendor/elgg/elgg/engine/classes/Elgg/Application/ShutdownHandler.php(32): Elgg\Application\ShutdownHandler->shutdownApplica
    tion() 
    #8 [internal function]: Elgg\Application\ShutdownHandler->__invoke() 
    #9 {main}  
    array:1 [ 
     "context" => array:1 [ 
       "plugin" => ElggPlugin^ {#745 
         #attributes: array:12 [ 
           "time_created" => 1519408707 
           "guid" => 52 
           "type" => "object" 
           "subtype" => "plugin" 
           "owner_guid" => 1 
           "container_guid" => 1 
           "access_id" => 2 
           "time_updated" => 1519408707 
           "last_action" => 1519408707 
           "enabled" => "yes" 
           "deleted" => "no" 
           "time_deleted" => 0 
         ] 
         #valid: false 
         -time: null 
         #temp_metadata: [] 
         #temp_annotations: [] 
         #volatile: array:1 [ 
           "select:value" => "29" 
         ] 
         #orig_attributes: [] 
         #_is_cacheable: true 
         #_cached_metadata: array:6 [ 
           "title" => "menu_builder" 
           "elgg:internal:priority" => "29" 
           "menu_names" => "{"2":"site"}" 
           "htmlawed_filter" => "yes" 
           "menu_site_config" => "{"menu_name_1519408917":{"access_id":1,"is_action":"0","priority":0,"name":"menu_name_1519408917","text":"Spielerliste","
    href":"members\/alpha","target":"0","parent_name":"0"},"menu_name_1519408937":{"access_id":1,"is_action":"0","priority":2,"name":"menu_name_1519408937",
    "text":"Forum","href":"discussion\/group\/45105","target":"0","parent_name":"0"},"menu_name_1519408954":{"access_id":1,"is_action":"0","priority":1,"nam
    e":"menu_name_1519408954","text":"Termine","href":"event_calendar\/list\/","target":"0"},"menu_name_1519413627":{"access_id":0,"is_action":"0","priority
    ":3,"name":"menu_name_1519413627","text":"Gruppen","href":"groups","target":"0","parent_name":"0"},"menu_name_1519806361":{"access_id":0,"is_action":"0"
    ,"priority":4,"name":"menu_name_1519806361","text":"Seiten","href":"pages","target":"0","parent_name":"0"},"menu_name_1520854143":{"access_id":1,"is_act
    ion":"0","priority":6,"name":"menu_name_1520854143","text":"Handbuch","href":"pages\/view\/53543\/handbuch-zum-mitgliederbereich","target":"0","parent_n
    ame":"0"},"menu_name_1623129656":{"access_id":1,"is_action":"0","lightbox":"0","priority":5,"name":"menu_name_1623129656","text":"Vereinsinfo","href":"p
    ages\/view\/59026\/vereinsinformation","icon":"","target":"0"},"menu_name_1636967106":{"access_id":1,"is_action":"0","lightbox":"0","priority":"16369670
    68","name":"menu_name_1636967106","text":"Verwaltung","href":"membership","icon":"","target":"0","parent_name":"0"}}" 
           "menu_builder_default_imported" => "1519409028" 
         ] 
         #composer: null 
         #path: "/var/www/localhost/htdocs/mod/menu_builder/" 
         #static_config: array:6 [ 
           "plugin" => array:1 [ 
             "version" => "11.0" 
           ] 
           "bootstrap" => "ColdTrick\MenuBuilder\Bootstrap" 
           "actions" => array:8 [ 
             "menu_builder/regen_site_menu" => array:1 [ 
               "access" => "admin" 
             ] 
             "menu_builder/menu/reorder" => array:1 [ 
               "access" => "admin" 
             ] 
             "menu_builder/menu/export" => array:1 [ 
               "access" => "admin" 
             ] 
             "menu_builder/menu/import" => array:1 [ 
               "access" => "admin" 
             ] 
             "menu_builder/menu/edit" => array:1 [ 
               "access" => "admin" 
             ] 
             "menu_builder/menu/delete" => array:1 [ 
               "access" => "admin" 
             ] 
             "menu_builder/menu_item/edit" => array:1 [ 
               "access" => "admin" 
             ] 
             "menu_builder/menu_item/delete" => array:1 [ 
               "access" => "admin" 
             ] 
           ] 
           "events" => array:1 [ 
             "prepare" => array:2 [ 
               "all" => array:1 [ 
                 "\ColdTrick\MenuBuilder\Menus::prepareMenuSetSelected" => array:1 [ 
                   "priority" => 9999 
                 ] 
               ] 
               "menu:site" => array:1 [ 
                 "\ColdTrick\MenuBuilder\Menus::prepareSiteMenu" => array:1 [ 
                   "priority" => 900 
                 ] 
               ] 
             ] 
           ] 
           "view_extensions" => array:1 [ 
             "admin.css" => array:1 [ 
               "menu_builder/admin.css" => [] 
             ] 
           ] 
           "view_options" => array:2 [ 
             "menu_builder/import" => array:1 [ 
               "ajax" => true 
             ] 
             "menu_builder/edit_item" => array:1 [ 
               "ajax" => true 
             ] 
           ] 
         ] 
         #activated: null 
         -logger: null 
       } 
     ] 
    ] 
    array:1 [ 
     "backtrace" => array:5 [ 
       0 => "[#5] /var/www/localhost/htdocs/vendor/elgg/elgg/engine/classes/Elgg/EventsService.php:589" 
       1 => "[#4] /var/www/localhost/htdocs/vendor/elgg/elgg/engine/classes/Elgg/EventsService.php:90" 
       2 => "[#3] /var/www/localhost/htdocs/vendor/elgg/elgg/engine/classes/Elgg/Application/ShutdownHandler.php:76" 
       3 => "[#2] /var/www/localhost/htdocs/vendor/elgg/elgg/engine/classes/Elgg/Application/ShutdownHandler.php:32" 
       4 => "[#1] unknown" 
     ] 
    ]
    
    

    Additionally, this error is shown on top of all the similar others:

    PHP Fatal error:  Trait "Elgg\Di\ServiceFacade" not found in /var/www/localhost/htdocs/mod/garbagecollector/classes/Elgg/GarbageCollector/GarbageCollect
    or.php on line 13


    Could be related perhaps.

    Thanks!

  • For Elgg 3

    Try to delete from directory /data/caches/ these folders: /views_simplecache, /stash and /localstash

    For Elgg 4/5

    Try to delete from directory /data/caches/ these folders: /views_simplecache, /fastcache and /localfastcache

     

    Then restart PHP-FPM service to clean opCache.

    Running Upgrade via administration is recommended too.

  • @nikolai Thanks, but that didn't work as well. Like I said, I already deleted the caches directory. I had no stash or localstash or fastcache folders. Restarting the container didn't work as well and I can't reach administration because the same errors come up in the web server error log when I try to call the website.

  • Just one idea is to check read/write permissions on all folders.

    I can't reach administration

    You can call 'Upgrade' via CLI:

    cd /vendor/bin/
    
    php elgg-cli upgrade
    
  • I've chmodded 0777 every file in data out of desperation, but same thing.

    I know how to upgrade with the CLI. That's why I wanted to use it in the first place, but I get the same exceptions running the CLI and the Web UI.

  • Could it be the autoloader not really working properly? Running composer dump-autoload produces this output:

    Generating optimized autoload files 
    Warning: Ambiguous class resolution, "Laminas\Mime\Mime" was found in both "/var/www/localhost/htdocs/vendor/elgg/elgg/engine/vendor_classes/Laminas/Mime/Mime.php" and "/var/www/localhost/htdocs/vendor/laminas
    /laminas-mime/src/Mime.php", the first will be used. 
    Warning: Ambiguous class resolution, "CssCrush\Process" was found in both "/var/www/localhost/htdocs/vendor/elgg/elgg/engine/vendor_classes/CssCrush/Process.php" and "/var/www/localhost/htdocs/vendor/css-crush
    /css-crush/lib/CssCrush/Process.php", the first will be used. 
    Warning: Ambiguous class resolution, "CssCrush\StringObject" was found in both "/var/www/localhost/htdocs/vendor/elgg/elgg/engine/vendor_classes/CssCrush/StringObject.php" and "/var/www/localhost/htdocs/vendor
    /css-crush/css-crush/lib/CssCrush/StringObject.php", the first will be used. 
    Warning: Ambiguous class resolution, "CssCrush\BalancedMatch" was found in both "/var/www/localhost/htdocs/vendor/elgg/elgg/engine/vendor_classes/CssCrush/BalancedMatch.php" and "/var/www/localhost/htdocs/vend
    or/css-crush/css-crush/lib/CssCrush/BalancedMatch.php", the first will be used. 
    To resolve ambiguity in classes not under your control you can ignore them by path using exclude-files-from-classmap 
    Generated optimized autoload files containing 4260 classes
    
  • The Ambigous warnings are by design, we needed to 'patch' some vendor/3rd party classes so we overruled them in the Elgg project.

  • Okay, got it. It *actually* was old code from different plugins. Some custom ones, some from the vendor directory, etc.

    Once I cleared all out plugins that weren't compatible with 6, the cli ran again and I could do the upgrade.

    A very weird error message though. But I guess you can't really optimize here when you've removed code which is called by legacy plugins.

    Maybe the experience would've been better if I migrated from major version to major version. Maybe you could update the upgrade guide though because that is still stuck at upgrading to version 3.

  • Glad to hear this!

    But...

    Firstly, it's written in the manual.

    Secondly, old plugins always need to be updated, as they are incompatible with previous versions of Elgg. And this is also written in the manual.

    Thirdly, how to upgrade has already been discussed many times here 1, 2, 3 etc