X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FdeleteOldRevisions.php;h=24a63a3eebc2c0a1121524cc43f05cb4afddd5cd;hb=558b28003fc234f9c7ab3dfd83c8364f4e7260bc;hp=123163fb2b2286f1452c9cefde0da2568595d6fe;hpb=920c06e42c307fcaea47d9b65e09303aded2d1c9;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/deleteOldRevisions.php b/maintenance/deleteOldRevisions.php index 123163fb2b..24a63a3eeb 100644 --- a/maintenance/deleteOldRevisions.php +++ b/maintenance/deleteOldRevisions.php @@ -42,14 +42,14 @@ class DeleteOldRevisions extends Maintenance { $this->doDelete( $this->hasOption( 'delete' ), $this->mArgs ); } - function doDelete( $delete = false, $args = array() ) { + function doDelete( $delete = false, $args = [] ) { # Data should come off the master, wrapped in a transaction $dbw = $this->getDB( DB_MASTER ); $this->beginTransaction( $dbw, __METHOD__ ); - $pageConds = array(); - $revConds = array(); + $pageConds = []; + $revConds = []; # If a list of page_ids was provided, limit results to that set of page_ids if ( count( $args ) > 0 ) { @@ -61,7 +61,7 @@ class DeleteOldRevisions extends Maintenance { # Get "active" revisions from the page table $this->output( "Searching for active revisions..." ); $res = $dbw->select( 'page', 'page_latest', $pageConds, __METHOD__ ); - $latestRevs = array(); + $latestRevs = []; foreach ( $res as $row ) { $latestRevs[] = $row->page_latest; } @@ -73,7 +73,7 @@ class DeleteOldRevisions extends Maintenance { $revConds[] = 'rev_id NOT IN (' . $dbw->makeList( $latestRevs ) . ')'; } $res = $dbw->select( 'revision', 'rev_id', $revConds, __METHOD__ ); - $oldRevs = array(); + $oldRevs = []; foreach ( $res as $row ) { $oldRevs[] = $row->rev_id; } @@ -86,7 +86,7 @@ class DeleteOldRevisions extends Maintenance { # Delete as appropriate if ( $delete && $count ) { $this->output( "Deleting..." ); - $dbw->delete( 'revision', array( 'rev_id' => $oldRevs ), __METHOD__ ); + $dbw->delete( 'revision', [ 'rev_id' => $oldRevs ], __METHOD__ ); $this->output( "done.\n" ); }