Paladox has uploaded a new change for review.

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

Change subject: Revert "Split up DBError classes into their own files"
......................................................................

Revert "Split up DBError classes into their own files"

This reverts commit aa9d1c91b62fa43dcf47347fb8c4095eeeb760ff.

Change-Id: I11c7f7c87ab06b340c6954acfa6a93e64c49deb7
---
M autoload.php
D includes/libs/rdbms/exception/DBAccessError.php
D includes/libs/rdbms/exception/DBConnectionError.php
M includes/libs/rdbms/exception/DBError.php
D includes/libs/rdbms/exception/DBExpectedError.php
D includes/libs/rdbms/exception/DBQueryError.php
D includes/libs/rdbms/exception/DBReadOnlyError.php
D includes/libs/rdbms/exception/DBReplicationWaitError.php
D includes/libs/rdbms/exception/DBTransactionError.php
D includes/libs/rdbms/exception/DBTransactionSizeError.php
D includes/libs/rdbms/exception/DBUnexpectedError.php
11 files changed, 141 insertions(+), 322 deletions(-)


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

diff --git a/autoload.php b/autoload.php
index 018e85e..433f907 100644
--- a/autoload.php
+++ b/autoload.php
@@ -299,22 +299,22 @@
        'CsvStatsOutput' => __DIR__ . '/maintenance/language/StatOutputs.php',
        'CurlHttpRequest' => __DIR__ . '/includes/HttpFunctions.php',
        'DBAccessBase' => __DIR__ . '/includes/dao/DBAccessBase.php',
-       'DBAccessError' => __DIR__ . 
'/includes/libs/rdbms/exception/DBAccessError.php',
+       'DBAccessError' => __DIR__ . 
'/includes/libs/rdbms/exception/DBError.php',
        'DBAccessObjectUtils' => __DIR__ . 
'/includes/dao/DBAccessObjectUtils.php',
        'DBConnRef' => __DIR__ . '/includes/libs/rdbms/database/DBConnRef.php',
-       'DBConnectionError' => __DIR__ . 
'/includes/libs/rdbms/exception/DBConnectionError.php',
+       'DBConnectionError' => __DIR__ . 
'/includes/libs/rdbms/exception/DBError.php',
        'DBError' => __DIR__ . '/includes/libs/rdbms/exception/DBError.php',
-       'DBExpectedError' => __DIR__ . 
'/includes/libs/rdbms/exception/DBExpectedError.php',
+       'DBExpectedError' => __DIR__ . 
'/includes/libs/rdbms/exception/DBError.php',
        'DBFileJournal' => __DIR__ . 
'/includes/filebackend/filejournal/DBFileJournal.php',
        'DBLockManager' => __DIR__ . 
'/includes/filebackend/lockmanager/DBLockManager.php',
        'DBMasterPos' => __DIR__ . 
'/includes/libs/rdbms/database/position/DBMasterPos.php',
-       'DBQueryError' => __DIR__ . 
'/includes/libs/rdbms/exception/DBQueryError.php',
-       'DBReadOnlyError' => __DIR__ . 
'/includes/libs/rdbms/exception/DBReadOnlyError.php',
-       'DBReplicationWaitError' => __DIR__ . 
'/includes/libs/rdbms/exception/DBReplicationWaitError.php',
+       'DBQueryError' => __DIR__ . 
'/includes/libs/rdbms/exception/DBError.php',
+       'DBReadOnlyError' => __DIR__ . 
'/includes/libs/rdbms/exception/DBError.php',
+       'DBReplicationWaitError' => __DIR__ . 
'/includes/libs/rdbms/exception/DBError.php',
        'DBSiteStore' => __DIR__ . '/includes/site/DBSiteStore.php',
-       'DBTransactionError' => __DIR__ . 
'/includes/libs/rdbms/exception/DBTransactionError.php',
-       'DBTransactionSizeError' => __DIR__ . 
'/includes/libs/rdbms/exception/DBTransactionSizeError.php',
-       'DBUnexpectedError' => __DIR__ . 
'/includes/libs/rdbms/exception/DBUnexpectedError.php',
+       'DBTransactionError' => __DIR__ . 
'/includes/libs/rdbms/exception/DBError.php',
+       'DBTransactionSizeError' => __DIR__ . 
'/includes/libs/rdbms/exception/DBError.php',
+       'DBUnexpectedError' => __DIR__ . 
'/includes/libs/rdbms/exception/DBError.php',
        'DataUpdate' => __DIR__ . '/includes/deferred/DataUpdate.php',
        'Database' => __DIR__ . '/includes/libs/rdbms/database/Database.php',
        'DatabaseBase' => __DIR__ . 
'/includes/libs/rdbms/database/DatabaseBase.php',
diff --git a/includes/libs/rdbms/exception/DBAccessError.php 
b/includes/libs/rdbms/exception/DBAccessError.php
deleted file mode 100644
index 7971dba..0000000
--- a/includes/libs/rdbms/exception/DBAccessError.php
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Database
- */
-
-/**
- * Exception class for attempted DB access
- * @ingroup Database
- */
-class DBAccessError extends DBUnexpectedError {
-       public function __construct() {
-               parent::__construct( "Mediawiki tried to access the database 
via wfGetDB(). " .
-                       "This is not allowed, because database access has been 
disabled." );
-       }
-}
-
diff --git a/includes/libs/rdbms/exception/DBConnectionError.php 
b/includes/libs/rdbms/exception/DBConnectionError.php
deleted file mode 100644
index 47f8c96..0000000
--- a/includes/libs/rdbms/exception/DBConnectionError.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Database
- */
-
-/**
- * @ingroup Database
- */
-class DBConnectionError extends DBExpectedError {
-       /**
-        * @param IDatabase $db Object throwing the error
-        * @param string $error Error text
-        */
-       function __construct( IDatabase $db = null, $error = 'unknown error' ) {
-               $msg = 'Cannot access the database';
-               if ( trim( $error ) != '' ) {
-                       $msg .= ": $error";
-               }
-
-               parent::__construct( $db, $msg );
-       }
-}
diff --git a/includes/libs/rdbms/exception/DBError.php 
b/includes/libs/rdbms/exception/DBError.php
index 526596d..544da5f 100644
--- a/includes/libs/rdbms/exception/DBError.php
+++ b/includes/libs/rdbms/exception/DBError.php
@@ -1,5 +1,7 @@
 <?php
 /**
+ * This file contains database error classes.
+ *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -37,3 +39,133 @@
                parent::__construct( $error );
        }
 }
+
+/**
+ * Base class for the more common types of database errors. These are known to 
occur
+ * frequently, so we try to give friendly error messages for them.
+ *
+ * @ingroup Database
+ * @since 1.23
+ */
+class DBExpectedError extends DBError implements MessageSpecifier {
+       /** @var string[] Message parameters */
+       protected $params;
+
+       function __construct( IDatabase $db = null, $error, array $params = [] 
) {
+               parent::__construct( $db, $error );
+               $this->params = $params;
+       }
+
+       public function getKey() {
+               return 'databaseerror-text';
+       }
+
+       public function getParams() {
+               return $this->params;
+       }
+}
+
+/**
+ * @ingroup Database
+ */
+class DBConnectionError extends DBExpectedError {
+       /**
+        * @param IDatabase $db Object throwing the error
+        * @param string $error Error text
+        */
+       function __construct( IDatabase $db = null, $error = 'unknown error' ) {
+               $msg = 'Cannot access the database';
+               if ( trim( $error ) != '' ) {
+                       $msg .= ": $error";
+               }
+
+               parent::__construct( $db, $msg );
+       }
+}
+
+/**
+ * @ingroup Database
+ */
+class DBQueryError extends DBExpectedError {
+       /** @var string */
+       public $error;
+       /** @var integer */
+       public $errno;
+       /** @var string */
+       public $sql;
+       /** @var string */
+       public $fname;
+
+       /**
+        * @param IDatabase $db
+        * @param string $error
+        * @param int|string $errno
+        * @param string $sql
+        * @param string $fname
+        */
+       function __construct( IDatabase $db, $error, $errno, $sql, $fname ) {
+               if ( $db instanceof DatabaseBase && $db->wasConnectionError( 
$errno ) ) {
+                       $message = "A connection error occured. \n" .
+                               "Query: $sql\n" .
+                               "Function: $fname\n" .
+                               "Error: $errno $error\n";
+               } else {
+                       $message = "A database query error has occurred. Did 
you forget to run " .
+                               "your application's database schema updater 
after upgrading? \n" .
+                               "Query: $sql\n" .
+                               "Function: $fname\n" .
+                               "Error: $errno $error\n";
+               }
+               parent::__construct( $db, $message );
+
+               $this->error = $error;
+               $this->errno = $errno;
+               $this->sql = $sql;
+               $this->fname = $fname;
+       }
+}
+
+/**
+ * @ingroup Database
+ */
+class DBReadOnlyError extends DBExpectedError {
+}
+
+/**
+ * @ingroup Database
+ */
+class DBTransactionError extends DBExpectedError {
+}
+
+/**
+ * @ingroup Database
+ */
+class DBTransactionSizeError extends DBTransactionError {
+       function getKey() {
+               return 'transaction-duration-limit-exceeded';
+       }
+}
+
+/**
+ * Exception class for replica DB wait timeouts
+ * @ingroup Database
+ */
+class DBReplicationWaitError extends DBExpectedError {
+}
+
+/**
+ * @ingroup Database
+ */
+class DBUnexpectedError extends DBError {
+}
+
+/**
+ * Exception class for attempted DB access
+ * @ingroup Database
+ */
+class DBAccessError extends DBUnexpectedError {
+       public function __construct() {
+               parent::__construct( "Access to the database has been 
disabled." );
+       }
+}
+
diff --git a/includes/libs/rdbms/exception/DBExpectedError.php 
b/includes/libs/rdbms/exception/DBExpectedError.php
deleted file mode 100644
index 9e10884..0000000
--- a/includes/libs/rdbms/exception/DBExpectedError.php
+++ /dev/null
@@ -1,45 +0,0 @@
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Database
- */
-
-/**
- * Base class for the more common types of database errors. These are known to 
occur
- * frequently, so we try to give friendly error messages for them.
- *
- * @ingroup Database
- * @since 1.23
- */
-class DBExpectedError extends DBError implements MessageSpecifier {
-       /** @var string[] Message parameters */
-       protected $params;
-
-       function __construct( IDatabase $db = null, $error, array $params = [] 
) {
-               parent::__construct( $db, $error );
-               $this->params = $params;
-       }
-
-       public function getKey() {
-               return 'databaseerror-text';
-       }
-
-       public function getParams() {
-               return $this->params;
-       }
-}
diff --git a/includes/libs/rdbms/exception/DBQueryError.php 
b/includes/libs/rdbms/exception/DBQueryError.php
deleted file mode 100644
index ac9217d..0000000
--- a/includes/libs/rdbms/exception/DBQueryError.php
+++ /dev/null
@@ -1,63 +0,0 @@
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Database
- */
-
-/**
- * @ingroup Database
- */
-class DBQueryError extends DBExpectedError {
-       /** @var string */
-       public $error;
-       /** @var integer */
-       public $errno;
-       /** @var string */
-       public $sql;
-       /** @var string */
-       public $fname;
-
-       /**
-        * @param IDatabase $db
-        * @param string $error
-        * @param int|string $errno
-        * @param string $sql
-        * @param string $fname
-        */
-       function __construct( IDatabase $db, $error, $errno, $sql, $fname ) {
-               if ( $db instanceof DatabaseBase && $db->wasConnectionError( 
$errno ) ) {
-                       $message = "A connection error occured. \n" .
-                               "Query: $sql\n" .
-                               "Function: $fname\n" .
-                               "Error: $errno $error\n";
-               } else {
-                       $message = "A database query error has occurred. Did 
you forget to run " .
-                               "your application's database schema updater 
after upgrading? \n" .
-                               "Query: $sql\n" .
-                               "Function: $fname\n" .
-                               "Error: $errno $error\n";
-               }
-
-               parent::__construct( $db, $message );
-
-               $this->error = $error;
-               $this->errno = $errno;
-               $this->sql = $sql;
-               $this->fname = $fname;
-       }
-}
diff --git a/includes/libs/rdbms/exception/DBReadOnlyError.php 
b/includes/libs/rdbms/exception/DBReadOnlyError.php
deleted file mode 100644
index d4dce1e..0000000
--- a/includes/libs/rdbms/exception/DBReadOnlyError.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Database
- */
-
-/**
- * @ingroup Database
- */
-class DBReadOnlyError extends DBExpectedError {
-}
diff --git a/includes/libs/rdbms/exception/DBReplicationWaitError.php 
b/includes/libs/rdbms/exception/DBReplicationWaitError.php
deleted file mode 100644
index f1dabd5..0000000
--- a/includes/libs/rdbms/exception/DBReplicationWaitError.php
+++ /dev/null
@@ -1,28 +0,0 @@
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Database
- */
-
-/**
- * Exception class for replica DB wait timeouts
- * @ingroup Database
- */
-class DBReplicationWaitError extends DBExpectedError {
-}
-
diff --git a/includes/libs/rdbms/exception/DBTransactionError.php 
b/includes/libs/rdbms/exception/DBTransactionError.php
deleted file mode 100644
index a488667..0000000
--- a/includes/libs/rdbms/exception/DBTransactionError.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Database
- */
-
-/**
- * @ingroup Database
- */
-class DBTransactionError extends DBExpectedError {
-}
diff --git a/includes/libs/rdbms/exception/DBTransactionSizeError.php 
b/includes/libs/rdbms/exception/DBTransactionSizeError.php
deleted file mode 100644
index 4e467b2..0000000
--- a/includes/libs/rdbms/exception/DBTransactionSizeError.php
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Database
- */
-
-/**
- * @ingroup Database
- */
-class DBTransactionSizeError extends DBTransactionError {
-       function getKey() {
-               return 'transaction-duration-limit-exceeded';
-       }
-}
diff --git a/includes/libs/rdbms/exception/DBUnexpectedError.php 
b/includes/libs/rdbms/exception/DBUnexpectedError.php
deleted file mode 100644
index 5a12671..0000000
--- a/includes/libs/rdbms/exception/DBUnexpectedError.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-/**
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- * http://www.gnu.org/copyleft/gpl.html
- *
- * @file
- * @ingroup Database
- */
-
-/**
- * @ingroup Database
- */
-class DBUnexpectedError extends DBError {
-}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I11c7f7c87ab06b340c6954acfa6a93e64c49deb7
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Paladox <thomasmulhall...@yahoo.com>

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

Reply via email to