same minor typo as in LocalSettings (in example config url)
[mediawiki.git] / includes / SpecialUnlockdb.php
blobe8d26e50c7a143c79f6956556c783ab5a3bdfd00
1 <?
3 function wfSpecialUnlockdb()
5 global $wgUser, $wgOut, $action;
7 if ( ! $wgUser->isDeveloper() ) {
8 $wgOut->developerRequired();
9 return;
11 $f = new DBUnlockForm();
13 if ( "success" == $action ) { $f->showSuccess(); }
14 else if ( "submit" == $action ) { $f->doSubmit(); }
15 else { $f->showForm( "" ); }
18 class DBUnlockForm {
20 function showForm( $err )
22 global $wgOut, $wgUser, $wgLang;
23 global $wpLockConfirm;
25 $wgOut->setPagetitle( wfMsg( "unlockdb" ) );
26 $wgOut->addWikiText( wfMsg( "unlockdbtext" ) );
28 if ( "" != $err ) {
29 $wgOut->setSubtitle( wfMsg( "formerror" ) );
30 $wgOut->addHTML( "<p><font color='red' size='+1'>{$err}</font>\n" );
32 $lc = wfMsg( "unlockconfirm" );
33 $lb = wfMsg( "unlockbtn" );
34 $action = wfLocalUrlE( $wgLang->specialPage( "Unlockdb" ),
35 "action=submit" );
37 $wgOut->addHTML( "<p>
38 <form id=\"unlockdb\" method=\"post\" action=\"{$action}\">
39 <table border=0><tr>
40 <td align=right>
41 <input type=checkbox name=\"wpLockConfirm\">
42 </td>
43 <td align=\"left\">{$lc}<td>
44 </tr><tr>
45 <td>&nbsp;</td><td align=left>
46 <input type=submit name=\"wpLock\" value=\"{$lb}\">
47 </td></tr></table>
48 </form>\n" );
52 function doSubmit()
54 global $wgOut, $wgUser, $wgLang;
55 global $wpLockConfirm, $wgReadOnlyFile;
57 if ( ! $wpLockConfirm ) {
58 $this->showForm( wfMsg( "locknoconfirm" ) );
59 return;
61 if ( ! unlink( $wgReadOnlyFile ) ) {
62 $wgOut->fileDeleteError( $wgReadOnlyFile );
63 return;
65 $success = wfLocalUrl( $wgLang->specialPage( "Unlockdb" ),
66 "action=success" );
67 $wgOut->redirect( $success );
70 function showSuccess()
72 global $wgOut, $wgUser;
73 global $ip;
75 $wgOut->setPagetitle( wfMsg( "unlockdb" ) );
76 $wgOut->setSubtitle( wfMsg( "unlockdbsuccesssub" ) );
77 $wgOut->addWikiText( wfMsg( "unlockdbsuccesstext", $ip ) );