array( 'type' => 'textarea', 'rows' => 4, 'vertical-label' => true, 'label-message' => 'enterlockreason', ), 'Confirm' => array( 'type' => 'toggle', 'label-message' => 'lockconfirm', ), ); } protected function alterForm( HTMLForm $form ) { $form->setWrapperLegend( false ); $form->setHeaderText( $this->msg( 'lockdbtext' )->parseAsBlock() ); $form->setSubmitTextMsg( 'lockbtn' ); } public function onSubmit( array $data ) { global $wgContLang, $wgReadOnlyFile; if ( !$data['Confirm'] ) { return Status::newFatal( 'locknoconfirm' ); } wfSuppressWarnings(); $fp = fopen( $wgReadOnlyFile, 'w' ); wfRestoreWarnings(); 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... return Status::newFatal( 'lockfilenotwritable' ); } fwrite( $fp, $data['Reason'] ); $timestamp = wfTimestampNow(); fwrite( $fp, "\n
" . $this->msg( 'lockedbyandtime', $this->getUser()->getName(), $wgContLang->date( $timestamp, false, false ), $wgContLang->time( $timestamp, false, false ) )->inContentLanguage()->text() . "
\n" ); fclose( $fp ); return Status::newGood(); } public function onSuccess() { $out = $this->getOutput(); $out->addSubtitle( $this->msg( 'lockdbsuccesssub' ) ); $out->addWikiMsg( 'lockdbsuccesstext' ); } }