From: Aaron Schulz Date: Fri, 29 Aug 2014 18:03:06 +0000 (-0700) Subject: Made findMissingFiles inspect the destination title for moves X-Git-Tag: 1.31.0-rc.0~14224^2 X-Git-Url: http://git.cyclocoop.org/%7B%24admin_url%7Dmembres/cotisations/gestion/rappel_supprimer.php?a=commitdiff_plain;h=7afa123d39dffa967e8dd8a5f9c0f5c60bc97c5e;p=lhc%2Fweb%2Fwiklou.git Made findMissingFiles inspect the destination title for moves Change-Id: I865f5575bc41bc85a09c9429d70e526c093961ee --- diff --git a/maintenance/findMissingFiles.php b/maintenance/findMissingFiles.php index 8a8bcb14b0..5f9f643a44 100644 --- a/maintenance/findMissingFiles.php +++ b/maintenance/findMissingFiles.php @@ -42,26 +42,29 @@ class FindMissingFiles extends Maintenance { $mtime1 = $dbr->timestampOrNull( $this->getOption( 'mtimeafter', null ) ); $mtime2 = $dbr->timestampOrNull( $this->getOption( 'mtimebefore', null ) ); - $tables = array( 'image' ); - $logJoinOn = array( 'log_namespace' => NS_FILE, 'log_title = img_name' ); - $logJoinOn['log_type'] = array( 'upload', 'move', 'delete' ); - if ( $mtime1 ) { - $logJoinOn[] = "log_timestamp > {$dbr->addQuotes($mtime1)}"; - } - if ( $mtime2 ) { - $logJoinOn[] = "log_timestamp < {$dbr->addQuotes($mtime2)}"; - } + $joinTables = array( 'image' ); + $joinConds = array( 'image' => array( 'INNER JOIN', 'img_name = page_title' ) ); if ( $mtime1 || $mtime2 ) { - $tables[] = 'logging'; + $joinTables[] = 'logging'; + $on = array( 'log_page = page_id', 'log_type' => array( 'upload', 'move', 'delete' ) ); + if ( $mtime1 ) { + $on[] = "log_timestamp > {$dbr->addQuotes($mtime1)}"; + } + if ( $mtime2 ) { + $on[] = "log_timestamp < {$dbr->addQuotes($mtime2)}"; + } + $joinConds['logging'] = array( 'INNER JOIN', $on ); } do { - $res = $dbr->select( $tables, - array( 'img_name' => 'DISTINCT(img_name)' ), - array( "img_name >= " . $dbr->addQuotes( $lastName ) ), + $res = $dbr->select( + array_merge( array( 'page' ), $joinTables ), + array( 'img_name' => 'DISTINCT(page_title)' ), + array( 'page_namespace' => NS_FILE, + "page_title >= " . $dbr->addQuotes( $lastName ) ), __METHOD__, - array( 'ORDER BY' => 'img_name', 'LIMIT' => $this->mBatchSize ), - array( 'logging' => array( 'INNER JOIN', $logJoinOn ) ) + array( 'ORDER BY' => 'page_title', 'LIMIT' => $this->mBatchSize ), + $joinConds ); // Check if any of these files are missing...