Merge "user: Allow "CAS update failed" exceptions to be normalised"
[lhc/web/wiklou.git] / includes / logging / LogEventsList.php
index 73aaa4f..a5aa687 100644 (file)
@@ -110,8 +110,6 @@ class LogEventsList extends ContextSource {
        public function showOptions( $types = [], $user = '', $page = '', $pattern = false, $year = 0,
                $month = 0, $day = 0, $filter = null, $tagFilter = '', $action = null
        ) {
-               $title = SpecialPage::getTitleFor( 'Log' );
-
                // For B/C, we take strings, but make sure they are converted...
                $types = ( $types === '' ) ? [] : (array)$types;
 
@@ -120,7 +118,7 @@ class LogEventsList extends ContextSource {
                // Basic selectors
                $formDescriptor['type'] = $this->getTypeMenuDesc( $types );
                $formDescriptor['user'] = $this->getUserInputDesc( $user );
-               $formDescriptor['page'] = $this->getTitleInputDesc( $title );
+               $formDescriptor['page'] = $this->getTitleInputDesc( $page );
 
                // Add extra inputs if any
                // This could either be a form descriptor array or a string with raw HTML.
@@ -132,10 +130,13 @@ class LogEventsList extends ContextSource {
                        !empty( $extraInputsDescriptor )
                ) {
                        $formDescriptor[ 'extra' ] = $extraInputsDescriptor;
-               } elseif ( is_string( $extraInputsDescriptor ) ) {
+               } elseif (
+                       is_string( $extraInputsDescriptor ) &&
+                       $extraInputsDescriptor !== ''
+               ) {
                        // We'll add this to the footer of the form later
                        $extraInputsString = $extraInputsDescriptor;
-                       wfDeprecated( 'Using $input in LogEventsListGetExtraInputs hook', '1.32' );
+                       wfDeprecated( '$input in LogEventsListGetExtraInputs hook', '1.32' );
                }
 
                // Title pattern, if allowed
@@ -146,7 +147,8 @@ class LogEventsList extends ContextSource {
                // Date menu
                $formDescriptor['date'] = [
                        'type' => 'date',
-                       'label-message' => 'date'
+                       'label-message' => 'date',
+                       'default' => sprintf( "%04d-%02d-%02d", $year, $month, $day ),
                ];
 
                // Tag filter
@@ -170,7 +172,9 @@ class LogEventsList extends ContextSource {
                        $formDescriptor['subtype'] = $this->getActionSelectorDesc( $types, $action );
                }
 
-               $htmlForm = new HTMLForm( $formDescriptor, $this->getContext() );
+               $context = new DerivativeContext( $this->getContext() );
+               $context->setTitle( SpecialPage::getTitleFor( 'Log' ) ); // Remove subpage
+               $htmlForm = new HTMLForm( $formDescriptor, $context );
                $htmlForm
                        ->setSubmitText( $this->msg( 'logeventslist-submit' )->text() )
                        ->setMethod( 'get' )
@@ -203,7 +207,7 @@ class LogEventsList extends ContextSource {
                        }
                        $options[ $message->text() ] = $type;
 
-                       if ( $val === 0 ) {
+                       if ( $val === false ) {
                                $default[] = $type;
                        }
                }
@@ -273,6 +277,7 @@ class LogEventsList extends ContextSource {
                        'class' => 'HTMLUserTextField',
                        'label-message' => 'specialloguserlabel',
                        'name' => 'user',
+                       'default' => $user,
                ];
        }