Extension:GWToolset/Technical Implementation
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 concernsEdit
Code conventionsEdit
GWToolset attempts, as much as possible, to adhere to MediaWiki Code conventions. Below are a few code conventions mentioned for clarity.
objectsEdit
# upper camel case
$SpecialPage
primitive data types and arraysEdit
# snake_case, lower case with _ separator
$user_options
class methodsEdit
# lower camel case
processRequest()
doc blocksEdit
# 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 namespaceEdit
GWToolset uses a PHP namespace in order to prevent conflicts with other code within the MediaWiki global namespace; the root namespace is \GWToolset
.
MediaWiki namespaceEdit
GWToolset defines two $wgExtraNamespaces
.
GWToolset | |||
---|---|---|---|
ID | Name | Constant | Remark |
490 | GWToolset: | NS_GWTOOLSET | |
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.
ConfigurationEdit
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 requirementEdit
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 processEdit
The current steps within the upload process are:
Application entryEdit
Further detail on application entry into the extension.
HandlersEdit
Further detail on each of the main handlers used within the application:
JobsEdit
Further detail on each of the jobs used within the application: