jenkins-bot has submitted this change and it was merged.
Change subject: Allow for IDatabase to be used as type hints for
DatabaseBase|DBConnRef
......................................................................
Allow for IDatabase to be used as type hints for DatabaseBase|DBConnRef
* Use this in LogEntry to avoid needless type errors
Change-Id: I8644b35b0d9cd171243dd28de52e94ef39d361a7
---
M includes/AutoLoader.php
M includes/db/Database.php
M includes/db/LoadBalancer.php
M includes/logging/LogEntry.php
4 files changed, 11 insertions(+), 4 deletions(-)
Approvals:
Tim Starling: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/AutoLoader.php b/includes/AutoLoader.php
index 2f0ac23..0950e5f 100644
--- a/includes/AutoLoader.php
+++ b/includes/AutoLoader.php
@@ -486,6 +486,7 @@
'DBConnRef' => 'includes/db/LoadBalancer.php',
'DBError' => 'includes/db/DatabaseError.php',
'DBObject' => 'includes/db/DatabaseUtility.php',
+ 'IDatabase' => 'includes/db/Database.php',
'IORMRow' => 'includes/db/IORMRow.php',
'IORMTable' => 'includes/db/IORMTable.php',
'DBMasterPos' => 'includes/db/DatabaseUtility.php',
diff --git a/includes/db/Database.php b/includes/db/Database.php
index a86d6be..04f1f97 100644
--- a/includes/db/Database.php
+++ b/includes/db/Database.php
@@ -205,10 +205,16 @@
}
/**
+ * Interface for classes that implement or wrap DatabaseBase
+ * @ingroup Database
+ */
+interface IDatabase {}
+
+/**
* Database abstraction object
* @ingroup Database
*/
-abstract class DatabaseBase implements DatabaseType {
+abstract class DatabaseBase implements IDatabase, DatabaseType {
/** Number of times to re-try an operation in case of deadlock */
const DEADLOCK_TRIES = 4;
/** Minimum time to wait before retry, in microseconds */
diff --git a/includes/db/LoadBalancer.php b/includes/db/LoadBalancer.php
index ab200b4..5c4443d 100644
--- a/includes/db/LoadBalancer.php
+++ b/includes/db/LoadBalancer.php
@@ -1091,7 +1091,7 @@
* @ingroup Database
* @since 1.22
*/
-class DBConnRef {
+class DBConnRef implements IDatabase {
/** @var LoadBalancer */
protected $lb;
/** @var DatabaseBase */
diff --git a/includes/logging/LogEntry.php b/includes/logging/LogEntry.php
index fee4fab..16b72ea 100644
--- a/includes/logging/LogEntry.php
+++ b/includes/logging/LogEntry.php
@@ -442,10 +442,10 @@
/**
* Inserts the entry into the logging table.
- * @param DatabaseBase $dbw
+ * @param IDatabase $dbw
* @return int If of the log entry
*/
- public function insert( DatabaseBase $dbw = null ) {
+ public function insert( IDatabase $dbw = null ) {
global $wgContLang;
$dbw = $dbw ?: wfGetDB( DB_MASTER );
--
To view, visit https://gerrit.wikimedia.org/r/74320
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I8644b35b0d9cd171243dd28de52e94ef39d361a7
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Tim Starling <[email protected]>
Gerrit-Reviewer: jenkins-bot
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits