jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/380133 )
Change subject: build: Updating mediawiki/mediawiki-codesniffer to 13.0.0
......................................................................
build: Updating mediawiki/mediawiki-codesniffer to 13.0.0
Change-Id: I6c4de36f8d960e4c4d8e08a63a4b3a40c4af2eae
---
M composer.json
M includes/ArticleStore.php
M includes/DYKBox.php
M includes/Events/EventStore.php
M includes/Extension.php
M includes/RoleObject.php
M includes/pagers/CoursePager.php
M includes/pagers/StudentActivityPager.php
M includes/pagers/StudentPager.php
M includes/rows/EPRevision.php
M includes/rows/Org.php
M includes/rows/RevisionedObject.php
M includes/specials/SpecialEducationProgram.php
M includes/specials/SpecialMyCourses.php
M includes/specials/SpecialStudentActivity.php
M includes/tables/Courses.php
M includes/tables/ORMTable.php
M maintenance/fixInvalidStudent.php
M maintenance/importWEPFromDB.php
M tests/phpunit/SpecialsTest.php
M tests/phpunit/UPCUserCourseFinderTest.php
21 files changed, 28 insertions(+), 30 deletions(-)
Approvals:
Umherirrender: Looks good to me, approved
jenkins-bot: Verified
diff --git a/composer.json b/composer.json
index 7898723..d980e06 100644
--- a/composer.json
+++ b/composer.json
@@ -1,7 +1,7 @@
{
"require-dev": {
"jakub-onderka/php-parallel-lint": "0.9.2",
- "mediawiki/mediawiki-codesniffer": "0.12.0",
+ "mediawiki/mediawiki-codesniffer": "13.0.0",
"jakub-onderka/php-console-highlighter": "0.3.2"
},
"scripts": {
diff --git a/includes/ArticleStore.php b/includes/ArticleStore.php
index 5202355..f08a676 100644
--- a/includes/ArticleStore.php
+++ b/includes/ArticleStore.php
@@ -53,7 +53,7 @@
* @param string $tableName
* @param int $readConnectionId
*/
- public function __construct( $tableName, $readConnectionId = DB_SLAVE )
{
+ public function __construct( $tableName, $readConnectionId = DB_REPLICA
) {
$this->readConnectionId = $readConnectionId;
$this->tableName = $tableName;
}
diff --git a/includes/DYKBox.php b/includes/DYKBox.php
index 25eb378..cf74a76 100644
--- a/includes/DYKBox.php
+++ b/includes/DYKBox.php
@@ -158,7 +158,7 @@
protected function getPageFromCategory( $categoryName ) {
global $wgContLang;
- $dbr = wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_REPLICA );
$randomFunction = $dbr->getType() === 'sqlite' ? 'RANDOM()' :
'RAND()';
diff --git a/includes/Events/EventStore.php b/includes/Events/EventStore.php
index 205bf04..507031e 100644
--- a/includes/Events/EventStore.php
+++ b/includes/Events/EventStore.php
@@ -58,7 +58,7 @@
* @param string $tableName
* @param int $readConnectionId
*/
- public function __construct( $tableName, $readConnectionId = DB_SLAVE )
{
+ public function __construct( $tableName, $readConnectionId = DB_REPLICA
) {
$this->tableName = $tableName;
$this->readConnectionId = $readConnectionId;
}
diff --git a/includes/Extension.php b/includes/Extension.php
index a7b6697..8a9f08a 100644
--- a/includes/Extension.php
+++ b/includes/Extension.php
@@ -91,7 +91,7 @@
* @return CourseStore
*/
public function newCourseStore() {
- return new CourseStore( 'ep_courses', wfGetDB( DB_SLAVE ) );
+ return new CourseStore( 'ep_courses', wfGetDB( DB_REPLICA ) );
}
/**
diff --git a/includes/RoleObject.php b/includes/RoleObject.php
index c8215d6..1e7810c 100644
--- a/includes/RoleObject.php
+++ b/includes/RoleObject.php
@@ -229,7 +229,7 @@
public function hasCourse( array $conditions = [] ) {
$courseTable = Courses::singleton();
- return wfGetDB( DB_SLAVE )->select(
+ return wfGetDB( DB_REPLICA )->select(
[ 'ep_courses', 'ep_users_per_course' ],
$courseTable->getPrefixedField( 'id' ),
array_merge( [
diff --git a/includes/pagers/CoursePager.php b/includes/pagers/CoursePager.php
index 64b0aee..64fa680 100644
--- a/includes/pagers/CoursePager.php
+++ b/includes/pagers/CoursePager.php
@@ -293,7 +293,7 @@
$conds = parent::getConditions();
if ( array_key_exists( 'status', $conds ) ) {
- $now = wfGetDB( DB_SLAVE )->addQuotes( wfTimestampNow()
);
+ $now = wfGetDB( DB_REPLICA )->addQuotes(
wfTimestampNow() );
switch ( $conds['status'] ) {
case 'current-planned':
diff --git a/includes/pagers/StudentActivityPager.php
b/includes/pagers/StudentActivityPager.php
index 46b3ec4..e53edba 100644
--- a/includes/pagers/StudentActivityPager.php
+++ b/includes/pagers/StudentActivityPager.php
@@ -191,7 +191,7 @@
}
if ( !empty( $userIds ) ) {
- $result = wfGetDB( DB_SLAVE )->select(
+ $result = wfGetDB( DB_REPLICA )->select(
'user',
[ 'user_id', 'user_name', 'user_real_name' ],
[ 'user_id' => $userIds ],
diff --git a/includes/pagers/StudentPager.php b/includes/pagers/StudentPager.php
index 0a6bb6d..3d45556 100644
--- a/includes/pagers/StudentPager.php
+++ b/includes/pagers/StudentPager.php
@@ -161,7 +161,7 @@
}
if ( !empty( $userIds ) ) {
- $result = wfGetDB( DB_SLAVE )->select(
+ $result = wfGetDB( DB_REPLICA )->select(
'user',
[ 'user_id', 'user_name', 'user_real_name' ],
[ 'user_id' => $userIds ],
@@ -175,7 +175,7 @@
$courseNameField =
Courses::singleton()->getPrefixedField( 'title' );
- $result = wfGetDB( DB_SLAVE )->select(
+ $result = wfGetDB( DB_REPLICA )->select(
[ 'ep_courses', 'ep_users_per_course' ],
[ $courseNameField, 'upc_user_id' ],
array_merge( [
diff --git a/includes/rows/EPRevision.php b/includes/rows/EPRevision.php
index c72cf99..134a1b5 100644
--- a/includes/rows/EPRevision.php
+++ b/includes/rows/EPRevision.php
@@ -117,7 +117,7 @@
*/
public function getPreviousRevision() {
return $this->getObject()->getLatestRevision( [
- 'id < ' . wfGetDB( DB_SLAVE )->addQuotes(
$this->getId() )
+ 'id < ' . wfGetDB( DB_REPLICA )->addQuotes(
$this->getId() )
] );
}
@@ -132,7 +132,7 @@
return !$this->table->has( [
'type' => $this->getField( 'type' ),
'object_id' => $this->getField( 'object_id' ),
- 'id > ' . wfGetDB( DB_SLAVE )->addQuotes(
$this->getId() )
+ 'id > ' . wfGetDB( DB_REPLICA )->addQuotes(
$this->getId() )
] );
}
diff --git a/includes/rows/Org.php b/includes/rows/Org.php
index 24cdc07..b2bd45f 100644
--- a/includes/rows/Org.php
+++ b/includes/rows/Org.php
@@ -181,7 +181,7 @@
$coursesTable->setReadDb( DB_MASTER );
$courses = $coursesTable->select( [ 'id', 'title' ], [
'org_id' => $this->getId() ] );
- $coursesTable->setReadDb( DB_SLAVE );
+ $coursesTable->setReadDb( DB_REPLICA );
/**
* @var Course $course
diff --git a/includes/rows/RevisionedObject.php
b/includes/rows/RevisionedObject.php
index 87a3316..4250866 100644
--- a/includes/rows/RevisionedObject.php
+++ b/includes/rows/RevisionedObject.php
@@ -146,7 +146,7 @@
if ( !$this->inSummaryMode ) {
$this->table->setReadDb( DB_MASTER );
$originalObject = $this->table->selectRow( null, [ 'id'
=> $this->getId() ] );
- $this->table->setReadDb( DB_SLAVE );
+ $this->table->setReadDb( DB_REPLICA );
if ( $originalObject === false ) {
return false;
diff --git a/includes/specials/SpecialEducationProgram.php
b/includes/specials/SpecialEducationProgram.php
index 9f7cdad..d5ebdc9 100644
--- a/includes/specials/SpecialEducationProgram.php
+++ b/includes/specials/SpecialEducationProgram.php
@@ -128,7 +128,7 @@
* @return int
*/
protected function getRoleCount( $roleId ) {
- $dbr = wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_REPLICA );
return $dbr->selectRow(
'ep_users_per_course',
@@ -371,7 +371,7 @@
* @return array
*/
protected function getGenders( array $userIds ) {
- $dbr = wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_REPLICA );
$users = $dbr->select(
'user_properties',
diff --git a/includes/specials/SpecialMyCourses.php
b/includes/specials/SpecialMyCourses.php
index b15dbe7..ddb16ed 100644
--- a/includes/specials/SpecialMyCourses.php
+++ b/includes/specials/SpecialMyCourses.php
@@ -77,7 +77,7 @@
* @since 0.1
*/
protected function fetchCourses() {
- $now = wfGetDB( DB_SLAVE )->addQuotes( wfTimestampNow() );
+ $now = wfGetDB( DB_REPLICA )->addQuotes( wfTimestampNow() );
$courses = Courses::singleton()->getCoursesForUsers(
$this->getUser()->getId(),
diff --git a/includes/specials/SpecialStudentActivity.php
b/includes/specials/SpecialStudentActivity.php
index 6ab00f1..eaa9f85 100644
--- a/includes/specials/SpecialStudentActivity.php
+++ b/includes/specials/SpecialStudentActivity.php
@@ -50,7 +50,7 @@
public function displayCachedContent() {
$duration = Settings::get( 'recentActivityLimit' );
- $conds = [ 'last_active > ' . wfGetDB( DB_SLAVE )->addQuotes(
+ $conds = [ 'last_active > ' . wfGetDB( DB_REPLICA )->addQuotes(
wfTimestamp( TS_MW, time() - $duration )
) ];
diff --git a/includes/tables/Courses.php b/includes/tables/Courses.php
index 625e7ac..1ef1086 100644
--- a/includes/tables/Courses.php
+++ b/includes/tables/Courses.php
@@ -148,11 +148,11 @@
}
public function hasActiveTitle( $courseTitle ) {
- $now = wfGetDB( DB_SLAVE )->addQuotes( wfTimestampNow() );
+ $now = wfGetDB( DB_REPLICA )->addQuotes( wfTimestampNow() );
// Course start and end dates are stored as the begin of the
day in UTC.
// To make sure courses end at the end of that day, compare the
end time
// with the current timestamp minus one day.
- $oneDayAgo = wfGetDB( DB_SLAVE )->addQuotes( wfTimestamp(
TS_MW, strtotime( "-1 day" ) ) );
+ $oneDayAgo = wfGetDB( DB_REPLICA )->addQuotes( wfTimestamp(
TS_MW, strtotime( "-1 day" ) ) );
return $this->has( [
'title' => $courseTitle,
@@ -221,11 +221,11 @@
* @return array
*/
public static function getStatusConds( $state, $prefix = false ) {
- $now = wfGetDB( DB_SLAVE )->addQuotes( wfTimestampNow() );
+ $now = wfGetDB( DB_REPLICA )->addQuotes( wfTimestampNow() );
// Course start and end dates are stored as the begin of the
day in UTC.
// To make sure courses end at the end of that day, compare the
end time
// with the current timestamp minus one day.
- $oneDayAgo = wfGetDB( DB_SLAVE )->addQuotes( wfTimestamp(
TS_MW, strtotime( "-1 day" ) ) );
+ $oneDayAgo = wfGetDB( DB_REPLICA )->addQuotes( wfTimestamp(
TS_MW, strtotime( "-1 day" ) ) );
$conditions = [];
@@ -281,7 +281,7 @@
$options[] = 'DISTINCT';
- $courses = wfGetDB( DB_SLAVE )->select(
+ $courses = wfGetDB( DB_REPLICA )->select(
[ 'ep_courses', 'ep_users_per_course' ],
$this->getPrefixedFields( is_null( $fields ) ?
$this->getFieldNames() : (array)$fields ),
$conditions,
diff --git a/includes/tables/ORMTable.php b/includes/tables/ORMTable.php
index d059c46..8c53ca0 100644
--- a/includes/tables/ORMTable.php
+++ b/includes/tables/ORMTable.php
@@ -89,7 +89,7 @@
*
* @var int DB_ enum
*/
- protected $readDb = DB_SLAVE;
+ protected $readDb = DB_REPLICA;
/**
* @since 1.21
diff --git a/maintenance/fixInvalidStudent.php
b/maintenance/fixInvalidStudent.php
index 3bd7cdc..ccf2ad2 100644
--- a/maintenance/fixInvalidStudent.php
+++ b/maintenance/fixInvalidStudent.php
@@ -57,7 +57,7 @@
return;
}
- $dbr = wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_REPLICA );
$results = $dbr->select(
'ep_users_per_course',
'upc_course_id',
diff --git a/maintenance/importWEPFromDB.php b/maintenance/importWEPFromDB.php
index 396814b..c153259 100644
--- a/maintenance/importWEPFromDB.php
+++ b/maintenance/importWEPFromDB.php
@@ -35,7 +35,7 @@
$table = "imp_$table";
if ( $incMw ) {
- $table = wfGetDB( DB_SLAVE )->tableName( $table );
+ $table = wfGetDB( DB_REPLICA )->tableName( $table );
}
return $table;
@@ -68,7 +68,7 @@
'students' => 'imp_students',
];
- $dbr = wfGetDB( DB_SLAVE );
+ $dbr = wfGetDB( DB_REPLICA );
foreach ( $conds as $name => $cond ) {
$nr = $dbr->select(
diff --git a/tests/phpunit/SpecialsTest.php b/tests/phpunit/SpecialsTest.php
index 830d6b4..acb5f08 100644
--- a/tests/phpunit/SpecialsTest.php
+++ b/tests/phpunit/SpecialsTest.php
@@ -2,8 +2,6 @@
namespace EducationProgram\Tests;
-use SpecialPage;
-
/**
* Runs the Education Program special pages to make sure they do not contain
fatal errors.
*
diff --git a/tests/phpunit/UPCUserCourseFinderTest.php
b/tests/phpunit/UPCUserCourseFinderTest.php
index 57dcce4..632df09 100644
--- a/tests/phpunit/UPCUserCourseFinderTest.php
+++ b/tests/phpunit/UPCUserCourseFinderTest.php
@@ -42,7 +42,7 @@
public function getInstances() {
$instances = [];
- $instances[] = new UPCUserCourseFinder( wfGetDB( DB_SLAVE ) );
+ $instances[] = new UPCUserCourseFinder( wfGetDB( DB_REPLICA ) );
return $instances;
}
--
To view, visit https://gerrit.wikimedia.org/r/380133
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I6c4de36f8d960e4c4d8e08a63a4b3a40c4af2eae
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/EducationProgram
Gerrit-Branch: master
Gerrit-Owner: Libraryupgrader <[email protected]>
Gerrit-Reviewer: AndyRussG <[email protected]>
Gerrit-Reviewer: Umherirrender <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits