From c06f1e742bc70fff88ad024f1d24d3a9cdb8b24e Mon Sep 17 00:00:00 2001 From: Kunal Mehta Date: Wed, 6 Aug 2014 16:22:35 +0100 Subject: [PATCH] SpecialUnlockdb: Use Config instead of globals Change-Id: Id6e2c0511113b24a7f90a7e3d50ab9b0f787f356 --- includes/specials/SpecialUnlockdb.php | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/includes/specials/SpecialUnlockdb.php b/includes/specials/SpecialUnlockdb.php index 35141d805e..a8b97d78bd 100644 --- a/includes/specials/SpecialUnlockdb.php +++ b/includes/specials/SpecialUnlockdb.php @@ -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 ); } } -- 2.20.1