Merge "Database: Remove resultObject() from the public interface"
authorAaron Schulz <aschulz@wikimedia.org>
Sat, 26 Sep 2015 18:25:01 +0000 (18:25 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 26 Sep 2015 18:25:01 +0000 (18:25 +0000)
RELEASE-NOTES-1.26
includes/db/DBConnRef.php
includes/db/Database.php
includes/db/DatabaseMssql.php
includes/db/IDatabase.php

index aab1b42..7f738e1 100644 (file)
@@ -220,6 +220,8 @@ changes to languages because of Phabricator reports.
   'Project:Oversight' to 'Project:Suppress'.
 * (T84937) Free external links ("autolinked" urls) will now be terminated
   by &nbsp; and HTML entity encodings of &nbsp, <, and >.
+* DatabaseBase::resultObject() is now protected (use outside Database classes
+  not necessary since 1.11).
 
 == Compatibility ==
 
index b4f3f79..ffada49 100644 (file)
@@ -449,10 +449,6 @@ class DBConnRef implements IDatabase {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
 
-       public function resultObject( $result ) {
-               return $this->__call( __FUNCTION__, func_get_args() );
-       }
-
        public function ping() {
                return $this->__call( __FUNCTION__, func_get_args() );
        }
index 1e54f55..dbe86dc 100644 (file)
@@ -3766,14 +3766,13 @@ abstract class DatabaseBase implements IDatabase {
         * Once upon a time, DatabaseBase::query() returned a bare MySQL result
         * resource, and it was necessary to call this function to convert it to
         * a wrapper. Nowadays, raw database objects are never exposed to external
-        * callers, so this is unnecessary in external code. For compatibility with
-        * old code, ResultWrapper objects are passed through unaltered.
+        * callers, so this is unnecessary in external code.
         *
-        * @param bool|ResultWrapper|resource $result
+        * @param bool|ResultWrapper|resource|object $result
         * @return bool|ResultWrapper
         */
-       public function resultObject( $result ) {
-               if ( empty( $result ) ) {
+       protected function resultObject( $result ) {
+               if ( !$result ) {
                        return false;
                } elseif ( $result instanceof ResultWrapper ) {
                        return $result;
index 85f1b96..354afc5 100644 (file)
@@ -145,8 +145,8 @@ class DatabaseMssql extends DatabaseBase {
         * @param bool|MssqlResultWrapper|resource $result
         * @return bool|MssqlResultWrapper
         */
-       public function resultObject( $result ) {
-               if ( empty( $result ) ) {
+       protected function resultObject( $result ) {
+               if ( !$result ) {
                        return false;
                } elseif ( $result instanceof MssqlResultWrapper ) {
                        return $result;
index 49d0514..95608c6 100644 (file)
@@ -1347,22 +1347,6 @@ interface IDatabase {
         */
        public function timestampOrNull( $ts = null );
 
-       /**
-        * Take the result from a query, and wrap it in a ResultWrapper if
-        * necessary. Boolean values are passed through as is, to indicate success
-        * of write queries or failure.
-        *
-        * Once upon a time, DatabaseBase::query() returned a bare MySQL result
-        * resource, and it was necessary to call this function to convert it to
-        * a wrapper. Nowadays, raw database objects are never exposed to external
-        * callers, so this is unnecessary in external code. For compatibility with
-        * old code, ResultWrapper objects are passed through unaltered.
-        *
-        * @param bool|ResultWrapper|resource $result
-        * @return bool|ResultWrapper
-        */
-       public function resultObject( $result );
-
        /**
         * Ping the server and try to reconnect if it there is no connection
         *