Source code & patches

From Wikisphere
Jump to navigation Jump to search

MediaWiki and its ecosystem are great software, however they are not always fitted for a professional use (or for the specific approach envisaged by WikiSphere).

Here are a number of patches both to some core files of MediaWiki (mainly to support the upload of files under page and sub-pages), and to some key-extensions as well, typically with the aim to complete and refine their set of features.

All the patches concern the latest stable version of Mediawiki (1.36) and the corresponding version of the extensions, if you want to use one or more of them (some of them could be correlated, so it is recommended to install them as they are grouped below) just copy the entire file content following the related link, do a copy of the existing files on your wiki, and replace them !



Mediawiki[edit | edit source]

MediaWiki_1.36


Installation[edit | edit source]


file edits
maintenance/install.php (added feature) added options "additionaldb" to allow creation of additional databases without replacing exiting LocalSettings.php
includes/installer/CliInstaller.php (added feature) implemented the option above


Skins[edit | edit source]

file edits
includes/skins/SkinTemplate.php (added feature) adds class "mw-content_model-" + contentModel in order to correctly display plain text on html pages



Files/Upload[edit | edit source]

file edits
LocalSettings.php $wgUseInstantCommons = false;

$wgIllegalFileChars = ":\\\\";

$wgHashedUploadDirectory = false;

$wgWikisphereUploadDisableWarnings = true;

$wgUploadPath = "{$wgScriptPath}/media";

$wgUploadDirectory = "{$IP}/media/" . $domain;

includes/GlobalFunctions.php support for path (page/subpage) in the filename
includes/filerepo/file/File.php support for path (page/subpage) in the filename
includes/upload/UploadBase.php
  • support for path (page/subpage) in the filename
  • disable "was-deleted", "duplicate" and "duplicate-archive" warnings
includes/upload/UploadFromStash.php support for path (page/subpage) in the filename
includes/upload/UploadFromFile.php support for path (page/subpage) in the filename
includes/api/ApiUpload.php support for path (page/subpage) in the filename
img_auth.php


Page deleted[edit | edit source]

file edits
includes/page/Article.php (added feature) on article deletion, it adds a link towards the parent page if existing


MsUpload[edit | edit source]

Extension:MsUpload

Uploaded files will be saved under the edited page, eg. My page/my_picture.jpg

file edits
Source code & patches/extensions/MsUpload/resources/MsUpload.js
  • (added feature) internal path property to upload files under the same page
  • (added feature) adds template wikisphere pdf thumbnail to pdf files


PageForms[edit | edit source]

Extension:Page_Forms

file edits
extensions/PageForms/includes/PF_AutoeditAPI.php
  • (fixed) the "one-step_process" described here overwrites the page if exists, which is not the expected behavior
  • (added feature) added hook "PageForms::WritePageDataOptions"
  • (added feature) added hook "PageForms::FormCreatedSuccess"
extensions/PageForms/includes/PF_FormPrinter.php
  • (added feature) Combobox legacy (class "WSComboBoxInput")
  • (added feature) if a form's field is not included in the template, is used to process the form (for instance for the pagename formula) but it's not saved in the template itself
  • (added feature) the pagename formula can contain day, month and year of a date field, also independently, for instance using <template name[Date][year]>
  • (added feature) added hidden input "WSUniqueCode" in order to save the images uploaded under a specific page, in a temporary page, and them to move back the references through the hooks "PageForms::WritePageDataOptions" and "PageForms::FormCreatedSuccess"
extensions/PageForms/includes/forminputs/PF_TreeInput.php
  • (added feature) "output format" parameter (can be "list" or "tree", "tree" the selected options will be saved in wikitext-style bullets and then merged on form edit)
  • (added feature) "three state" parameter (can be true or false)
  • (added feature) "cascade" parameter (can be "none" or any combination of "up+down+undetermined")
  • (added feature) "height" and "width" parameter (can be percentage or "auto")
  • (added feature) "hideroot" parameter (to remove the root node)
extensions/PageForms/includes/forminputs/PF_Tree.php (see above)
extensions/PageForms/includes/forminputs/WS_ComboBoxInput.php
  • (added feature) input type=combobox legacy Combobox based on Select2.js (besides the new PageForms's combobox based on OOUI TextInputWidget with autocomplete)
  • (added feature) parameter "update page query on change" to reload the page when the value of the select changes, see here
extensions/PageForms/libs/ext.pf.select2.base.js (fixed, but to review for general use) the scripts added an empty item as the first option and that was not always the expected behavior
extensions/PageForms/libs/ext.pf.select2.combobox.js
  • (added feature) "data_reload" (to be used with "combobox legacy", parameter "update page query on change"
  • (fixed, but to review for general use) the scripts added twice the selected item when is taken from the url query parameter
extensions/PageForms/includes/parserfunctions/PF_FormLink.php (added feature) parameter "class" in form link button template
extensions/PageForms/includes/forminputs/PF_OpenLayersInput.php
  • (added feature) parameter "label"
  • (added feature) parameter "coordinates hidden"
to-do[edit | edit source]
  • PageForms does not handle correctly selects with mapped values, as described here, specifically, instead than allowing options of kind value => label (where the label is visible to the user, and the value the one handled by the form) it only allows options like label => label, and the issue appears both server and client side


SemanticMediaWiki[edit | edit source]


file edits
extensions/SemanticMediaWiki/src/ParserData.php See here https://github.com/SemanticMediaWiki/SemanticMediaWiki/issues/4907 The semantic properties were not always updated on page save


SemanticExtraSpecialProperties[edit | edit source]

Extension:Semantic_Extra_Special_Properties

file edits
extensions/SemanticExtraSpecialProperties/data/definitions.json commented the alias exif-artist, which causes a conflict with the property:Author, becoming non UserAnnotable


Scribunto / PageExchange[edit | edit source]

The following edits are necessary to correctly import modules (page content model "Scribunto") through the extension Page_Exchange. (See for instance this package).

file edits
extensions/Scribunto/includes/common/Hooks.php (fixed) the function implementing the hook "oncontentHandlerDefaultModelFor" returned true instead than false (false stops the process to determine the page's content model)
extensions/PageExchange/includes/PXCreatePageJob.php (fixed) added ScribuntoContent for pages with namespace NS_MODULE