Merge "Add two hooks to allow for extensions to expose log_search values in the UI"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 6 Nov 2014 23:00:16 +0000 (23:00 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 6 Nov 2014 23:00:16 +0000 (23:00 +0000)
1  2 
docs/hooks.txt
includes/logging/LogEventsList.php

diff --combined docs/hooks.txt
@@@ -260,6 -260,13 +260,6 @@@ $password: the password being submitted
            a machine API rather than the HTML user interface.
  &$msg: the message identifier for abort reason (new in 1.18, not available before 1.18)
  
 -'AbortMove': Allows to abort moving an article (title).
 -$old: old title
 -$nt: new title
 -$user: user who is doing the move
 -$err: error message
 -$reason: the reason for the move (added in 1.13)
 -
  'AbortNewAccount': Return false to cancel explicit account creation.
  $user: the User object about to be created (read-only, incomplete)
  &$msg: out parameter: HTML to display on abort
@@@ -528,10 -535,6 +528,10 @@@ $error: if the deletion was prohibited
  $status: Status object, modify this to throw an error. Overridden by $error
    (added in 1.20)
  
 +'ArticleDeleteAfterSuccess': Output after an article has been deleted.
 +$title: Title of the article that has been deleted.
 +$outputPage: OutputPage that can be used to append the output.
 +
  'ArticleDeleteComplete': After an article is deleted.
  $wikiPage: the WikiPage that was deleted
  $user: the user that deleted the article
@@@ -1695,6 -1698,13 +1695,13 @@@ optional localisation message
  &$ignored Array of ignored message keys
  &$optional Array of optional message keys
  
+ 'LogEventsListGetExtraInputs': When getting extra inputs to display on Special:Log
+ for a specific log type
+ $type: String of log type being displayed
+ $logEventsList: LogEventsList object for context and access to the WebRequest
+ &$input: string HTML of an input element
  'LogEventsListShowLogExtract': Called before the string is added to OutputPage.
  Returning false will prevent the string from being added to the OutputPage.
  &$s: html string to show for the log extract
@@@ -1832,18 -1842,6 +1839,18 @@@ $db: The database object to be queried
  &$opts: Options for the query.
  &$join_conds: Join conditions for the query.
  
 +'MovePageCheckPermissions': Specify whether the user is allowed to move the page.
 +$oldTitle: Title object of the current (old) location
 +$newTitle: Title object of the new location
 +$user: User making the move
 +$reason: string of the reason provided by the user
 +$status: Status object to pass error messages to
 +
 +'MovePageIsValidMove': Specify whether a page can be moved for technical reasons.
 +$oldTitle: Title object of the current (old) location
 +$newTitle: Title object of the new location
 +$status: Status object to pass error messages to
 +
  'BaseTemplateToolbox': Called by BaseTemplate when building the $toolbox array
  and returning it for the skin to output. You can add items to the toolbox while
  still letting the skin make final decisions on skin-specific markup conventions
@@@ -2474,6 -2472,11 +2481,11 @@@ UsersPager::getQueryInfo(
  $pager: The UsersPager instance
  $query: The query array to be returned
  
+ 'SpecialLogAddLogSearchRelations': Add log relations to the current log
+ $type: String of the log type
+ $request: WebRequest object for getting the value provided by the current user
+ &$qc: Array for query conditions to add
  'SpecialMovepageAfterMove': Called after moving a page.
  $movePage: MovePageForm object
  $oldTitle: old title (object)
@@@ -2876,7 -2879,7 +2888,7 @@@ $user: User objec
  'UserGetLanguageObject': Called when getting user's interface language object.
  $user: User object
  &$code: Language code that will be used to create the object
 -$context: RequestContext object
 +$context: IContextSource object
  
  'UserGetReservedNames': Allows to modify $wgReservedUsernames at run time.
  &$reservedUsernames: $wgReservedUsernames
@@@ -3009,11 -3012,6 +3021,11 @@@ when UserMailer sends an email, with a 
  $to: Array of MailAddress objects for the recipients
  &$returnPath: The return address string
  
 +'LoginFormValidErrorMessages': Called in LoginForm when a function gets valid error
 +messages. Allows to add additional error messages (except messages already in
 +LoginForm::$validErrorMessages).
 +&$messages Already added messages (inclusive messages from LoginForm::$validErrorMessages)
 +
  'WantedPages::getQueryInfo': Called in WantedPagesPage::getQueryInfo(), can be
  used to alter the SQL query which gets the list of wanted pages.
  &$wantedPages: WantedPagesPage object
@@@ -261,14 -261,21 +261,21 @@@ class LogEventsList extends ContextSour
         * @return string
         */
        private function getExtraInputs( $types ) {
-               $offender = $this->getRequest()->getVal( 'offender' );
-               $user = User::newFromName( $offender, false );
-               if ( !$user || ( $user->getId() == 0 && !IP::isIPAddress( $offender ) ) ) {
-                       $offender = ''; // Blank field if invalid
-               }
-               if ( count( $types ) == 1 && $types[0] == 'suppress' ) {
-                       return Xml::inputLabel( $this->msg( 'revdelete-offender' )->text(), 'offender',
-                               'mw-log-offender', 20, $offender );
+               if ( count( $types ) == 1 ) {
+                       if ( $types[0] == 'suppress' ) {
+                               $offender = $this->getRequest()->getVal( 'offender' );
+                               $user = User::newFromName( $offender, false );
+                               if ( !$user || ( $user->getId() == 0 && !IP::isIPAddress( $offender ) ) ) {
+                                       $offender = ''; // Blank field if invalid
+                               }
+                               return Xml::inputLabel( $this->msg( 'revdelete-offender' )->text(), 'offender',
+                                       'mw-log-offender', 20, $offender );
+                       } else {
+                               // Allow extensions to add their own extra inputs
+                               $input = '';
+                               wfRunHooks( 'LogEventsListGetExtraInputs', array( $types[0], $this, &$input ) );
+                               return $input;
+                       }
                }
  
                return '';
                        $pager->mLimit = $lim;
                }
  
 -              $logBody = $pager->getBody();
 +              $logBody = null;
 +              // Check if we can avoid the DB query all together
 +              if ( $page !== '' && !$param['useMaster'] ) {
 +                      $title = ( $page instanceof Title ) ? $page : Title::newFromText( $page );
 +                      if ( $title ) {
 +                              $member = $title->getNamespace() . ':' . $title->getDBkey();
 +                              if ( !BloomCache::get( 'main' )->check( wfWikiId(), 'TitleHasLogs', $member ) ) {
 +                                      $logBody = '';
 +                              }
 +                      } else {
 +                              $logBody = '';
 +                      }
 +              }
 +
 +              // Fetch the log rows and build the HTML if needed
 +              $logBody = ( $logBody === null ) ? $pager->getBody() : $logBody;
 +
                $s = '';
  
                if ( $logBody ) {
                        if ( $msgKey[0] ) {
                                $dir = $context->getLanguage()->getDir();
 -                              $lang = $context->getLanguage()->getCode();
 +                              $lang = $context->getLanguage()->getHtmlCode();
  
                                $s = Xml::openElement( 'div', array(
                                        'class' => "mw-warning-with-logexcerpt mw-content-$dir",