gplx/mediawiki/extensions/SemanticMediaWiki/docs/technical/hooks/hook.revisionguard.changere...

996 B

  • Since: 3.1
  • Description: Hook allows to forcibly change a revision used during content parsing as in case of the UpdateJob execution or when running rebuildData.php.
  • Reference class: RevisionGuard.php

If you do alter a revision, please log the event and make it visible to a user (or administrator) that it was changed.

Signature

use MediaWiki\MediaWikiServices;

MediaWikiServices::getInstance()->getHookContainer()->register( 'SMW::RevisionGuard::ChangeRevision', function( $title, &$revision ) {

	// Set a revision
	// $revisionLookup = \MediaWiki\MediaWikiServices::getInstance()->getRevisionLookup();
	// $revision = $revisionLookup->getRevisionById( $id );

	return true;
} );

See also