|
@@ 176-185 (lines=10) @@
|
| 173 |
|
|
| 174 |
|
if ( $logType === 'delete' ) { |
| 175 |
|
// If there is an orphaned storage file... delete it |
| 176 |
|
if ( !$file->exists() && $repo->fileExists( $file->getPath() ) ) { |
| 177 |
|
$dpath = $this->getDeletedPath( $repo, $file ); |
| 178 |
|
if ( $repo->fileExists( $dpath ) ) { |
| 179 |
|
// Sanity check to avoid data loss |
| 180 |
|
$repo->getBackend()->delete( [ 'src' => $file->getPath() ] ); |
| 181 |
|
$this->verbose( "Deleted orphan file: {$file->getPath()}.\n" ); |
| 182 |
|
} else { |
| 183 |
|
$this->error( "File was not deleted: {$file->getPath()}.\n" ); |
| 184 |
|
} |
| 185 |
|
} |
| 186 |
|
|
| 187 |
|
// Purge items from fileachive table (rows are likely here) |
| 188 |
|
$this->purgeFromArchiveTable( $repo, $file ); |
|
@@ 228-237 (lines=10) @@
|
| 225 |
|
} |
| 226 |
|
$ofile = $repo->newFromArchiveName( $file->getTitle(), $row->fa_archive_name ); |
| 227 |
|
// If there is an orphaned storage file still there...delete it |
| 228 |
|
if ( !$file->exists() && $repo->fileExists( $ofile->getPath() ) ) { |
| 229 |
|
$dpath = $this->getDeletedPath( $repo, $ofile ); |
| 230 |
|
if ( $repo->fileExists( $dpath ) ) { |
| 231 |
|
// Sanity check to avoid data loss |
| 232 |
|
$repo->getBackend()->delete( [ 'src' => $ofile->getPath() ] ); |
| 233 |
|
$this->output( "Deleted orphan file: {$ofile->getPath()}.\n" ); |
| 234 |
|
} else { |
| 235 |
|
$this->error( "File was not deleted: {$ofile->getPath()}.\n" ); |
| 236 |
|
} |
| 237 |
|
} |
| 238 |
|
$file->purgeOldThumbnails( $row->fa_archive_name ); |
| 239 |
|
} |
| 240 |
|
} |