Merge "Removed old HTMLCacheUpdateJob b/c code"
[lhc/web/wiklou.git] / includes / api / ApiQueryLogEvents.php
index 3cdc53c..adf96fd 100644 (file)
@@ -310,14 +310,21 @@ class ApiQueryLogEvents extends ApiQueryBase {
                                if ( $action == 'unblock' ) {
                                        break;
                                }
+                               if ( $legacy ) {
+                                       $durationKey = 0;
+                                       $flagsKey = 1;
+                               } else {
+                                       $durationKey = '5::duration';
+                                       $flagsKey = '6::flags';
+                               }
                                $vals2 = array();
-                               $vals2['duration'] = $params[0];
-                               $vals2['flags'] = isset( $params[1] ) ? $params[1] : '';
+                               $vals2['duration'] = $params[$durationKey];
+                               $vals2['flags'] = isset( $params[$flagsKey] ) ? $params[$flagsKey] : '';
 
                                // Indefinite blocks have no expiry time
-                               if ( SpecialBlock::parseExpiryInput( $params[0] ) !== wfGetDB( DB_SLAVE )->getInfinity() ) {
+                               if ( SpecialBlock::parseExpiryInput( $params[$durationKey] ) !== wfGetDB( DB_SLAVE )->getInfinity() ) {
                                        $vals2['expiry'] = wfTimestamp( TS_ISO_8601,
-                                               strtotime( $params[0], wfTimestamp( TS_UNIX, $ts ) ) );
+                                               strtotime( $params[$durationKey], wfTimestamp( TS_UNIX, $ts ) ) );
                                }
                                $vals[$type] = $vals2;
                                $params = null;
@@ -338,6 +345,36 @@ class ApiQueryLogEvents extends ApiQueryBase {
                                        unset( $params['5::mergepoint'] );
                                }
                                break;
+                       case 'delete':
+                               if ( $action === 'event' || $action === 'revision' ) {
+                                       // replace the named parameter with numbered for backward compatibility
+                                       if ( $action === 'event' ) {
+                                               $idsKey = '4::ids';
+                                               $ofieldKey = '5::ofield';
+                                               $nfieldKey = '6::nfield';
+                                       } else {
+                                               if ( isset( $params['4::type'] ) ) {
+                                                       $params[] = $params['4::type'];
+                                                       unset( $params['4::type'] );
+                                               }
+                                               $idsKey = '5::ids';
+                                               $ofieldKey = '6::ofield';
+                                               $nfieldKey = '7::nfield';
+                                       }
+                                       if ( isset( $params[$idsKey] ) ) {
+                                               $params[] = implode( ',', $params[$idsKey] );
+                                               unset( $params[$idsKey] );
+                                       }
+                                       if ( isset( $params[$ofieldKey] ) ) {
+                                               $params[] = $params[$ofieldKey];
+                                               unset( $params[$ofieldKey] );
+                                       }
+                                       if ( isset( $params[$nfieldKey] ) ) {
+                                               $params[] = $params[$nfieldKey];
+                                               unset( $params[$nfieldKey] );
+                                       }
+                               }
+                               break;
                }
                if ( !is_null( $params ) ) {
                        $logParams = array();