Update suppressWarning()/restoreWarning() calls
[lhc/web/wiklou.git] / includes / specials / SpecialLockdb.php
index a229fa3..fb04b90 100644 (file)
@@ -34,7 +34,7 @@ class SpecialLockdb extends FormSpecialPage {
        }
 
        public function doesWrites() {
-               return true;
+               return false;
        }
 
        public function requiresWrite() {
@@ -47,6 +47,9 @@ class SpecialLockdb extends FormSpecialPage {
                if ( !is_writable( dirname( $this->getConfig()->get( 'ReadOnlyFile' ) ) ) ) {
                        throw new ErrorPageError( 'lockdb', 'lockfilenotwritable' );
                }
+               if ( file_exists( $this->getConfig()->get( 'ReadOnlyFile' ) ) ) {
+                       throw new ErrorPageError( 'lockdb', 'databaselocked' );
+               }
        }
 
        protected function getFormFields() {
@@ -65,9 +68,9 @@ class SpecialLockdb extends FormSpecialPage {
        }
 
        protected function alterForm( HTMLForm $form ) {
-               $form->setWrapperLegend( false );
-               $form->setHeaderText( $this->msg( 'lockdbtext' )->parseAsBlock() );
-               $form->setSubmitTextMsg( 'lockbtn' );
+               $form->setWrapperLegend( false )
+                       ->setHeaderText( $this->msg( 'lockdbtext' )->parseAsBlock() )
+                       ->setSubmitTextMsg( 'lockbtn' );
        }
 
        public function onSubmit( array $data ) {
@@ -77,9 +80,9 @@ class SpecialLockdb extends FormSpecialPage {
                        return Status::newFatal( 'locknoconfirm' );
                }
 
-               MediaWiki\suppressWarnings();
+               Wikimedia\suppressWarnings();
                $fp = fopen( $this->getConfig()->get( 'ReadOnlyFile' ), 'w' );
-               MediaWiki\restoreWarnings();
+               Wikimedia\restoreWarnings();
 
                if ( false === $fp ) {
                        # This used to show a file not found error, but the likeliest reason for fopen()
@@ -105,6 +108,10 @@ class SpecialLockdb extends FormSpecialPage {
                $out->addWikiMsg( 'lockdbsuccesstext' );
        }
 
+       protected function getDisplayFormat() {
+               return 'ooui';
+       }
+
        protected function getGroupName() {
                return 'wiki';
        }