Merge "Normalize "LEFT OUTER JOIN" to "LEFT JOIN" in SQL queries"
[lhc/web/wiklou.git] / maintenance / cleanupBlocks.php
index 5c5c88f..15bb4f3 100644 (file)
@@ -55,8 +55,8 @@ class CleanupBlocks extends Maintenance {
                                'ipblocks',
                                [ 'ipb_user' ],
                                [
-                                       "ipb_user >= $from",
-                                       "ipb_user <= $to",
+                                       "ipb_user >= " . (int)$from,
+                                       "ipb_user <= " . (int)$to,
                                ],
                                __METHOD__,
                                [
@@ -92,11 +92,12 @@ class CleanupBlocks extends Maintenance {
                                                $keep = $block->getExpiry() > $bestBlock->getExpiry();
                                        }
                                        if ( $keep === null ) {
-                                               foreach ( [ 'createaccount', 'sendemail', 'editownusertalk' ] as $action ) {
-                                                       if ( $block->prevents( $action ) xor $bestBlock->prevents( $action ) ) {
-                                                               $keep = $block->prevents( $action );
-                                                               break;
-                                                       }
+                                               if ( $block->isCreateAccountBlocked() xor $bestBlock->isCreateAccountBlocked() ) {
+                                                       $keep = $block->isCreateAccountBlocked();
+                                               } elseif ( $block->isEmailBlocked() xor $bestBlock->isEmailBlocked() ) {
+                                                       $keep = $block->isEmailBlocked();
+                                               } elseif ( $block->isUsertalkEditAllowed() xor $bestBlock->isUsertalkEditAllowed() ) {
+                                                       $keep = $block->isUsertalkEditAllowed();
                                                }
                                        }
 
@@ -128,8 +129,8 @@ class CleanupBlocks extends Maintenance {
                                [ 'ipb_id', 'user_name' ],
                                [
                                        'ipb_user = user_id',
-                                       "ipb_user >= $from",
-                                       "ipb_user <= $to",
+                                       "ipb_user >= " . (int)$from,
+                                       "ipb_user <= " . (int)$to,
                                        'ipb_address != user_name',
                                ],
                                __METHOD__
@@ -148,5 +149,5 @@ class CleanupBlocks extends Maintenance {
        }
 }
 
-$maintClass = "CleanupBlocks";
+$maintClass = CleanupBlocks::class;
 require_once RUN_MAINTENANCE_IF_MAIN;