[MediaWiki-commits] [Gerrit] mediawiki...Linter[master]: extensions/Linter: Replace deprecated usage of ApiBase::dieU...

2017-12-02 Thread Haikalizz (Code Review)
Haikalizz has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/394821 )

Change subject: extensions/Linter: Replace deprecated usage of 
ApiBase::dieUsage()
..

extensions/Linter: Replace deprecated usage of ApiBase::dieUsage()

Linter calls the deprecated ApiBase::dieUsage() function in
ApiRecordLint.php, replacing it with dieWithError().

Bug: T181758
Change-Id: I0cbf784f591b86b206b032fccbc0e32564a3e9e8
---
M includes/ApiRecordLint.php
1 file changed, 3 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Linter 
refs/changes/21/394821/1

diff --git a/includes/ApiRecordLint.php b/includes/ApiRecordLint.php
index c009f4f..bdcdb2a 100644
--- a/includes/ApiRecordLint.php
+++ b/includes/ApiRecordLint.php
@@ -40,15 +40,12 @@
array_keys( array_filter( $wgLinterSubmitterWhitelist ) 
)
);
if ( !$ipSet->match( $this->getRequest()->getIP() ) ) {
-   $this->dieUsage(
-   'Your IP address has not been whitelisted to 
report lint errors',
-   'invalid-ip'
-   );
+   $this->dieWithError( array('invalid-ip', 
wfEscapeWikiText('Your IP address has not been whitelisted to report lint 
errors')));
}
$params = $this->extractRequestParams();
$data = FormatJson::decode( $params['data'], true );
if ( !is_array( $data ) ) {
-   $this->dieUsage( 'Invalid data', 'invalid-data' );
+   $this->dieWithError( array('invalid-data', 
wfEscapeWikiText('Invalid data')));
}
 
$errors = [];
@@ -56,7 +53,7 @@
if ( !$title || !$title->getArticleID()
|| $title->getLatestRevID() != $params['revision']
) {
-   $this->dieUsage( 'Invalid, non-existent, or outdated 
title', 'invalid-title' );
+   $this->dieWithError( array('invalid-title', 
wfEscapeWikiText('Invalid, non-existent, or outdated title')));
}
$categoryMgr = new CategoryManager();
foreach ( $data as $info ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/394821
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0cbf784f591b86b206b032fccbc0e32564a3e9e8
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Linter
Gerrit-Branch: master
Gerrit-Owner: Haikalizz 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] mediawiki/core[master]: Replace usage of wfWaitForSlaves.

2017-12-01 Thread Haikalizz (Code Review)
Haikalizz has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/394537 )

Change subject: Replace usage of wfWaitForSlaves.
..

Replace usage of wfWaitForSlaves.

Fixes #T181673

Change-Id: I21adcc6076487356d1edd07c1b41c646b9363b62
---
M maintenance/archives/upgradeLogging.php
M maintenance/cleanupEmptyCategories.php
M maintenance/cleanupInvalidDbKeys.php
M maintenance/cleanupUploadStash.php
M maintenance/cleanupUsersWithNoId.php
M maintenance/convertUserOptions.php
M maintenance/deleteBatch.php
M maintenance/deleteDefaultMessages.php
M maintenance/deleteEqualMessages.php
M maintenance/deleteSelfExternals.php
M maintenance/fixDefaultJsonContentPages.php
M maintenance/fixExtLinksProtocolRelative.php
M maintenance/fixUserRegistration.php
M maintenance/importDump.php
M maintenance/importImages.php
M maintenance/initEditCount.php
M maintenance/makeTestEdits.php
M maintenance/migrateComments.php
M maintenance/migrateUserGroup.php
M maintenance/moveBatch.php
M maintenance/namespaceDupes.php
M maintenance/populateBacklinkNamespace.php
M maintenance/populateCategory.php
M maintenance/populateContentModel.php
M maintenance/populateFilearchiveSha1.php
M maintenance/populateImageSha1.php
M maintenance/populateLogSearch.php
M maintenance/populateLogUsertext.php
M maintenance/populateParentId.php
M maintenance/populateRecentChangesSource.php
M maintenance/populateRevisionLength.php
M maintenance/populateRevisionSha1.php
M maintenance/refreshImageMetadata.php
M maintenance/refreshLinks.php
M maintenance/removeInvalidEmails.php
M maintenance/resetUserTokens.php
M maintenance/runBatchedQuery.php
M maintenance/sql.php
M maintenance/storage/compressOld.php
M maintenance/storage/fixT22757.php
M maintenance/storage/moveToExternal.php
M maintenance/storage/resolveStubs.php
M maintenance/storage/trackBlobs.php
M maintenance/tidyUpBug37714.php
M maintenance/update.php
M maintenance/updateCollation.php
M maintenance/updateRestrictions.php
M maintenance/updateSpecialPages.php
48 files changed, 69 insertions(+), 69 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/37/394537/1

diff --git a/maintenance/archives/upgradeLogging.php 
b/maintenance/archives/upgradeLogging.php
index 13362e0..af2d866 100644
--- a/maintenance/archives/upgradeLogging.php
+++ b/maintenance/archives/upgradeLogging.php
@@ -175,7 +175,7 @@
$this->dbw->insert( $dstTable, $batch, __METHOD__ );
$numRowsCopied += count( $batch );
 
-   wfWaitForSlaves();
+   wfGetLBFactory()->waitForReplication();
}
echo "Copied $numRowsCopied rows\n";
}
diff --git a/maintenance/cleanupEmptyCategories.php 
b/maintenance/cleanupEmptyCategories.php
index 2d22704..4a052a2 100644
--- a/maintenance/cleanupEmptyCategories.php
+++ b/maintenance/cleanupEmptyCategories.php
@@ -134,7 +134,7 @@
}
$this->output( "--mode=$mode --begin=$name\n" );
 
-   wfWaitForSlaves();
+   wfGetLBFactory()->waitForReplication();
usleep( $throttle * 1000 );
}
 
@@ -188,7 +188,7 @@
 
$this->output( "--mode=remove --begin=$name\n" 
);
 
-   wfWaitForSlaves();
+   wfGetLBFactory()->waitForReplication();
usleep( $throttle * 1000 );
}
}
diff --git a/maintenance/cleanupInvalidDbKeys.php 
b/maintenance/cleanupInvalidDbKeys.php
index 569fd2b..47e7550 100644
--- a/maintenance/cleanupInvalidDbKeys.php
+++ b/maintenance/cleanupInvalidDbKeys.php
@@ -235,7 +235,7 @@
__METHOD__ );
$affectedRowCount += 
$dbw->affectedRows();
}
-   wfWaitForSlaves();
+   wfGetLBFactory()->waitForReplication();
$this->outputStatus( "Updated $affectedRowCount 
rows on $table.\n" );
 
break;
@@ -248,7 +248,7 @@
// recently, so we can just remove these rows.
$this->outputStatus( "Deleting invalid $table 
rows...\n" );
$dbw->delete( $table, [ $idField => $ids ], 
__METHOD__ );
-   wfWaitForSlaves();
+   wfGetLBFactory()->waitForReplication();
$this->outputStatus( 'Deleted ' . 
$dbw->affectedRows() . " rows from $table.\n" );
break;
 
@@ -264,7 +264,7 @@
__METHOD__ );
 

[MediaWiki-commits] [Gerrit] mediawiki/core[master]: GCI16: core: Use LinkRenderer instead of Linker:link()

2016-11-30 Thread Haikalizz (Code Review)
Haikalizz has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/324221

Change subject: GCI16: core: Use LinkRenderer instead of Linker:link()
..

GCI16: core: Use LinkRenderer instead of Linker:link()

Change-Id: Ie384566617f18ad6c3bf836b39702365d59f714d
---
M includes/actions/CreditsAction.php
M includes/actions/HistoryAction.php
M includes/actions/InfoAction.php
M includes/actions/MarkpatrolledAction.php
M includes/cache/CacheHelper.php
M includes/changetags/ChangeTagsLogItem.php
M includes/logging/BlockLogFormatter.php
M includes/logging/ContentModelLogFormatter.php
M includes/logging/DeleteLogFormatter.php
M includes/logging/LogEventsList.php
10 files changed, 72 insertions(+), 53 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/21/324221/1

diff --git a/includes/actions/CreditsAction.php 
b/includes/actions/CreditsAction.php
index 1332ab4..862d673 100644
--- a/includes/actions/CreditsAction.php
+++ b/includes/actions/CreditsAction.php
@@ -23,6 +23,8 @@
  * @author 
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * @ingroup Actions
  */
@@ -205,7 +207,7 @@
? SpecialPage::getTitleFor( 'Contributions', 
$user->getName() )
: $user->getUserPage();
 
-   return Linker::link( $page, htmlspecialchars( $real ? $real : 
$user->getName() ) );
+   return MediaWikiServices::getLinkRenderer()->makeLink( $page, 
$user->getName() );
}
 
/**
@@ -231,9 +233,9 @@
 * @return string HTML link
 */
protected function othersLink() {
-   return Linker::linkKnown(
+   return MediaWikiServices::getLinkRenderer()->makeKnownLink(
$this->getTitle(),
-   $this->msg( 'others' )->escaped(),
+   $this->msg( 'others' )->text(),
[],
[ 'action' => 'credits' ]
);
diff --git a/includes/actions/HistoryAction.php 
b/includes/actions/HistoryAction.php
index c1763fa..b637261 100644
--- a/includes/actions/HistoryAction.php
+++ b/includes/actions/HistoryAction.php
@@ -23,6 +23,8 @@
  * @ingroup Actions
  */
 
+use MediaWiki\MediaWikiServices;
+
 /**
  * This class handles printing the history page for an article. In order to
  * be efficient, it uses timestamps rather than offsets for paging, to avoid
@@ -58,9 +60,9 @@
 
protected function getDescription() {
// Creation of a subtitle link pointing to [[Special:Log]]
-   return Linker::linkKnown(
+   return MediaWikiServices::getLinkRenderer()->makeKnownLink(
SpecialPage::getTitleFor( 'Log' ),
-   $this->msg( 'viewpagelogs' )->escaped(),
+   $this->msg( 'viewpagelogs' )->text(),
[],
[ 'page' => $this->getTitle()->getPrefixedText() ]
);
@@ -734,9 +736,9 @@
$undoTooltip = $latest
? [ 'title' => $this->msg( 
'tooltip-undo' )->text() ]
: [];
-   $undolink = Linker::linkKnown(
+   $undolink = 
MediaWikiServices::getLinkRenderer()->makeKnownLink(
$this->getTitle(),
-   $this->msg( 'editundo' )->escaped(),
+   $this->msg( 'editundo' )->text(),
$undoTooltip,
[
'action' => 'edit',
@@ -790,7 +792,7 @@
$date = $this->getLanguage()->userTimeAndDate( 
$rev->getTimestamp(), $this->getUser() );
$date = htmlspecialchars( $date );
if ( $rev->userCan( Revision::DELETED_TEXT, $this->getUser() ) 
) {
-   $link = Linker::linkKnown(
+   $link = 
MediaWikiServices::getLinkRenderer()->makeKnownLink(
$this->getTitle(),
$date,
[ 'class' => 'mw-changeslist-date' ],
@@ -818,7 +820,7 @@
if ( $latest || !$rev->userCan( Revision::DELETED_TEXT, 
$this->getUser() ) ) {
return $cur;
} else {
-   return Linker::linkKnown(
+   return 
MediaWikiServices::getLinkRenderer()->makeKnownLink(
$this->getTitle(),
$cur,
[],
@@ -849,7 +851,7 @@
 
if ( $next === 'unknown' ) {
# Next row probably exists but is unknown, use an 
oldid=prev link
-   return Linke