Add `actor` table and code to start using it
[lhc/web/wiklou.git] / includes / specials / SpecialRedirect.php
index 3273046..36e7779 100644 (file)
@@ -177,11 +177,13 @@ class SpecialRedirect extends FormSpecialPage {
                        return null;
                }
 
+               $logQuery = ActorMigration::newMigration()->getJoin( 'log_user' );
+
                $logparams = [
-                       'log_id',
-                       'log_timestamp',
-                       'log_type',
-                       'log_user_text',
+                       'log_id' => 'log_id',
+                       'log_timestamp' => 'log_timestamp',
+                       'log_type' => 'log_type',
+                       'log_user_text' => $logQuery['fields']['log_user_text'],
                ];
 
                $dbr = wfGetDB( DB_REPLICA );
@@ -197,9 +199,12 @@ class SpecialRedirect extends FormSpecialPage {
                // Returns all fields mentioned in $logparams of the logs
                // with the same timestamp as the one returned by the statement above
                $logsSameTimestamps = $dbr->select(
-                       'logging',
+                       [ 'logging' ] + $logQuery['tables'],
                        $logparams,
-                       [ "log_timestamp = ($inner)" ]
+                       [ "log_timestamp = ($inner)" ],
+                       __METHOD__,
+                       [],
+                       $logQuery['joins']
                );
                if ( $logsSameTimestamps->numRows() === 0 ) {
                        return null;
@@ -217,10 +222,10 @@ class SpecialRedirect extends FormSpecialPage {
 
                // Stores all the rows with the same values in each column
                // as $rowMain
-               foreach ( $logparams as $cond ) {
+               foreach ( $logparams as $key => $dummy ) {
                        $matchedRows = [];
                        foreach ( $logsSameTimestamps as $row ) {
-                               if ( $row->$cond === $rowMain->$cond ) {
+                               if ( $row->$key === $rowMain->$key ) {
                                        $matchedRows[] = $row;
                                }
                        }
@@ -238,7 +243,7 @@ class SpecialRedirect extends FormSpecialPage {
                        'log_user_text' => 'user'
                ];
 
-               foreach ( $logparams as $logKey ) {
+               foreach ( $logparams as $logKey => $dummy ) {
                        $query[$keys[$logKey]] = $matchedRows[0]->$logKey;
                }
                $query['offset'] = $query['offset'] + 1;