* (bug 24089) Logevents causes PHP Notice if leprop=title isn't supplied
authorSam Reed <reedy@users.mediawiki.org>
Wed, 23 Jun 2010 12:34:59 +0000 (12:34 +0000)
committerSam Reed <reedy@users.mediawiki.org>
Wed, 23 Jun 2010 12:34:59 +0000 (12:34 +0000)
Patch by John Du Hart

Add a couple of missing braces

CREDITS
RELEASE-NOTES
includes/api/ApiQueryLogEvents.php

diff --git a/CREDITS b/CREDITS
index 10a77d4..1469bbc 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -88,6 +88,7 @@ following names for their contribution to the product.
 * Jeremy Baron
 * Jidanni
 * Jimmy Xu
+* John Du Hart
 * Karun Dambietz
 * Kim Hyun-Joon
 * Lee Worden
index 0b584d3..6b55caf 100644 (file)
@@ -240,6 +240,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * (bug 24016) API: Handle parameters specified in simple string syntax 
   ( 'paramname' => 'defaultval' ) correctly when outputting help
 * (bug 19910) Headings of the form ===+\s+ are now displayed as valid headings
+* (bug 24089) Logevents causes PHP Notice if leprop=title isn't supplied
 
 === Languages updated in 1.17 ===
 
index f98a100..1786b01 100644 (file)
@@ -85,8 +85,8 @@ class ApiQueryLogEvents extends ApiQueryBase {
                $this->addFieldsIf( 'page_id', $this->fld_ids );
                $this->addFieldsIf( 'log_user', $this->fld_user );
                $this->addFieldsIf( 'user_name', $this->fld_user );
-               $this->addFieldsIf( 'log_namespace', $this->fld_title );
-               $this->addFieldsIf( 'log_title', $this->fld_title );
+               $this->addFieldsIf( 'log_namespace', $this->fld_title || $this->fld_parsedcomment );
+               $this->addFieldsIf( 'log_title', $this->fld_title || $this->fld_parsedcomment );
                $this->addFieldsIf( 'log_comment', $this->fld_comment || $this->fld_parsedcomment );
                $this->addFieldsIf( 'log_params', $this->fld_details );
 
@@ -231,7 +231,9 @@ class ApiQueryLogEvents extends ApiQueryBase {
                        $vals['pageid'] = intval( $row->page_id );
                }
 
-               $title = Title::makeTitle( $row->log_namespace, $row->log_title );
+               if( $this->fld_title || $this->fld_parsedcomment ) {
+                       $title = Title::makeTitle( $row->log_namespace, $row->log_title );
+               }
 
                if ( $this->fld_title ) {
                        if ( LogEventsList::isDeleted( $row, LogPage::DELETED_ACTION ) ) {
@@ -263,8 +265,9 @@ class ApiQueryLogEvents extends ApiQueryBase {
                                $vals['userhidden'] = '';
                        } else {
                                $vals['user'] = $row->user_name;
-                               if ( !$row->log_user )
+                               if ( !$row->log_user ) {
                                        $vals['anon'] = '';
+                               }
                        }
                }
                if ( $this->fld_timestamp ) {