SpecialUnlockdb: Use Config instead of globals
authorKunal Mehta <legoktm@gmail.com>
Wed, 6 Aug 2014 15:22:35 +0000 (16:22 +0100)
committerKunal Mehta <legoktm@gmail.com>
Wed, 6 Aug 2014 15:22:35 +0000 (16:22 +0100)
Change-Id: Id6e2c0511113b24a7f90a7e3d50ab9b0f787f356

includes/specials/SpecialUnlockdb.php

index 35141d8..a8b97d7 100644 (file)
@@ -37,11 +37,9 @@ class SpecialUnlockdb extends FormSpecialPage {
        }
 
        public function checkExecutePermissions( User $user ) {
-               global $wgReadOnlyFile;
-
                parent::checkExecutePermissions( $user );
                # If the lock file isn't writable, we can do sweet bugger all
-               if ( !file_exists( $wgReadOnlyFile ) ) {
+               if ( !file_exists( $this->getConfig()->get( 'ReadOnlyFile' ) ) ) {
                        throw new ErrorPageError( 'lockdb', 'databasenotlocked' );
                }
        }
@@ -62,20 +60,19 @@ class SpecialUnlockdb extends FormSpecialPage {
        }
 
        public function onSubmit( array $data ) {
-               global $wgReadOnlyFile;
-
                if ( !$data['Confirm'] ) {
                        return Status::newFatal( 'locknoconfirm' );
                }
 
+               $readOnlyFile = $this->getConfig()->get( 'ReadOnlyFile' );
                wfSuppressWarnings();
-               $res = unlink( $wgReadOnlyFile );
+               $res = unlink( $readOnlyFile );
                wfRestoreWarnings();
 
                if ( $res ) {
                        return Status::newGood();
                } else {
-                       return Status::newFatal( 'filedeleteerror', $wgReadOnlyFile );
+                       return Status::newFatal( 'filedeleteerror', $readOnlyFile );
                }
        }