Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mediawiki Upgrade Trouble - PHP Fatal error: Class 'Liuggio\StatsdClient\Factory\StatsdDataFactory' not found

I have difficulty upgrading Mediawiki from 1.23 to 1.25 owing to StatsdDataFactory.

I succeeded in "composer update" and "php update.php." But when I tried "php rebuildall.php", I got the following error:

PHP Fatal error: Class 'Liuggio\StatsdClient\Factory\StatsdDataFactory' not found in /var/www/html/mydomain.com/w/includes/libs/BufferingStatsdDataFactory.php on line 33

The same error occurred both in

(1) CentOS 6.6 + PHP 5.3.3 + Apache 2.2.15 + mysql 14.1

and in

(2) CentOS 7.1 + PHP 5.4.16 + Apache 2.4.6 + mariadb 15.1

I opened the BufferingStatsdDataFactory.php file.

(line 23) use Liuggio\StatsdClient\Factory\StatsdDataFactory;

(line 33) class BufferingStatsdDataFactory extends StatsdDataFactory { protected $buffer = array(); ...

Then I opened composer.json at /var/www/html/mydomain.com/w/, to find "liuggio/statsd-php-client" is included.

    "require": {
            "cssjanus/cssjanus": "1.1.1",
            "ext-iconv": "*",
            "leafo/lessphp": "0.5.0",
            "liuggio/statsd-php-client": "1.0.12",
            "oojs/oojs-ui": "0.11.3",
            "php": ">=5.3.3",
            "psr/log": "1.0.0",
            "wikimedia/cdb": "1.0.1",
            "wikimedia/composer-merge-plugin": "1.0.0",
            "wikimedia/utfnormal": "1.0.2",
            "zordius/lightncandy": "0.18"
    },

In this file, I imitated the solution shown here (PHP Fatal error: Class 'MyApp\Chat' not found in /MyApp/chat-server.php).

    "autoload": {
            "psr-0": {
                    "ComposerHookHandler": "includes/composer"
            }
            "psr-4": {
                    "Liuggio\\": "includes/composer"
            }

},

But it did not work. The following did not work either.

            "psr-4": {
                    "Liuggio\\": ""
            }

When I commented out the BufferingStatsdDataFactory.php, I got another error:

PHP Fatal error: Class 'BufferingStatsdDataFactory' not found in /var/www/html/mydomain.com/w/includes/context/RequestContext.php on line 137

Now my wiki site is inaccessible. I welcome any suggestions.

like image 527
anonymusjaponicus Avatar asked Feb 10 '23 12:02

anonymusjaponicus


1 Answers

Check the vendor/liuggio/statsd-php-client directory. If the classes are not there, you have some kind of Composer problem. If the classes are there, they are probably not included in the file used by Composer to map class names to file paths. (Depending on its configuration, Composer can either locate files on the fly by traversing directories according to the fully qualified class name, or improve autoloading performance a bit by storing a complete class => path mapping in a file. If the autloader is configured one way and the update command which has to regenerate the classmap the other way, you get errors like this.) To fix that, run composer dump-autoload --optimize.

like image 168
Tgr Avatar answered Feb 12 '23 02:02

Tgr