use MediaWiki\EditPage\TextConflictHelper;
use MediaWiki\Logger\LoggerFactory;
use MediaWiki\MediaWikiServices;
-use MediaWiki\Storage\RevisionRecord;
+use MediaWiki\Revision\RevisionRecord;
use Wikimedia\ScopedCallback;
/**
$out->showErrorPage(
'modeleditnotsupported-title',
'modeleditnotsupported-text',
- $modelName
+ [ $modelName ]
);
return false;
}
/**
* @param Content|null $def_content The default value to return
*
- * @return Content|null Content on success, $def_content for invalid sections
+ * @return Content|false|null Content on success, $def_content for invalid sections
*
* @since 1.21
*/
protected function getContentObject( $def_content = null ) {
+ global $wgDisableAnonTalk;
+
$content = false;
$user = $this->context->getUser();
$undo
)->inContentLanguage()->text();
} else {
+ $undoMessage = ( $undorev->getUser() === 0 && $wgDisableAnonTalk ) ?
+ 'undo-summary-anon' :
+ 'undo-summary';
$undoSummary = $this->context->msg(
- 'undo-summary',
+ $undoMessage,
$undo,
$userText
)->inContentLanguage()->text();
case self::AS_CANNOT_USE_CUSTOM_MODEL:
case self::AS_PARSE_ERROR:
case self::AS_UNICODE_NOT_SUPPORTED:
- $out->wrapWikiTextAsInterface( 'error', $status->getWikiText() );
+ $out->wrapWikiTextAsInterface( 'error',
+ $status->getWikiText( false, false, $this->context->getLanguage() )
+ );
return true;
case self::AS_SUCCESS_NEW_ARTICLE:
// is if an extension hook aborted from inside ArticleSave.
// Render the status object into $this->hookError
// FIXME this sucks, we should just use the Status object throughout
- $this->hookError = '<div class="error">' . "\n" . $status->getWikiText() .
+ $this->hookError = '<div class="error">' . "\n" .
+ $status->getWikiText( false, false, $this->context->getLanguage() ) .
'</div>';
return true;
}
} elseif ( !$status->isOK() ) {
# ...or the hook could be expecting us to produce an error
// FIXME this sucks, we should just use the Status object throughout
+ if ( !$status->getErrors() ) {
+ // Provide a fallback error message if none was set
+ $status->fatal( 'hookaborted' );
+ }
$this->hookError = $this->formatStatusErrors( $status );
- $status->fatal( 'hookaborted' );
$status->value = self::AS_HOOK_ERROR_EXPECTED;
return false;
}
* content.
*
* @param Content|null|bool|string $content
- * @return string The editable text form of the content.
+ * @return string|false|null The editable text form of the content.
*
* @throws MWException If $content is not an instance of TextContent and
* $this->allowNonTextContent is not true.
if ( $this->isConflict ) {
$conflict = Html::rawElement(
- 'h2', [ 'id' => 'mw-previewconflict' ],
+ 'div', [ 'id' => 'mw-previewconflict', 'class' => 'warningbox' ],
$this->context->msg( 'previewconflict' )->escaped()
);
} else {
- $conflict = '<hr />';
+ $conflict = '';
}
$previewhead = Html::rawElement(
'h2', [ 'id' => 'mw-previewheader' ],
$this->context->msg( 'preview' )->escaped()
) .
- $out->parseAsInterface( $note ) . $conflict
+ Html::rawElement( 'div', [ 'class' => 'warningbox' ],
+ $out->parseAsInterface( $note )
+ ) . $conflict
);
$pageViewLang = $this->mTitle->getPageViewLanguage();
* - 'legacy-name' (optional): short name for backwards-compatibility
* @param array $checked Array of checkbox name (matching the 'legacy-name') => bool,
* where bool indicates the checked status of the checkbox
- * @return array
+ * @return array[]
*/
public function getCheckboxesDefinition( $checked ) {
$checkboxes = [];