Merge "Use Xml::element instead of Html::element for empty elements"
[lhc/web/wiklou.git] / includes / specials / SpecialUnlockdb.php
index 115e617..a8b97d7 100644 (file)
@@ -36,12 +36,10 @@ class SpecialUnlockdb extends FormSpecialPage {
                return false;
        }
 
-       public function userCanExecute( User $user ) {
-               parent::userCanExecute( $user );
-
+       public function checkExecutePermissions( User $user ) {
+               parent::checkExecutePermissions( $user );
                # If the lock file isn't writable, we can do sweet bugger all
-               global $wgReadOnlyFile;
-               if ( !file_exists( $wgReadOnlyFile ) ) {
+               if ( !file_exists( $this->getConfig()->get( 'ReadOnlyFile' ) ) ) {
                        throw new ErrorPageError( 'lockdb', 'databasenotlocked' );
                }
        }
@@ -62,26 +60,29 @@ 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 );
                }
        }
 
        public function onSuccess() {
                $out = $this->getOutput();
-               $out->setSubtitle( wfMsg( 'unlockdbsuccesssub' ) );
+               $out->addSubtitle( $this->msg( 'unlockdbsuccesssub' ) );
                $out->addWikiMsg( 'unlockdbsuccesstext' );
        }
+
+       protected function getGroupName() {
+               return 'wiki';
+       }
 }