Extension:GWToolset/Technical Implementation

From mediawiki.org

GWToolset (or GLAMWikiToolset) is a Special Page extension. The main goal of the extension is to allow GLAMs the ability to mass upload content (pictures, videos, and sounds) to Wikimedia Commons based on respective metadata (XML); the intent is to allow for a wide variety of XML schemas. The extension goes about this task by presenting the user with several steps, represented by HTML forms, in order to set-up a batch upload process that will upload content and metadata to the wiki, which creates individual mediafile pages for each item uploaded.

The project was co-funded by Europeana and a few Wikimedia chapters[1].

Further information can be found on the project page. Your feedback and questions are welcome, feel free to contact us.

Below are sections that describe the implementation in further detail.

General concerns[edit]

Code conventions[edit]

GWToolset attempts, as much as possible, to adhere to MediaWiki Code conventions. Below are a few code conventions mentioned for clarity.


# upper camel case

primitive data types and arrays[edit]

# snake_case, lower case with _ separator

class methods[edit]

# lower camel case

doc blocks[edit]

# jsduck style for datatype
 * store the file at the final storage path
 * @param {string} $tmp_file_path
 * the temporary file path location of the src file to be stored in the FileBackend
 * @return {Status}
protected function quickStore( $tmp_file_path = null ) {

PHP namespace[edit]

GWToolset uses a PHP namespace in order to prevent conflicts with other code within the MediaWiki global namespace; the root namespace is \GWToolset.

MediaWiki namespace[edit]

GWToolset defines two $wgExtraNamespaces.

ID Name Constant Remark
491 GWToolset_talk: NS_GWTOOLSET_TALK

This namespace is used to define a unique space within the wiki to store metadata mappings used by this extension and potentially the metadata content used in conjunction with those mappings.


GWToolset uses a Config class, /GWToolset/includes/Config.php, to add configuration settings within the GWToolset namespace. Settings can be changed with:

\GWToolset\Config::$variable_name = 'new value'

User group requirement[edit]

GWToolset adds a new user group, gwtoolset, that users must be a part of in order to use the extension. This method of permission control was chosen in order to isolate users similar to UploadWizard’s ‘upwizcampeditors’ and Translate’s ‘translate-proofr’ user groups.

Upload process[edit]

The current steps within the upload process are:

  1. Metadata detection
  2. Metadata mapping
  3. Batch preview
  4. Batch job creation
GWToolset Upload Process.png

Application entry[edit]

Further detail on application entry into the extension.


Further detail on each of the main handlers used within the application:


Further detail on each of the jobs used within the application:

See also[edit]