Wiki:Module/1530870565

From cm2.liecourt.com
< Modules
Revision as of 19:24, 13 May 2020 by Maintenance script (talk | contribs) (Fill database)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Installing this module on a new wiki:

Steps required for each wiki in a farm:

  • Import the list of pages belonging to this module
  • Run a rebuilddata to refresh properties set by Template:Managed, since pages using the template might have been imported before the property pages were. Example command:
full rebuilddata
SERVER_NAME=i.wikibase.nl php public_html/extensions/SemanticMediaWiki/maintenance/rebuildData.php

partial rebuilddata (might be useful on existing wikis with many pages): pages modified at or later than specified date, with date format yyyy-mm-dd
SERVER_NAME=i.wikibase.nl php public_html/extensions/SemanticMediaWiki/maintenance/rebuildData.php --query='[[Modification date::>2019-08-09]]'
  • Add the following to the **MediaWiki:Common.js** page, so the .js files from the module folder will be loaded when necessary:
/***** WSForm: loading Select2 ****/

  if ($('select[data-inputtype="ws-select2"]')[0]) {
    mw.loader.load('/extensions/WSForm/select2.min.css', 'text/css');
    $.getScript('/extensions/WSForm/select2.min.js').done(function() {
      $('select[data-inputtype="ws-select2"]').each(function() {
        var selectid = $(this).attr('id');
        var selectoptionsid = 'select2options-' + selectid;
        var select2config = $("input#" + selectoptionsid).val();
        var F = new Function(select2config);
        return (F());
      });
    });
  }

/* End of WSForm: Select2 */

/* ***** Loading multipleInstanceTemplates and WSShowOnSelect ***** */
	if ($('.WSmultipleTemplateWrapper') && !$('.WSShowOnSelect')) {
		$.getScript('/wikis/modules/wsbasics/multipleInstanceTemplates.js');
	}
	
if ($('.WSShowOnSelect') && !$('.WSmultipleTemplateWrapper')) {
	$.getScript('https://i.wikibase.nl/wikis/modules/wsbasics/WSShowOnSelect.js').done(function() {
		WsShowOnSelect();
	});
}

if ( $('.WSShowOnSelect') && $('.WSmultipleTemplateWrapper')) {
	$.getScript('https://i.wikibase.nl/wikis/modules/wsbasics/WSShowOnSelect.js').done(function() {
		WsShowOnSelect();
		$.getScript('/wikis/modules/wsbasics/multipleInstanceTemplates.js').done(function() {
			WsShowOnSelect();
		});
	});
}
/* ----- end of Loading multipleInstanceTemplates and WSShowOnSelect ----- */

Steps required only once per farm:

  • Copy the module folder from the WS1 farm, it's located at **public_html/wikis/modules/wsbasics**
  • Get **wsbasics.less** and **wsform.less** from the WS1 farm, in the folder **public_html/wikis/skin/less**
  • Add the following setting to **CommonSettings.php**":
# Add messages for all wikis 
$wgMessagesDirs['WsBasics'][] = "$IP/wikis/modules/wsbasics/i18n";


Note: Installing this module on existing wikis:

On a new wiki, simply import the entire list of pages.

If you need this module on an existing wiki, for example because you are installing another module (like the Document Workbench), which uses some pages from this module, you have to be a bit more careful:

  • First check if pages from this module already exist on the target wiki. You could use this arraymap on a test page (add the entire list of pages to the arraymap), the pages that do not exist yet will be red links:
{{#arraymap:

Template:Item responsive
Template:Managed
Template:Modal

|\n|@@@|[[@@@ |@@@]]|<br>}}
  • If there are very few existing pages (i.e. the ones that are not red), check these manually and compare the version on the target wiki to the one from this module. If they are very similar and replacing it with the page from this module won't cause any issues, do that.
  • Import the pages from this module that do not exist on the other wiki yet. You could use this arraymap to get the list of pages that do not exist yet:
{{#arraymap:

Template:Item responsive
Template:Managed
Template:Modal

|\n|@@@|{{#ifexist:@@@||[[@@@ |@@@]] }}|<br>}}
  • Test stuff to find out if everything you needed this module for now works
  • If there are still pages that you cannot replace, but you do really need the version from this module, consider renaming the page on the target wiki (with templates, do a replace text to replace it everywhere it's used)