samwilson / mwcli

A command line client for MediaWiki wikis.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

mwcli working for some sites and not other

antoine2711 opened this issue · comments

I've tried mwcli with a few of my MediaWiki.

For most, it works. But for one, I get this:

mw extension:outdated -w wkqc

 Using config file /usr/local/MWCLI/mwcli/config.yml                                                                    

Using cached extension data: /home/wikiquebec/.cache/mwcli/ExtensionJson.json
PHP Warning:  Invalid argument supplied for foreach() in /usr/local/MWCLI/mwcli/src/Command/ExtensionOutdatedCommand.php on line 52
 ----------- ----------- -------- 
  Extension   Installed   Latest  
 ----------- ----------- -------- 

And I also have this problem.

mw sites:info -w wkqc

 Using config file /usr/local/MWCLI/mwcli/config.yml                                                                    

PHP Notice:  Trying to access array offset on value of type null in /usr/local/MWCLI/mwcli/src/Command/SitesInfoCommand.php on line 44
PHP Notice:  Trying to access array offset on value of type null in /usr/local/MWCLI/mwcli/src/Command/SitesInfoCommand.php on line 44
PHP Fatal error:  Uncaught TypeError: Argument 2 passed to Monolog\Logger::debug() must be of the type array, null given, called in /usr/local/MWCLI/mwcli/src/Command/SitesInfoCommand.php on line 45 and defined in /usr/local/MWCLI/mwcli/vendor/monolog/monolog/src/Monolog/Logger.php:596
Stack trace:
#0 /usr/local/MWCLI/mwcli/src/Command/SitesInfoCommand.php(45): Monolog\Logger->debug()
#1 /usr/local/MWCLI/mwcli/vendor/symfony/console/Command/Command.php(298): Samwilson\MediaWikiCLI\Command\SitesInfoCommand->execute()
#2 /usr/local/MWCLI/mwcli/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run()
#3 /usr/local/MWCLI/mwcli/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#4 /usr/local/MWCLI/mwcli/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#5 /usr/local/MWCLI/mwcli/bin/mwcli(31): Symfony\Component\Console\Application->run()
#6 {main}
  thrown in /usr/local/MWCLI/mwcli/vendor/monolog/monolog/src/Monolog/Logger.php on line 596

What suprises me is that for most of my sites, mwcli works.

What should I do?

Thanks for reporting this!

It looks like it's failing to retrieve the list of your wiki's installed extensions. Can you try via your ApiSandbox (e.g. https://freo.wiki/Special:ApiSandbox#action=query&format=json&meta=siteinfo&siprop=extensions ) and see if it's correctly reporting the installed extensions.

Even if it's not fetching the extensions right, it shouldn't fail like this. I'll improve the error reporting.

Thanks for reporting this!

Thank you @samwilson for your work and this good tool.

It looks like it's failing to retrieve the list of your wiki's installed extensions. Can you try via your ApiSandbox (e.g. https://freo.wiki/Special:ApiSandbox#action=query&format=json&meta=siteinfo&siprop=extensions ) and see if it's correctly reporting the installed extensions.

Yah. Well, it's failing on my server.

Even if it's not fetching the extensions right, it shouldn't fail like this. I'll improve the error reporting.

Thank you for that.

Regards, Antoine

Yah. Well, it's failing on my server.

Is there any error message? Is it a public wiki that I could look at?

There seems to be a 1 being output at the beginning of every page. For example: https://your.wiki/api.php?format=json&action=query returns 1{"batchcomplete":""} and the leading 1 is breaking all API responses. I'm not sure where that's coming from, but I'd check your LocalSettings.php for some echo or print statement.

@samwilson : so, I started to look for an echo or such in my LocalSettings.pho like you recommended me, and I saw that the beginnig of my file was starting with 1<?php

Thank you for your help, and thanks again for your tool, I think it has a lot of potential.

Best Regards,
Antoine Beaubien

Glad we figured it out! :-)

If you have any ideas for the tool, please do create issues for them.

Glad we figured it out! :-)

You pointed me well, @samwilson!

If you have any ideas for the tool, please do create issues for them.

I already did (#231). I'm a French, so you will get a few bug report on this regard! ;-) I've already put another one that could be language related.

Regards,
Antoine