Skip to content

Commit

Permalink
Merge pull request egbot#52 from BioKIC/master
Browse files Browse the repository at this point in the history
Media Migration Tool debugging
  • Loading branch information
egbot authored Feb 27, 2023
2 parents 965101f + 20855f0 commit 3653479
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions classes/MediaResolutionTools.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,41 +289,53 @@ public function migrateCollectionDerivatives($imgIdStart, $limit){
if($this->transferThumbnail){
$fileName = basename($r->thumbnailurl);
$targetPath = $this->imgRootPath.$pathFrag.$fileName;
$targetUrl = $this->imgRootUrl.$pathFrag.$fileName;
$thumbPath = $this->getLocalPath($r->thumbnailurl);
if(copy($thumbPath, $targetPath)){
$imgArr[$r->imgid]['tn'] = $targetPath;
$imgArr[$r->imgid]['tn'] = $targetUrl;
if($this->debugMode) $this->logOrEcho('Copied: '.$thumbPath.' => '.$targetPath,1);
if($this->deleteSource){
if(unlink($thumbPath)){
$this->logOrEcho('Source removed: '.$thumbPath,1);
$this->logOrEcho('Source deleted: '.$thumbPath,1);
}
else{
$this->logOrEcho('ERROR deleting source (file permissions?): '.$thumbPath,1);
}
}
}
}
if($this->transferWeb){
$fileName = basename($r->url);
$targetPath = $this->imgRootPath.$pathFrag.$fileName;
$targetUrl = $this->imgRootUrl.$pathFrag.$fileName;
$urlPath = $this->getLocalPath($r->url);
if(copy($urlPath, $targetPath)){
$imgArr[$r->imgid]['web'] = $targetPath;
$imgArr[$r->imgid]['web'] = $targetUrl;
if($this->debugMode) $this->logOrEcho('Copied: '.$urlPath.' => '.$targetPath,1);
if($this->deleteSource){
if(unlink($urlPath)){
$this->logOrEcho('Source removed: '.$urlPath,1);
$this->logOrEcho('Source delete: '.$urlPath,1);
}
else{
$this->logOrEcho('ERROR deleting source (file permissions?): '.$urlPath,1);
}
}
}
}
if($this->transferLarge){
$fileName = basename($r->originalurl);
$targetPath = $this->imgRootPath.$pathFrag.$fileName;
$targetUrl = $this->imgRootUrl.$pathFrag.$fileName;
$origPath = $this->getLocalPath($r->originalurl);
if(copy($origPath, $targetPath)){
$imgArr[$r->imgid]['lg'] = $targetPath;
$imgArr[$r->imgid]['lg'] = $targetUrl;
if($this->debugMode) $this->logOrEcho('Copied: '.$origPath.' => '.$targetPath,1);
if($this->deleteSource){
if(unlink($origPath)){
$this->logOrEcho('Source removed: '.$origPath,1);
$this->logOrEcho('Source deleted: '.$origPath,1);
}
else{
$this->logOrEcho('ERROR deleting source (file permissions?): '.$origPath,1);
}
}
}
Expand Down

0 comments on commit 3653479

Please sign in to comment.