From 396b28f3d881f5debd888ba9bb9b47c2d478a76f Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Mon, 15 Dec 2008 18:02:47 +0100 Subject: update to Mediawiki 1.13.3; some cleanups --- includes/SpecialLockdb.php | 134 --------------------------------------------- 1 file changed, 134 deletions(-) delete mode 100644 includes/SpecialLockdb.php (limited to 'includes/SpecialLockdb.php') diff --git a/includes/SpecialLockdb.php b/includes/SpecialLockdb.php deleted file mode 100644 index b523591c..00000000 --- a/includes/SpecialLockdb.php +++ /dev/null @@ -1,134 +0,0 @@ -isAllowed( 'siteadmin' ) ) { - $wgOut->permissionRequired( 'siteadmin' ); - return; - } - - # If the lock file isn't writable, we can do sweet bugger all - global $wgReadOnlyFile; - if( !is_writable( dirname( $wgReadOnlyFile ) ) ) { - DBLockForm::notWritable(); - return; - } - - $action = $wgRequest->getVal( 'action' ); - $f = new DBLockForm(); - - if ( 'success' == $action ) { - $f->showSuccess(); - } else if ( 'submit' == $action && $wgRequest->wasPosted() && - $wgUser->matchEditToken( $wgRequest->getVal( 'wpEditToken' ) ) ) { - $f->doSubmit(); - } else { - $f->showForm( '' ); - } -} - -/** - * A form to make the database readonly (eg for maintenance purposes). - * @addtogroup SpecialPage - */ -class DBLockForm { - var $reason = ''; - - function DBLockForm() { - global $wgRequest; - $this->reason = $wgRequest->getText( 'wpLockReason' ); - } - - function showForm( $err ) { - global $wgOut, $wgUser; - - $wgOut->setPagetitle( wfMsg( 'lockdb' ) ); - $wgOut->addWikiMsg( 'lockdbtext' ); - - if ( "" != $err ) { - $wgOut->setSubtitle( wfMsg( 'formerror' ) ); - $wgOut->addHTML( '

' . htmlspecialchars( $err ) . "

\n" ); - } - $lc = htmlspecialchars( wfMsg( 'lockconfirm' ) ); - $lb = htmlspecialchars( wfMsg( 'lockbtn' ) ); - $elr = htmlspecialchars( wfMsg( 'enterlockreason' ) ); - $titleObj = SpecialPage::getTitleFor( 'Lockdb' ); - $action = $titleObj->escapeLocalURL( 'action=submit' ); - $reason = htmlspecialchars( $this->reason ); - $token = htmlspecialchars( $wgUser->editToken() ); - - $wgOut->addHTML( << -{$elr}: - - - - - - - - - - -
- - {$lc}
  - -
- - -END -); - - } - - function doSubmit() { - global $wgOut, $wgUser, $wgLang, $wgRequest; - global $wgReadOnlyFile; - - if ( ! $wgRequest->getCheck( 'wpLockConfirm' ) ) { - $this->showForm( wfMsg( 'locknoconfirm' ) ); - return; - } - $fp = @fopen( $wgReadOnlyFile, 'w' ); - - if ( false === $fp ) { - # This used to show a file not found error, but the likeliest reason for fopen() - # to fail at this point is insufficient permission to write to the file...good old - # is_writable() is plain wrong in some cases, it seems... - $this->notWritable(); - return; - } - fwrite( $fp, $this->reason ); - fwrite( $fp, "\n

(by " . $wgUser->getName() . " at " . - $wgLang->timeanddate( wfTimestampNow() ) . ")\n" ); - fclose( $fp ); - - $titleObj = SpecialPage::getTitleFor( 'Lockdb' ); - $wgOut->redirect( $titleObj->getFullURL( 'action=success' ) ); - } - - function showSuccess() { - global $wgOut; - - $wgOut->setPagetitle( wfMsg( 'lockdb' ) ); - $wgOut->setSubtitle( wfMsg( 'lockdbsuccesssub' ) ); - $wgOut->addWikiMsg( 'lockdbsuccesstext' ); - } - - public static function notWritable() { - global $wgOut; - $wgOut->errorPage( 'lockdb', 'lockfilenotwritable' ); - } - -} - - -- cgit v1.2.3-54-g00ecf