Fix visibility of error handlers
authorJakub Vrana <jakub@vrana.cz>
Sat, 4 May 2013 17:10:06 +0000 (10:10 -0700)
committerJakub Vrana <jakub@vrana.cz>
Sat, 4 May 2013 17:10:06 +0000 (10:10 -0700)
I've hit this error when $wgDBuser didn't have access to $wgDBname.
I've also checked all other error handlers in core.

An alternative approach would be to use an anonymous function but it doesn't support $this until PHP 5.4 so it would be messier.

Change-Id: I89db2e8c88b84d9b53c4b828ac0208b05a3d3783

includes/db/Database.php
includes/filebackend/FSFileBackend.php

index b315fac..1cbffd8 100644 (file)
@@ -772,8 +772,9 @@ abstract class DatabaseBase implements DatabaseType {
        /**
         * @param $errno
         * @param $errstr
+        * @access private
         */
-       protected function connectionErrorHandler( $errno, $errstr ) {
+       public function connectionErrorHandler( $errno, $errstr ) {
                $this->mPHPError = $errstr;
        }
 
index d4e32cf..11a5ac9 100644 (file)
@@ -810,8 +810,9 @@ class FSFileBackend extends FileBackendStore {
         * @param $errno integer
         * @param $errstr string
         * @return bool
+        * @access private
         */
-       private function handleWarning( $errno, $errstr ) {
+       public function handleWarning( $errno, $errstr ) {
                wfDebugLog( 'FSFileBackend', $errstr ); // more detailed error logging
                $this->hadWarningErrors[count( $this->hadWarningErrors ) - 1] = true;
                return true; // suppress from PHP handler