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

MediaWiki_1.36


Installation


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

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

file edits
LocalSettings.php $wgUseInstantCommons = false;

$wgIllegalFileChars = ":\\\\";

$wgHashedUploadDirectory = false;

$wgWikisphereUploadDisableWarnings = true;

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

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

includes/GlobalFunctions.php support for path (page/subpage) in file names
includes/filerepo/file/File.php support for path (page/subpage) in file names
includes/upload/UploadBase.php
  • support for path (page/subpage) in file names
  • disable "was-deleted", "duplicate", "duplicate-archive" and "bad-prefix" warnings
includes/upload/UploadFromStash.php support for path (page/subpage) in file names
includes/upload/UploadFromFile.php support for path (page/subpage) in file names
includes/api/ApiUpload.php support for path (page/subpage) in file names
img_auth.php display images with path
resources/src/mediawiki.util/util.js support for images with path in MultimediaViewer
resources/src/mediawiki.Upload.BookletLayout/BookletLayout.js allow uploading a file under the current page from VisualEditor
resources/src/mediawiki.ForeignStructuredUpload.BookletLayout/BookletLayout.js show checkbox "Upload under current page" in VisualEditor's file upload
resources/Resources.php added label key "upload-form-label-own-work-custom"
resources/src/mediawiki.api/upload.js allow uploading a file under the current page from VisualEditor


Page deleted

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


MsUpload

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

Extension:Page_Forms

file edits
extensions/PageForms/libs/PF_simpleupload.js (added feature) support for uploading a picture under the current page
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
  • 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


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
extensions/SemanticMediaWiki/src/Query/ResultPrinters/ResultPrinter.php in the function "getFurtherResultsLink", limit and offset will be reset if limit is less than 20
extensions/SemanticMediaWiki/src/Factbox/Factbox.php populate Factbox using semantic properties from the store instead than from the parser


SemanticExtraSpecialProperties

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

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