Skip to content

Commit

Permalink
Handle filemissing in grabNewFiles
Browse files Browse the repository at this point in the history
  • Loading branch information
TehKittyCat committed Oct 7, 2023
1 parent 2173ada commit c228351
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions grabNewFiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,11 @@ function processNewUpload( $title, $timestamp ) {
$currentEntry = null;
$oldArchiveName = null;
foreach ( $page['imageinfo'] as $fileVersion ) {
// Skip missing file version.
if ( isset( $fileVersion['filemissing'] ) ) {
$this->output( "Skipping missing file version...\n" );
continue;
}
if ( is_null( $currentEntry ) ) {
if ( $fileVersion['timestamp'] == $timestamp ) {
$currentEntry = $fileVersion;
Expand Down Expand Up @@ -472,6 +477,12 @@ function processPendingUploads( $title ) {
return;
}

// Skip missing file version.
if ( isset( $fileVersion['filemissing'] ) ) {
$this->output( "Skipping missing file version...\n" );
continue;
}

# The code will enter this conditional only on the last iteration,
# or before if it happens that there are multiple files with
# the same timestamp than our latest version
Expand Down Expand Up @@ -602,13 +613,17 @@ function processPendingDeletions( $title, $reason, $user ) {
return;
}
foreach ( $page['imageinfo'] as $fileVersion ) {
$timestamp = wfTimestamp( TS_MW, $fileVersion['timestamp'] );

# Check for Wikia's videos
if ( $this->isWikiaVideo( $fileVersion ) ) {
$this->output( "...this appears to be a video, skipping it.\n" );
return;
}
// Skip missing file version.
if ( isset( $fileVersion['filemissing'] ) ) {
$this->output( "Skipping missing file version...\n" );
continue;
}
$timestamp = wfTimestamp( TS_MW, $fileVersion['timestamp'] );

if ( $moveOldImage && $fileVersion['timestamp'] == $ourtimestamp ) {
# Our current revision is found.
Expand Down

0 comments on commit c228351

Please sign in to comment.