Revert "Commit of various live hacks"
[lhc/web/wiklou.git] / includes / db / DatabaseMysql.php
index 04c22f1..fab0e96 100644 (file)
@@ -193,7 +193,7 @@ class DatabaseMysql extends DatabaseBase {
 
        /**
         * @param $res ResultWrapper
-        * @return object|stdClass
+        * @return object|bool
         * @throws DBUnexpectedError
         */
        function fetchObject( $res ) {
@@ -217,7 +217,7 @@ class DatabaseMysql extends DatabaseBase {
 
        /**
         * @param $res ResultWrapper
-        * @return array
+        * @return array|bool
         * @throws DBUnexpectedError
         */
        function fetchRow( $res ) {
@@ -361,7 +361,7 @@ class DatabaseMysql extends DatabaseBase {
         * @param $options string|array
         * @return int
         */
-       public function estimateRowCount( $table, $vars='*', $conds='', $fname = 'DatabaseMysql::estimateRowCount', $options = array() ) {
+       public function estimateRowCount( $table, $vars = '*', $conds = '', $fname = 'DatabaseMysql::estimateRowCount', $options = array() ) {
                $options['EXPLAIN'] = true;
                $res = $this->select( $table, $vars, $conds, $fname, $options );
                if ( $res === false ) {
@@ -393,7 +393,7 @@ class DatabaseMysql extends DatabaseBase {
                for( $i = 0; $i < $n; $i++ ) {
                        $meta = mysql_fetch_field( $res->result, $i );
                        if( $field == $meta->name ) {
-                               return new MySQLField($meta);
+                               return new MySQLField( $meta );
                        }
                }
                return false;
@@ -449,7 +449,7 @@ class DatabaseMysql extends DatabaseBase {
        function strencode( $s ) {
                $sQuoted = mysql_real_escape_string( $s, $this->mConn );
 
-               if($sQuoted === false) {
+               if( $sQuoted === false ) {
                        $this->ping();
                        $sQuoted = mysql_real_escape_string( $s, $this->mConn );
                }
@@ -685,7 +685,7 @@ class DatabaseMysql extends DatabaseBase {
 
        public function streamStatementEnd( &$sql, &$newLine ) {
                if ( strtoupper( substr( $newLine, 0, 9 ) ) == 'DELIMITER' ) {
-                       preg_match( '/^DELIMITER\s+(\S+)/' , $newLine, $m );
+                       preg_match( '/^DELIMITER\s+(\S+)/', $newLine, $m );
                        $this->delimiter = $m[1];
                        $newLine = '';
                }
@@ -721,7 +721,7 @@ class DatabaseMysql extends DatabaseBase {
                if( $row->lockstatus == 1 ) {
                        return true;
                } else {
-                       wfDebug( __METHOD__." failed to acquire lock\n" );
+                       wfDebug( __METHOD__ . " failed to acquire lock\n" );
                        return false;
                }
        }
@@ -744,6 +744,7 @@ class DatabaseMysql extends DatabaseBase {
         * @param $write array
         * @param $method string
         * @param $lowPriority bool
+        * @return bool
         */
        public function lockTables( $read, $write, $method, $lowPriority = true ) {
                $items = array();
@@ -759,13 +760,16 @@ class DatabaseMysql extends DatabaseBase {
                }
                $sql = "LOCK TABLES " . implode( ',', $items );
                $this->query( $sql, $method );
+               return true;
        }
 
        /**
         * @param $method string
+        * @return bool
         */
        public function unlockTables( $method ) {
                $this->query( "UNLOCK TABLES", $method );
+               return true;
        }
 
        /**
@@ -899,7 +903,7 @@ class DatabaseMysql extends DatabaseBase {
                $endArray = array();
 
                foreach( $result as $table ) {
-                       $vars = get_object_vars($table);
+                       $vars = get_object_vars( $table );
                        $table = array_pop( $vars );
 
                        if( !$prefix || strpos( $table, $prefix ) === 0 ) {