Special:ChangeContentModel allows for users with the 'editcontentmodel' right to change the content model of a page. Visiting Special:ChangeContentModel will contain an input field for a page title. The user will then be sent to Special:ChangeContentModel?pagetitle=<input> where the page title is read only, with a content model selector and optional reason field. The special page only allows converting between content models that extend TextContent for simplicity. Advanced conversions should be done via the API. All content model changes via the special page or API generate a null revision in the page history and a log entry at Special:Log/contentmodel. The log entry has a revert link for convenience (like the move log). Bug: T72592 Co-Authored-By: Lewis Cawte <lewis@lewiscawte.me> Change-Id: I296a67c09fcbc880c8c3a648eb5086580725ea46
34 lines
1.1 KiB
PHP
34 lines
1.1 KiB
PHP
<?php
|
|
|
|
class ContentModelLogFormatter extends LogFormatter {
|
|
protected function getMessageParameters() {
|
|
$lang = $this->context->getLanguage();
|
|
$params = parent::getMessageParameters();
|
|
$params[3] = ContentHandler::getLocalizedName( $params[3], $lang );
|
|
$params[4] = ContentHandler::getLocalizedName( $params[4], $lang );
|
|
return $params;
|
|
}
|
|
|
|
public function getActionLinks() {
|
|
if ( $this->entry->isDeleted( LogPage::DELETED_ACTION ) // Action is hidden
|
|
|| $this->entry->getSubtype() !== 'change'
|
|
|| !$this->context->getUser()->isAllowed( 'editcontentmodel' )
|
|
) {
|
|
return '';
|
|
}
|
|
|
|
$params = $this->extractParameters();
|
|
$revert = Linker::linkKnown(
|
|
SpecialPage::getTitleFor( 'ChangeContentModel' ),
|
|
$this->msg( 'logentry-contentmodel-change-revertlink' )->escaped(),
|
|
array(),
|
|
array(
|
|
'pagetitle' => $this->entry->getTarget()->getPrefixedText(),
|
|
'model' => $params[3],
|
|
'reason' => $this->msg( 'logentry-contentmodel-change-revert' )->inContentLanguage()->text(),
|
|
)
|
|
);
|
|
|
|
return $this->msg( 'parentheses' )->rawParams( $revert )->escaped();
|
|
}
|
|
}
|