Extension:GlobalUsage
| This extension's page is outdated. It was written for an older version of MediaWiki and may not apply to the most recent version. See the talk page for a possible discussion on this. |
|
|
Please expand this page. |
|
GlobalUsage Release status: stable |
|||
|---|---|---|---|
| Implementation | Special page, API | ||
| Description | Allows to view the global usage of images in a wiki farm with shared image repository | ||
| Author(s) | Bryan Tong Minh (Bryantalk) | ||
| MediaWiki | 1.16+ | ||
| Database changes | Yes | ||
| License | MIT | ||
| Download |
README |
||
|
|||
|
Translate the GlobalUsage extension if it is available at translatewiki.net |
|||
| Check usage and version matrix; code metrics | |||
| Bugs: list open list all report | |||
The GlobalUsage extension allows to view the global usage of images in a wiki farm with shared image repository. It adds Special:GlobalUsage as well as a list of pages that include the image on image description pages.
Installation[edit | edit source]
- Download the extension and unpack it in the extensions directory
- Source GlobalUsage.sql: php maintenance/sql.php extensions/GlobalUsage/GlobalUsage.sql
- Note: do this from the wiki installation where you want the GlobalUsage data to be located. Typically this is your shared image repository. Running update.php on that wiki will also create the table.
- Edit LocalSettings.php and add to the bottom of the file:
-
require_once("$IP/extensions/GlobalUsage/GlobalUsage.php");
-
- In LocalSettings, set $wgGlobalUsageDatabase to the identifier of the wiki where the GlobalUsage data is located (usually the database name). It should be something understandable to wfGetDB. Example: $wgGlobalUsageDatabase = 'commonswiki';
- At present, this can NOT be a database name of a wiki, but must be a name given in a load balancer configuration: Manual:$wgLBFactoryConf, a complex and largely undocumented configuration structure used by the WMF and Wikia. For a normal mediawiki setup using multiple databases configuring and maintaining this data structures implies significant difficulties.
- Run refreshGlobalimagelinks.php on all wikis in your farm. This will take a long time. php extensions/GlobalUsage/refreshGlobalimagelinks.php
- Visit Special:GlobalUsage and enjoy.
API[edit | edit source]
Extension:GlobalUsage includes an API extension that allows bots and other programs to query the global usage of a file. For example, this query on Wikimedia Commons returns global uses of File:Example.jpg:
| Result |
|---|
<?xml version="1.0"?> <api> <query> <pages> <page pageid="6428847" ns="6" title="File:Example.jpg"> <globalusage> <gu title="Ашаблон:Ацқьа" wiki="ab.wikipedia.org" url="http://ab.wikipedia.org/wiki/%D0%90%D1%88%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD:%D0%90%D1%86%D2%9B%D1%8C%D0%B0" /> <gu title="Wikipedia_ውይይት:Can't_see_the_font?" wiki="am.wikipedia.org" url="http://am.wikipedia.org/wiki/Wikipedia_%E1%8B%8D%E1%8B%AD%E1%8B%AD%E1%89%B5:Can%27t_see_the_font%3F" /> <gu title="አባል:Blockinblox" wiki="am.wikipedia.org" url="http://am.wikipedia.org/wiki/%E1%8A%A0%E1%89%A3%E1%88%8D:Blockinblox" /> <gu title="አባል_ውይይት:Hana.oww" wiki="am.wikipedia.org" url="http://am.wikipedia.org/wiki/%E1%8A%A0%E1%89%A3%E1%88%8D_%E1%8B%8D%E1%8B%AD%E1%8B%AD%E1%89%B5:Hana.oww" /> <gu title="አባል:Beza" wiki="am.wikipedia.org" url="http://am.wikipedia.org/wiki/%E1%8A%A0%E1%89%A3%E1%88%8D:Beza" /> <gu title="መደብ:ኪነት" wiki="am.wikipedia.org" url="http://am.wikipedia.org/wiki/%E1%88%98%E1%8B%B0%E1%89%A5:%E1%8A%AA%E1%8A%90%E1%89%B5" /> <gu title="መደብ_ውይይት:ተረትና_ምሳሌ" wiki="am.wikipedia.org" url="http://am.wikipedia.org/wiki/%E1%88%98%E1%8B%B0%E1%89%A5_%E1%8B%8D%E1%8B%AD%E1%8B%AD%E1%89%B5:%E1%89%B0%E1%88%A8%E1%89%B5%E1%8A%93_%E1%88%9D%E1%88%B3%E1%88%8C" /> <gu title="ስዕል:መርጡለ_ማርያም_ገዳም_.jpg" wiki="am.wikipedia.org" url="http://am.wikipedia.org/wiki/%E1%88%B5%E1%8B%95%E1%88%8D:%E1%88%98%E1%88%AD%E1%8C%A1%E1%88%88_%E1%88%9B%E1%88%AD%E1%8B%AB%E1%88%9D_%E1%8C%88%E1%8B%B3%E1%88%9D_.jpg" /> <gu title="User_talk:Rasheduzzaman_Raj" wiki="ang.wikipedia.org" url="http://ang.wikipedia.org/wiki/User_talk:Rasheduzzaman_Raj" /> <gu title="User:Danceteamcherleaders" wiki="ang.wikipedia.org" url="http://ang.wikipedia.org/wiki/User:Danceteamcherleaders" /> </globalusage> </page> </pages> </query> <query-continue> <globalusage gucontinue="Example.jpg|arwiki|77967" /> </query-continue> </api> |
By default this returns only 10 results. The next 10 results can be retrieved using the gucontinue parameter included in the result above:
The number of results returned is set with the gulimit parameter. The guprop parameter sets which properties to retrieve. The gufilterlocal parameter, when set to 1, will exclude uses on the same wiki as the file (e.g. on Commons). The following query retrieves all properties and up to 100 results, excluding local uses:
| This extension is being used on one or more Wikimedia projects. This probably means that the extension is stable and works well enough to be used by such high-traffic websites. Look for this extension's name in Wikimedia's CommonSettings.php and InitialiseSettings.php configuration files to see where it's installed. A full list of the extensions installed on a particular wiki can be seen on the wiki's Special:Version page. |
- Need Updating
- Outdated pages
- Articles to be expanded
- MIT licensed extensions
- Stable extensions
- Special page extensions
- API extensions
- Extensions in Wikimedia version control
- LinksUpdateComplete extensions
- ArticleDeleteComplete extensions
- TitleMoveComplete extensions
- FileUndeleteComplete extensions
- UploadComplete extensions
- ImagePageAfterImageLinks extensions
- All extensions
- Extensions used on Wikimedia
- Extensions for data exchange with other local wikis