Skip to content

Commit 82884a9

Browse files
committed
Files are listed in a sorted order.
Previously files were listed/copied in somehow random order. After this change, files should be listed/copied in a chronological order, from oldest to newest. This should make file listing more predictable because latest files should be at the end of the list.
1 parent 0cf654b commit 82884a9

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

src/ios_backup_extractor.pl

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,19 @@ sub extractMediaFiles
389389
or die "Error: Cannot open ‘$tmp_manifest_db’ as SQLite db: $DBI::errstr.\n";
390390

391391
my $eval_ok = eval {
392-
my $sql = 'SELECT fileID, domain, relativePath, file FROM files';
393-
my $sth = $dbh->prepare ($sql);
394-
$sth->execute();
392+
my $sql = <<~SQL_END;
393+
SELECT fileID, relativePath, file FROM files
394+
WHERE domain='CameraRollDomain'
395+
ORDER BY relativePath ASC
396+
SQL_END
397+
398+
my $sth = $dbh->prepare ($sql)
399+
or die qq{Error: 'prepare' method failed on$tmp_manifest_db’ SQLite db:\n},
400+
qq{\t$DBI::errstr.\n};
401+
402+
$sth->execute()
403+
or die qq{Warning: 'execute' method failed on$tmp_manifest_db’ SQLite db:\n},
404+
qq{\t$DBI::errstr.\n};
395405
396406
my $file_index = 1;
397407
@@ -401,8 +411,7 @@ sub extractMediaFiles
401411
my $file_id = $row->{fileID};
402412
my $relative_path = $row->{relativePath};
403413
404-
next unless ( $row->{domain} eq 'CameraRollDomain'
405-
&& $relative_path !~ /thumb/i
414+
next unless ( $relative_path !~ /thumb/i
406415
&& $relative_path !~ /metadata/i
407416
&& $relative_path =~ /\.$wanted_extensions$/i);
408417
@@ -1110,7 +1119,7 @@ ($tmp_fh)
11101119
11111120
my $sth = $dbh->prepare ($sql)
11121121
or do {
1113-
warn qq{Warning: 'prepare' method failed on$tmp_photos_db’ SQLite db:},
1122+
warn qq{Warning: 'prepare' method failed on ‘$tmp_photos_db’ SQLite db:\n},
11141123
qq{\t$DBI::errstr.\n}
11151124
if $cmd_options{verbose};
11161125
@@ -1119,7 +1128,7 @@ ($tmp_fh)
11191128
11201129
$sth->execute()
11211130
or do {
1122-
warn qq{Warning: 'execute' method failed on$tmp_photos_db’ SQLite db:},
1131+
warn qq{Warning: 'execute' method failed on ‘$tmp_photos_db’ SQLite db:\n},
11231132
qq{\t$DBI::errstr.\n}
11241133
if $cmd_options{verbose};
11251134

0 commit comments

Comments
 (0)