Extension:GWToolset/Technical Implementation

From MediaWiki.org
Jump to: navigation, search

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, co-funded by Europeana and a few Wikimedia chapters[1], is under heavy development.

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 | edit source]

§Code conventions[edit | edit source]

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

§objects[edit | edit source]

# upper camel case

§primitive data types and arrays[edit | edit source]

# snake_case, lower case with _ separator

§class methods[edit | edit source]

# lower camel case

§doc blocks[edit | edit source]

# 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 | edit source]

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 | edit source]

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.

§Configuration[edit | edit source]

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 | edit source]

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 | edit source]

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 | edit source]

Further detail on application entry into the extension.

§Handlers[edit | edit source]

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

§Jobs[edit | edit source]

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

§See also[edit | edit source]

§References[edit | edit source]

  1. Wikimedia UK, Wikimedia Netherland, Wikimedia France, Wikimedia Swizterland