Wikia code/includes/specials/SpecialLockdb.php
This page is obsolete. It is being retained for archival purposes. It may document extensions or features that are obsolete and/or no longer supported. Do not rely on the information here being up-to-date. The information shown below refers to the now unmaintained 1.16 MediaWiki release. The current stable release number is 1.42.3. |
--- D:\Programming\SVN\mediawiki\branches\REL1_16\phase3\includes\specials\SpecialLockdb.php 2011-07-18 22:31:17.678711000 +0100
+++ D:\Programming\SVN\wikia\trunk\includes\specials\SpecialLockdb.php 2011-08-17 15:28:16.325195300 +0100
@@ -91,26 +91,40 @@
}
function doSubmit() {
- global $wgOut, $wgUser, $wgLang, $wgRequest;
+ /*
+ * WIKIA-SPECIFIC CHANGES
+ * use $wgReadOnly instead, to prevent unnecessary stat()s (rt#20875)
+ */
+ global $wgOut, $wgUser, $wgLang, $wgRequest, $wgCityId;
global $wgReadOnlyFile;
if ( ! $wgRequest->getCheck( 'wpLockConfirm' ) ) {
$this->showForm( wfMsg( 'locknoconfirm' ) );
return;
}
- $fp = @fopen( $wgReadOnlyFile, 'w' );
+ /*
+ * WIKIA-SPECIFIC CHANGES
+ * use $wgReadOnly instead, to prevent unnecessary stat()s (rt#20875)
+ */
+# $fp = @fopen( $wgReadOnlyFile, 'w' );
+
+ $reason = $this->reason . "\nby " . $wgUser->getName() . ' at ' . $wgLang->timeanddate( wfTimestampNow() );
+ if ( !WikiFactory::setVarByName( 'wgReadOnly', $wgCityId, $reason ) || !WikiFactory::clearCache( $wgCityId ) ) {
+ $wgOut->showErrorPage( 'lockdb', 'lockdb-wikifactory-error');
+ return;
+ }
- if ( false === $fp ) {
+# 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...
- self::notWritable();
- return;
- }
- fwrite( $fp, $this->reason );
- fwrite( $fp, "\n<p>(by " . $wgUser->getName() . " at " .
- $wgLang->timeanddate( wfTimestampNow() ) . ")</p>\n" );
- fclose( $fp );
+# self::notWritable();
+# return;
+# }
+# fwrite( $fp, $this->reason );
+# fwrite( $fp, "\n<p>(by " . $wgUser->getName() . " at " .
+# $wgLang->timeanddate( wfTimestampNow() ) . ")</p>\n" );
+# fclose( $fp );
$titleObj = SpecialPage::getTitleFor( 'Lockdb' );
$wgOut->redirect( $titleObj->getFullURL( 'action=success' ) );