* @param string $format Output format, valid values are any function of a Message object
* @return string
*/
- public static function getCopyrightWarning( $title, $format = 'plain' ) {
+ public static function getCopyrightWarning( $title, $format = 'plain', $langcode = null ) {
global $wgRightsText;
if ( $wgRightsText ) {
$copywarnMsg = [ 'copyrightwarning',
// Allow for site and per-namespace customization of contribution/copyright notice.
Hooks::run( 'EditPageCopyrightWarning', [ $title, &$copywarnMsg ] );
+ $msg = call_user_func_array( 'wfMessage', $copywarnMsg )->title( $title );
+ if ( $langcode ) {
+ $msg->inLanguage( $langcode );
+ }
return "<div id=\"editpage-copywarn\">\n" .
- call_user_func_array( 'wfMessage', $copywarnMsg )->title( $title )->$format() . "\n</div>";
+ $msg->$format() . "\n</div>";
}
/**
protected function safeUnicodeOutput( $text ) {
return $this->checkUnicodeCompliantBrowser()
? $text
- : $this->makesafe( $text );
+ : $this->makeSafe( $text );
}
/**
$status = $newpage->doDeleteArticleReal(
$overwriteMessage,
/* $suppress */ false,
- $nt->getArticleId(),
+ $nt->getArticleID(),
/* $commit */ false,
$errs,
$user
* @return array
*/
public function formatAuthenticationResponse( AuthenticationResponse $res ) {
- $params = $this->module->extractRequestParams();
-
$ret = [
'status' => $res->status,
];
*/
private function getFlags( $report ) {
$reportOnly = $this->getParameter( 'reportonly' );
- $userAgent = $this->getRequest()->getHeader( 'user-agent' );
$source = $this->getParameter( 'source' );
$falsePositives = $this->getConfig()->get( 'CSPFalsePositiveUrls' );
* @file
*/
-use MediaWiki\MediaWikiServices;
-
/**
* Query module to perform full text search within wiki titles and content
*
$vals = [
'namespace' => $result->getInterwikiNamespaceText(),
'title' => $title->getText(),
- 'url' => $title->getFullUrl(),
+ 'url' => $title->getFullURL(),
];
// Add item to results and see whether it fits
/**
* @codeCoverageIgnore
+ * @param array $data
+ * @return AuthenticationRequest|static
*/
public static function __set_state( $data ) {
if ( !isset( $data['label'] ) ) {
/**
* @codeCoverageIgnore
+ * @param array $data
+ * @return AuthenticationRequest|static
*/
public static function __set_state( $data ) {
$ret = new static( $data['domainList'] );
/**
* Try to reset the password
+ * @param \User $user
* @param AuthenticationRequest[] $reqs
* @return AuthenticationResponse
*/
}
$status = $this->checkPasswordValidity( $username, $req->password );
- if ( !$status->isOk() ) {
+ if ( !$status->isOK() ) {
// Fatal, can't log in
return AuthenticationResponse::newFail( $status->getMessage() );
}
<?php
use HtmlFormatter\HtmlFormatter;
-use MediaWiki\Logger\LoggerFactory;
/**
* Class allowing to explore structure of parsed wikitext.
* @file
*/
use Liuggio\StatsdClient\Factory\StatsdDataFactory;
-use MediaWiki\MediaWikiServices;
/**
* The simplest way of implementing IContextSource is to hold a RequestContext as a
$this->mScrollableCursor = false;
try {
- $ret = $this->query( $sql );
+ $this->query( $sql );
} catch ( Exception $e ) {
$this->mScrollableCursor = true;
throw $e;
} else {
// Show any custom GUI message before the details
if ( $e instanceof MessageSpecifier ) {
- $wgOut->addHtml( Message::newFromSpecifier( $e )->escaped() );
+ $wgOut->addHTML( Message::newFromSpecifier( $e )->escaped() );
}
$wgOut->addHTML( self::getHTML( $e ) );
}
*/
private function getInstance( $prefix ) {
if ( !isset( $this->instances[$prefix] ) ) {
- throw new RunTimeException( "No service registered at prefix '{$prefix}'." );
+ throw new RuntimeException( "No service registered at prefix '{$prefix}'." );
}
if ( !( $this->instances[$prefix] instanceof VirtualRESTService ) ) {
return '';
}
$html = '';
- $html .= xml::label( wfMessage( 'log-action-filter-' . $types[0] )->text(),
+ $html .= Xml::label( wfMessage( 'log-action-filter-' . $types[0] )->text(),
'action-filter-' .$types[0] ) . "\n";
$select = new XmlSelect( 'subtype' );
$select->addOption( wfMessage( 'log-action-filter-all' )->text(), '' );
$select->addOption( wfMessage( $msgKey )->text(), $value );
}
$select->setDefault( $action );
- $html .= $select->getHtml();
+ $html .= $select->getHTML();
return $html;
}
*/
protected function transformImageMagickExt( $image, $params ) {
global $wgSharpenReductionThreshold, $wgSharpenParameter, $wgMaxAnimatedGifArea,
- $wgMaxInterlacingAreas, $wgJpegPixelFormat;
+ $wgJpegPixelFormat;
try {
$im = new Imagick();
protected $mProfiler;
/**
- * @var \MediaWiki\Linker\LinkRenderer
+ * @var LinkRenderer
*/
protected $mLinkRenderer;
}
/**
- * Get a \MediaWiki\Linker\LinkRenderer instance to make links with
+ * Get a LinkRenderer instance to make links with
*
* @since 1.28
- * @return \MediaWiki\Linker\LinkRenderer
+ * @return LinkRenderer
*/
public function getLinkRenderer() {
if ( !$this->mLinkRenderer ) {
* Change the form descriptor that determines how a field will look in the authentication form.
* Called from fieldInfoToFormDescriptor().
* @param AuthenticationRequest[] $requests
- * @param string $fieldInfo Field information array (union of all
+ * @param array $fieldInfo Field information array (union of all
* AuthenticationRequest::getFieldInfo() responses).
* @param array $formDescriptor HTMLForm descriptor. The special key 'weight' can be set to
* change the order of the fields.
/**
* Return custom message key.
* Allows subclasses to customize messages.
+ * @param string $defaultKey
* @return string
*/
protected function messageKey( $defaultKey ) {
* Maps an authentication field configuration for a single field (as returned by
* AuthenticationRequest::getFieldInfo()) to a HTMLForm field descriptor.
* @param array $singleFieldInfo
+ * @param string $fieldName
* @return array
*/
protected static function mapSingleFieldInfo( $singleFieldInfo, $fieldName ) {
$session->remove( 'specialPreferencesSaveSuccess' );
$out->addModuleStyles( 'mediawiki.notification.convertmessagebox.styles' );
- $out->addHtml(
+ $out->addHTML(
Html::rawElement(
'div',
[
'high' => 'MAX( cl_timestamp )'
],
[
- 'cl_to' => $this->category->getDBKey(),
+ 'cl_to' => $this->category->getDBkey(),
],
__METHOD__,
[
if ( $request->getCheck( 'success' ) && $this->mFetchedUser !== null ) {
$out->addModules( [ 'mediawiki.special.userrights' ] );
$out->addModuleStyles( 'mediawiki.notification.convertmessagebox.styles' );
- $out->addHtml(
+ $out->addHTML(
Html::rawElement(
'div',
[
$this->config['tidyCompat'] && !$isComment &&
$this->currentNode->isA( BalanceSets::$tidyPWrapSet )
) {
- $this->insertHTMLELement( 'mw:p-wrap', [] );
+ $this->insertHTMLElement( 'mw:p-wrap', [] );
return $this->insertText( $value );
} else {
$this->currentNode->appendChild( $value );
} else {
$where = [];
}
- $i = 0;
$this->output( "Removing empty categories without description pages...\n" );
while ( true ) {
$user = $dbw->tableName( 'user' );
$revision = $dbw->tableName( 'revision' );
- $dbver = $dbw->getServerVersion();
-
// Autodetect mode...
if ( $this->hasOption( 'background' ) ) {
$backgroundMode = true;
$blockEnd = $start + $this->mBatchSize - 1;
$dbw = $this->getDB( DB_MASTER );
- $mainContext = RequestContext::getMain();
// Go through each page and save the output
while ( $blockEnd <= $end ) {
// Get the pages