🚑 Vérifie la présence de backup

This commit is contained in:
Shikiryu 2017-11-07 21:13:44 +01:00
parent 16af2429da
commit 852e9ba1c5

View File

@ -51,8 +51,10 @@ if ($actions->connect()) {
echo sprintf('elle est vieille (%s), on la supprime. %s', $existing_deals[$deal->getId()]->getDateCreation()->format('d/m/Y H:i'), "\n"); echo sprintf('elle est vieille (%s), on la supprime. %s', $existing_deals[$deal->getId()]->getDateCreation()->format('d/m/Y H:i'), "\n");
$actions->delete($deal); $actions->delete($deal);
// Backup // Backup
if (!file_exists(BACKUP_DEALS_DIR.'/'.$deal->getId())) {
mkdir(BACKUP_DEALS_DIR . '/' . $deal->getId()); mkdir(BACKUP_DEALS_DIR . '/' . $deal->getId());
copy_folder(EXISTING_DEALS_DIR . '/' . $deal->getId(), BACKUP_DEALS_DIR . '/' . $deal->getId()); copy_folder(EXISTING_DEALS_DIR . '/' . $deal->getId(), BACKUP_DEALS_DIR . '/' . $deal->getId());
}
// Placement en "à créer" // Placement en "à créer"
rename(EXISTING_DEALS_DIR.'/'.$deal->getId(), NEW_DEALS_DIR.'/'.$deal->getId()); rename(EXISTING_DEALS_DIR.'/'.$deal->getId(), NEW_DEALS_DIR.'/'.$deal->getId());
} else { } else {