X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fspecials%2FSpecialLockdb.php;h=2d087ca4f49cb7bcf6fc984c6523251921e8d1de;hb=3198421632712b2a389eec5f222fd1c344ea74fc;hp=1c1f1250c728170bd57be887bb200b23db4cdd98;hpb=abb5869cba1cca1c7d9bedfda6d3831bf2fc11a0;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/specials/SpecialLockdb.php b/includes/specials/SpecialLockdb.php index 1c1f1250c7..2d087ca4f4 100644 --- a/includes/specials/SpecialLockdb.php +++ b/includes/specials/SpecialLockdb.php @@ -33,6 +33,10 @@ class SpecialLockdb extends FormSpecialPage { parent::__construct( 'Lockdb', 'siteadmin' ); } + public function doesWrites() { + return false; + } + public function requiresWrite() { return false; } @@ -43,27 +47,30 @@ 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() { - return array( - 'Reason' => array( + return [ + 'Reason' => [ 'type' => 'textarea', 'rows' => 4, 'vertical-label' => true, 'label-message' => 'enterlockreason', - ), - 'Confirm' => array( + ], + 'Confirm' => [ 'type' => 'toggle', 'label-message' => 'lockconfirm', - ), - ); + ], + ]; } 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 ) { @@ -73,9 +80,9 @@ class SpecialLockdb extends FormSpecialPage { return Status::newFatal( 'locknoconfirm' ); } - wfSuppressWarnings(); + MediaWiki\suppressWarnings(); $fp = fopen( $this->getConfig()->get( 'ReadOnlyFile' ), 'w' ); - wfRestoreWarnings(); + MediaWiki\restoreWarnings(); if ( false === $fp ) { # This used to show a file not found error, but the likeliest reason for fopen() @@ -101,6 +108,10 @@ class SpecialLockdb extends FormSpecialPage { $out->addWikiMsg( 'lockdbsuccesstext' ); } + protected function getDisplayFormat() { + return 'ooui'; + } + protected function getGroupName() { return 'wiki'; }