X-Git-Url: http://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Frebuildrecentchanges.php;h=66095310602de48c2c194975ffc11137b15dce9f;hb=b114f5e1c197f704522f81f1ec5d855e7ee126ad;hp=5caa0a8fc0c2ccac58a3a47fb1a6faf1bccbee0d;hpb=cf69bb176b9fb39502454614e67750bba07d3d4c;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/rebuildrecentchanges.php b/maintenance/rebuildrecentchanges.php index 5caa0a8fc0..6609531060 100644 --- a/maintenance/rebuildrecentchanges.php +++ b/maintenance/rebuildrecentchanges.php @@ -23,7 +23,7 @@ * @todo Document */ -require_once( dirname( __FILE__ ) . '/Maintenance.php' ); +require_once( __DIR__ . '/Maintenance.php' ); /** * Maintenance script that rebuilds recent changes from scratch. @@ -61,9 +61,9 @@ class RebuildRecentchanges extends Maintenance { $this->output( '$wgRCMaxAge=' . $wgRCMaxAge ); $days = $wgRCMaxAge / 24 / 3600; if ( intval( $days ) == $days ) { - $this->output( " (" . $days . " days)\n" ); + $this->output( " (" . $days . " days)\n" ); } else { - $this->output( " (approx. " . intval( $days ) . " days)\n" ); + $this->output( " (approx. " . intval( $days ) . " days)\n" ); } $cutoff = time() - $wgRCMaxAge; @@ -105,7 +105,7 @@ class RebuildRecentchanges extends Maintenance { # Fill in the rc_last_oldid field, which points to the previous edit $sql = "SELECT rc_cur_id,rc_this_oldid,rc_timestamp FROM $recentchanges " . - "ORDER BY rc_cur_id,rc_timestamp"; + "ORDER BY rc_cur_id,rc_timestamp"; $res = $dbw->query( $sql, DB_MASTER ); $lastCurId = 0; @@ -142,12 +142,12 @@ class RebuildRecentchanges extends Maintenance { $dbw->update( 'recentchanges', array( 'rc_last_oldid' => $lastOldId, - 'rc_new' => $new, - 'rc_type' => $new, - 'rc_old_len' => $lastSize, - 'rc_new_len' => $size, + 'rc_new' => $new, + 'rc_type' => $new, + 'rc_old_len' => $lastSize, + 'rc_new_len' => $size, ), array( - 'rc_cur_id' => $lastCurId, + 'rc_cur_id' => $lastCurId, 'rc_this_oldid' => $obj->rc_this_oldid, ), __METHOD__ @@ -218,24 +218,17 @@ class RebuildRecentchanges extends Maintenance { * DOCUMENT ME! */ private function rebuildRecentChangesTablePass4() { - global $wgGroupPermissions, $wgUseRCPatrol; + global $wgUseRCPatrol; $dbw = wfGetDB( DB_MASTER ); list( $recentchanges, $usergroups, $user ) = $dbw->tableNamesN( 'recentchanges', 'user_groups', 'user' ); - $botgroups = $autopatrolgroups = array(); - foreach ( $wgGroupPermissions as $group => $rights ) { - if ( isset( $rights['bot'] ) && $rights['bot'] ) { - $botgroups[] = $dbw->addQuotes( $group ); - } - if ( $wgUseRCPatrol && isset( $rights['autopatrol'] ) && $rights['autopatrol'] ) { - $autopatrolgroups[] = $dbw->addQuotes( $group ); - } - } + $botgroups = User::getGroupsWithPermission( 'bot' ); + $autopatrolgroups = $wgUseRCPatrol ? User::getGroupsWithPermission( 'autopatrol' ) : array(); # Flag our recent bot edits if ( !empty( $botgroups ) ) { - $botwhere = implode( ',', $botgroups ); + $botwhere = $dbw->makeList( $botgroups ); $botusers = array(); $this->output( "Flagging bot account edits...\n" ); @@ -259,7 +252,7 @@ class RebuildRecentchanges extends Maintenance { global $wgMiserMode; # Flag our recent autopatrolled edits if ( !$wgMiserMode && !empty( $autopatrolgroups ) ) { - $patrolwhere = implode( ',', $autopatrolgroups ); + $patrolwhere = $dbw->makeList( $autopatrolgroups ); $patrolusers = array(); $this->output( "Flagging auto-patrolled edits...\n" );