Last modified: 2012-09-12 18:52:37 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T42120, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 40120 - Provide a new API query module to retrieve a list of newly uploaded files
Provide a new API query module to retrieve a list of newly uploaded files
Status: RESOLVED DUPLICATE of bug 27202
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
unspecified
All All
: Normal enhancement with 1 vote (vote)
: ---
Assigned To: Jesús Martínez Novo (Ciencia Al Poder)
: easy, patch
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-09 17:57 UTC by Jesús Martínez Novo (Ciencia Al Poder)
Modified: 2012-09-12 18:52 UTC (History)
5 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
ApiQueryNewFiles class which provides this functionality (created under MW1.19) (7.16 KB, text/plain)
2012-09-09 17:57 UTC, Jesús Martínez Novo (Ciencia Al Poder)
Details

Description Jesús Martínez Novo (Ciencia Al Poder) 2012-09-09 17:57:44 UTC
Created attachment 11093 [details]
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';
Comment 1 Bryan Tong Minh 2012-09-09 18:19:04 UTC
Would it be possible to extend list=allimages to sort by upload date?
Comment 2 Jesús Martínez Novo (Ciencia Al Poder) 2012-09-09 18:40:02 UTC
(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.
Comment 3 Dereckson 2012-09-10 08:20:05 UTC
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. ]
Comment 4 Jesús Martínez Novo (Ciencia Al Poder) 2012-09-11 12:40:47 UTC
Ok, code pushed to gerrit (on merge queue) https://gerrit.wikimedia.org/r/23408
Comment 5 Umherirrender 2012-09-11 16:32:06 UTC
See bug 27202 for the sort=timestamp request
Comment 6 Jesús Martínez Novo (Ciencia Al Poder) 2012-09-11 17:42:20 UTC
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.
Comment 7 Jesús Martínez Novo (Ciencia Al Poder) 2012-09-12 18:52:37 UTC
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 ***

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links