Dan-nl has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/104319


Change subject: add templatedata api check
......................................................................

add templatedata api check

based on the bug report, i have added an api check for templatedata
that allows the extension to work without it.

i have also updated the INSTALL instructions to reflect the current
intent and limited MediaWiki tempalte use.

Bug: 59085
Change-Id: Ia9d10b6de48a54f803699d296f11b177ab2174b4
---
M INSTALL
M includes/Adapters/Php/MediawikiTemplatePhpAdapter.php
2 files changed, 41 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/GWToolset 
refs/changes/19/104319/1

diff --git a/INSTALL b/INSTALL
index 78c5828..30e27dd 100644
--- a/INSTALL
+++ b/INSTALL
@@ -2,8 +2,11 @@
 =================
 
 1. Licensing
-2. Requirements
-3. Configuration
+2. Target Wiki
+3. Required Software
+4. Required MediaWiki Templates
+5. Recommended Extensions
+6. Configuration
    a. php.ini
    b. DefaultSettings.php
    c. LocalSettings.php
@@ -14,7 +17,7 @@
    d. FileBackend Security
    e. Assign Users
    f. Image Folder Permissions
-4. Hidden Categories
+7. Hidden Categories
 
 
 Licensing
@@ -22,14 +25,43 @@
 Licensed under GNU GPL. See LICENSE.txt for more license information.
 
 
-Requirements
-------------
+Target Wiki
+-----------
+GWToolset was designed with the intention of running on 
http://commons.wikimedia.org, thus, if
+you are installing it on another wiki you may need to first install extensions 
and import
+MediaWiki templates used on Commons.
+
+
+Required Software
+-----------------
 * MediaWiki >= 1.21
 * PHP >= 5.3.3
 * [PHP cURL support]( http://www.php.net/manual/en/curl.setup.php )
 * [PHP finfo extension]( http://www.php.net/manual/en/fileinfo.setup.php )
 
 
+Required MediaWiki Templates
+----------------------------
+In order for GWToolset to map metadata with a MediaWiki template, the 
MediaWiki template must be
+installed in the wiki. Currently, GWToolset is limited to mapping with the 
following, Commons,
+MediaWiki templates which should be imported or available in the wiki:
+
+* [Artwork] ( http://commons.wikimedia.org/wiki/Template:Artwork )
+* [Book] ( http://commons.wikimedia.org/wiki/Template:Book )
+* [Musical work] ( http://commons.wikimedia.org/wiki/Template:Muscial_work )
+* [Photograph] ( http://commons.wikimedia.org/wiki/Template:Photograph )
+* [Specimen] ( http://commons.wikimedia.org/wiki/Template:Specimen )
+
+
+Recommended Extensions
+----------------------
+Installing these extensions will give GWToolset the ability to use the most up 
to date
+MediaWiki template parameters as long as that template provides TemplateData.
+
+* [Scribunto] ( http://www.mediawiki.org/wiki/Extension:Scribunto )
+* [TemplateData] ( http://www.mediawiki.org/wiki/Extension:TemplateData )
+
+
 Configuration
 -------------
 ### `php.ini`
diff --git a/includes/Adapters/Php/MediawikiTemplatePhpAdapter.php 
b/includes/Adapters/Php/MediawikiTemplatePhpAdapter.php
index 3fa1413..5f60d3b 100644
--- a/includes/Adapters/Php/MediawikiTemplatePhpAdapter.php
+++ b/includes/Adapters/Php/MediawikiTemplatePhpAdapter.php
@@ -98,8 +98,11 @@
         */
        protected function retrieveTemplateData( Title $Title ) {
                $result = null;
+               global $wgAPIModules, $wgRequest;
 
-               global $wgRequest;
+               if ( !array_key_exists( 'templatedata', $wgAPIModules ) ) {
+                       return $result;
+               }
 
                $Api = new ApiMain(
                        new DerivativeRequest(

-- 
To view, visit https://gerrit.wikimedia.org/r/104319
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia9d10b6de48a54f803699d296f11b177ab2174b4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/GWToolset
Gerrit-Branch: master
Gerrit-Owner: Dan-nl <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to