Skip to content

Commit

Permalink
Update SAR revision usage with MW's MCR
Browse files Browse the repository at this point in the history
At least, a first step in that direction.

See wikimedia/mediawiki#6af796f3e0cf3e66cd7d7e59af8445f5712d68fe

Fixes SemanticMediaWiki#24
  • Loading branch information
hexmode committed Nov 12, 2021
1 parent 8e30af0 commit 97a6e9e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Hooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace SMW\ApprovedRevs;

use MediaWiki\MediaWikiServices;
use MediaWiki\Revision\RevisionStoreRecord;
use Onoi\Cache\Cache;
use SMW\ApplicationFactory;

Expand Down Expand Up @@ -165,15 +166,19 @@ public function onIsApprovedRevision( $title, $latestRevID ) {
* @since 1.0
*
* @param Title $title
* @param Revision|null &$revision
* @param ?Revision $revision
*/
public function onChangeRevision( $title, &$revision ) {
public function onChangeRevision( $title, ?Revision $revision ) {

$approvedRevsHandler = new ApprovedRevsHandler(
new ApprovedRevsFacade()
);

$approvedRevsHandler->doChangeRevision( $title, $revision );
$record = null;
if ( $revision !== null ) {
$record = $revision->getRevisionRecord();
}
$approvedRevsHandler->doChangeRevision( $title, $record );

return true;
}
Expand Down

0 comments on commit 97a6e9e

Please sign in to comment.