Page MenuHomePhabricator

[mediawiki-api] Warnings from upload result are not logged
Closed, ResolvedPublic

Description

Some types of result don't have a top-level warnings element, but instead might have it one level down. For example, a duplicate upload can result in:

Array
(
    [upload] => Array
        (
            [result] => Warning
            [warnings] => Array
                (
                    [duplicate-archive] => Test.jpg
                )
            [filekey] => 157pzg7r75j4.bs0wl9.15.jpg
            [sessionkey] => 157pzg7r75j4.bs0wl9.15.jpg
        )

)

MediawikiApi::logWarnings() only currently looks for the top-level warnings.

(Google Code-In link: https://codein.withgoogle.com/dashboard/task-instances/6354431006212096 )

Event Timeline

As this is a core mediawiki api module we can / should probably add handling for this in the library! :)

This might be a good easy Code-In task for later this year.

This might be a good easy Code-In task for later this year.

Would you volunteer mentoring?

Albert221 subscribed.

@Samwilson should MediawikiApi::logWarnings() look for warnings recursively? Or maybe look firstly on the top level, then go deeper? I think that:

  1. Check first level
  2. Check deeper levels (recursively)

would be a fine approach. What do you think?

It could check recursively, but that might end up being a long-ish operation if the result set doesn't have any warnings and instead just has lots of results. It's probably okay to just check the first and second levels, because I don't think there's any API result which has warnings any deeper than that — it'd be worth confirming that though.

Thanks for claiming this task!

It could check recursively, but that might end up being a long-ish operation if the result set doesn't have any warnings and instead just has lots of results. It's probably okay to just check the first and second levels, because I don't think there's any API result which has warnings any deeper than that — it'd be worth confirming that though.

Yes, I think first and second levels could be good.