Page MenuHomePhabricator

Provide a new API query module to retrieve a list of newly uploaded files
Closed, ResolvedPublic

Description

ApiQueryNewFiles class which provides this functionality (created under MW1.19)

A new API query module which provides the functionality of Special:NewFiles would be extremely useful for scripts which could provide an interface to easily select a recently upload file for inserting in the page, specially if it's also able to filter by the user who uploaded them.

And maybe create custom atom/rss feeds for recent uploaded files.

There's no functionality for this in the current API modules:

  • list=allimages lists images in alphabetically order.
  • list=logevents&leaction=upload gives not-usable results when files are deleted or moved

I've taken the effort to create the API Class that provides this functionality by myself. I'm sorry for not being able to provide it in a "patch" format, but it should be easy to integrate it in the MediaWiki code.

Including it as an extension only required me those 2 lines (apart from copying the attached file to the current installation directory):
$wgAutoloadClasses['ApiQueryNewFiles'] = dirname( FILE ) . '/ApiQueryNewFiles.php';
$wgAPIListModules['newfiles'] = 'ApiQueryNewFiles';


Version: unspecified
Severity: enhancement

Attached:

Details

Reference
bz40120

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 12:44 AM
bzimport set Reference to bz40120.

Bryan.TongMinh wrote:

Would it be possible to extend list=allimages to sort by upload date?

(In reply to comment #1)

Would it be possible to extend list=allimages to sort by upload date?

Both query the image table http://www.mediawiki.org/wiki/Manual:Image_table but using different indexes for that.

list=allimages provides functionality to filter by image name (or preffix) while the new list=newfiles provide functionality to filter by username. I'm not sure if mysql can use both indexes to perform the query or not, but if not then both kind of filtering should be mutually exclusive (or allowed only in Miser Mode). Also, pagination and sorting is different in both modes because of the indexes.

Hello,

Thank you for your submission, this is appreciated.

You can request a Wikimedia development account at the following URL :
https://www.mediawiki.org/wiki/Developer_access

This will allow you to directly push your patch in our code review system, Gerrit.

You'll find the git/git review/gerrit workflow manual here:
https://www.mediawiki.org/wiki/Git/Workflow

I'll be happy to assist you if you've some questions about that.

[ Setting priority: Normal. Bug assigned to code submitter. ]

See bug 27202 for the sort=timestamp request

Okay, it seems there's a bit of more work to do there... some things changed on the api between MW1.19 and the head version. This will take some time for me, since I don't have here a development box with MediaWiki installed to be sure it works. Long story short, my "development" server is in another machine without external internet connection, several Kilometers away from where I am.

Maybe in a few weeks I could return to it and maybe provide this functionality with list=allimages, with all the applicable restrictions.

I'm abandoning this change in favor of including it in list=allimages as some devs suggested.

  • This bug has been marked as a duplicate of bug 27202 ***