Page MenuHomePhabricator

Xtools API hits error and returns 'maintenance'
Closed, ResolvedPublic

Description

See here.

This affects the xtools gadget which relies on the API. Several people have been complaining on the gadget's talk page, and someone's reported the issue on github.

From looking at the api.php code, an exception is being thrown which causes 'maintenance' to be returned. I'd be happy to have a look at it myself but would need access to the tool group.

Event Timeline

If you're truly dedicated to helping out the xTools project and are experienced with PHP we can probably add you. It's mostly maintenance at this point, which I really need to document. The truth is the whole codebase is a mess. The xTools gadget doesn't do but so much and you can probably write your own lightweight version from scratch in less time than repairing the ever deteriorating suite of tools. The source code is public and it's mainly those SQL queries you'd be interested in for the gadget, and also the Wikimedia pageviews API. I'm happy to help with rebuilding this. In a nutshell a rewrite of anything xTools is probably more favourable.

Great, I am experienced with PHP and would like to help. My main focus is that I want to get the API working again so that the gadget also starts working again (as I find the gadget pretty useful).

I hope that just fixing this specific issue shouldn't be too tricky, but once this is fixed and I know a bit more about the codebase I'm open to helping with more stuff e.g. a potential rewrite, time permitting.

My username on the tool server is the same one as here.

Assigning to you, as you've expressed interest in fixing this.

(Was initially wondering if T136375#2335731 could be related if this was a new problem, but probably not as this is about returning "maintenance" instead of "true" or "1")

Exception message:

Main_Page{"xdebug_message":"\nException: nodata in \/data\/project\/xtools\/public_html\/api.php on line 80\n\nCall Stack:\n    0.0047     793304   1. {main}() \/data\/project\/xtools\/public_html\/api.php:0\n"}

Appears the ArticleInfo class is not loading it's big data array properly.

Sorry, @Mabandalone . It appears I've been inadvertently troubleshooting this for you xD

Relevant line: https://github.com/x-tools/xtools/blob/master/modules/ArticleInfo.php#L442 WikiViewStats is down right now, api is returning no information as far as I can tell. Thus, the $data array of $at is empty in api.php and throwing a "nodata" error.

I'm not sure if that's the complete reason it's down, but for now it's a good start.

I could see that removing the '&db=' parameter and replacing it with the project name in XTools.js such as &project=en.wikipedia.org would make it work again.

The xtools gadget should now be fixed, thanks for figuring that bit out @Alfa80 ! I also updated the links/paths to go to the right place. Is anyone using the API outside this script? I'm not sure if hitting the API directly with https://tools.wmflabs.org/xtools/api.php ever did anything without giving it some parameters.

@MusikAnimal Thanks a lot for the official update. I guess by the links you mean the internal links in php for new location of xtools-articleinfo instead of xtools/article-info?. (Since it redirects but need to wait some more seconds to read the 'permanently moved message....'). Thanks again.

Matthewrbowker claimed this task.

Thanks to @Alfa80 's fix, it appears to be working. I'm closing this for now, feel free to re-open if it breaks again.