Define which SpecialPage classes expect write vs read mode
[lhc/web/wiklou.git] / includes / specials / SpecialLockdb.php
index 3382405..0d495a0 100644 (file)
@@ -33,16 +33,18 @@ class SpecialLockdb extends FormSpecialPage {
                parent::__construct( 'Lockdb', 'siteadmin' );
        }
 
+       public function doesWrites() {
+               return true;
+       }
+
        public function requiresWrite() {
                return false;
        }
 
        public function checkExecutePermissions( User $user ) {
-               global $wgReadOnlyFile;
-
                parent::checkExecutePermissions( $user );
                # If the lock file isn't writable, we can do sweet bugger all
-               if ( !is_writable( dirname( $wgReadOnlyFile ) ) ) {
+               if ( !is_writable( dirname( $this->getConfig()->get( 'ReadOnlyFile' ) ) ) ) {
                        throw new ErrorPageError( 'lockdb', 'lockfilenotwritable' );
                }
        }
@@ -69,15 +71,15 @@ class SpecialLockdb extends FormSpecialPage {
        }
 
        public function onSubmit( array $data ) {
-               global $wgContLang, $wgReadOnlyFile;
+               global $wgContLang;
 
                if ( !$data['Confirm'] ) {
                        return Status::newFatal( 'locknoconfirm' );
                }
 
-               wfSuppressWarnings();
-               $fp = fopen( $wgReadOnlyFile, 'w' );
-               wfRestoreWarnings();
+               MediaWiki\suppressWarnings();
+               $fp = fopen( $this->getConfig()->get( 'ReadOnlyFile' ), 'w' );
+               MediaWiki\restoreWarnings();
 
                if ( false === $fp ) {
                        # This used to show a file not found error, but the likeliest reason for fopen()