'msg', 'list_count' => 50, 'regdate_before' => date('YmdHis', time() - ($days * 86400)), ]); if ($output->toBool()) { if ($output->data) { $oDB->begin(); foreach ($output->data as $file_info) { $oFileController->deleteFile($file_info->file_srl); } $oDB->commit(); if ($output->page_navigation && $output->page_navigation->total_count == count($output->data)) { break; } } else { break; } } else { echo "Error while deleting message attachments older than $days days.\n"; echo $output->getMessage() . "\n"; $exit_status = 11; break; } } if ($exit_status == 0) { echo "Successfully deleted all message attachments older than $days days.\n"; }