* @ingroup SpecialPage
*/
+use MediaWiki\MediaWikiServices;
+
/**
* A form to make the database readonly (eg for maintenance purposes).
*
}
public function onSubmit( array $data ) {
- global $wgContLang;
-
if ( !$data['Confirm'] ) {
return Status::newFatal( 'locknoconfirm' );
}
$fp = fopen( $this->getConfig()->get( 'ReadOnlyFile' ), 'w' );
Wikimedia\restoreWarnings();
- if ( false === $fp ) {
+ if ( $fp === false ) {
# 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...
}
fwrite( $fp, $data['Reason'] );
$timestamp = wfTimestampNow();
+ $contLang = MediaWikiServices::getInstance()->getContentLanguage();
fwrite( $fp, "\n<p>" . $this->msg( 'lockedbyandtime',
$this->getUser()->getName(),
- $wgContLang->date( $timestamp, false, false ),
- $wgContLang->time( $timestamp, false, false )
+ $contLang->date( $timestamp, false, false ),
+ $contLang->time( $timestamp, false, false )
)->inContentLanguage()->text() . "</p>\n" );
fclose( $fp );