Maintenance script "populate­Hash­Field.php"

From semantic-mediawiki.org
populateHashField.php
Allows to do mass populating of database field "smw_hash" when initially upgrading to Semantic MediaWiki 3.0.1 and later
Further Information
Provided by: Semantic MediaWiki
Added: 3.0.1
Removed: still in use
Location (path): ./extensions/SemanticMediaWiki/maintenance/
Table of Contents

The "populateHashField.php" maintenance script allows mass conversions of database field "smw_hash" in the "smw_objects_ids" database table when initially upgrading to Semantic MediaWiki 3.0.1Released on 25 January 2019 and compatible with MW 1.27.0 - 1.31.x. or later and only has to be run once. As soon as you have successfully upgraded it will no longer be necessary to use it. The maintenance script was introduced in Semantic MediaWiki 3.0.1Released on 25 January 2019 and compatible with MW 1.27.0 - 1.31.x..1

Rationale[edit]

During an upgrade to Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x. and later some elements of the database table may require to be updated and pending its importance it has to happen before any access to that table occurs. However due to the sheer size of the "smw_objects_ids" database table the update of database field "smw_hash" could hog resources making maintenance script "update.php" (MediaWiki.org) or alternatively maintenance script "setupStore.php"Allows to set up the data backend/store run for a considerable time.

To mitigate this the initial update of database field "smw_hash"2 which only happens once when initially switching to Semantic MediaWiki 3.0.0Released on 11 October 2018 and compatible with MW 1.27.0 - 1.31.x. and later will be executed with a set threshold of 200,000 database table rows (meaning missing converted rows) for the conversion during the normal usage of "update.php" or alternatively "setupStore.php" to allow system administrators to quickly run the upgrade. Hereafter the process is postponed and the status "false" is saved to the "populate.smw_hash_field_complete" field in the setup information file ".smw.json". At the same time a message as described on the help page on upgrading will start to appear on every wiki page to remind users and system administrators that the upgrade has not finished yet and requires immediate action, i.e. running this "populateHashField.php" upgrade script to complete populating of database field "smw_hash" in the "smw_objects_ids" database table.

Once "populateHashField.php" was run as a follow up to "update.php" or alternatively "setupStore.php" the status of the "populate.smw_hash_field_complete" field is being updated to "true" in the setup information file ".smw.json". Thus the upgrade is completed and the error message will no longer appear on wiki pages.

Usage[edit]

php populateHashField.php

Parameters[edit]

Maintenance scripts provide generic maintenance parameters, script dependent parameters and depending on the maintenance script script specific parameters which are described on this page if provided.

This script does not provide any script specific parameters.

Example[edit]

The following command populates the "smw_hash" field in the "smw_objects_ids" database table
php populateHashField.php
Checking smw_hash field consistency ...
   ... all rows populated ...

   ... writing the upgrade file ... 
   ... done.

See also[edit]


References

  1. ^  Semantic MediaWiki: GitHub pull request gh:smw:3611
  2. ^  Semantic MediaWiki: GitHub pull request gh:smw:3080