diff --git a/cron.php b/cron.php index 113417a..dea0b79 100644 --- a/cron.php +++ b/cron.php @@ -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"); $actions->delete($deal); // Backup - mkdir(BACKUP_DEALS_DIR.'/'.$deal->getId()); - copy_folder(EXISTING_DEALS_DIR.'/'.$deal->getId(), BACKUP_DEALS_DIR.'/'.$deal->getId()); + if (!file_exists(BACKUP_DEALS_DIR.'/'.$deal->getId())) { + mkdir(BACKUP_DEALS_DIR . '/' . $deal->getId()); + copy_folder(EXISTING_DEALS_DIR . '/' . $deal->getId(), BACKUP_DEALS_DIR . '/' . $deal->getId()); + } // Placement en "à créer" rename(EXISTING_DEALS_DIR.'/'.$deal->getId(), NEW_DEALS_DIR.'/'.$deal->getId()); } else {