feat: GTSIT 사이트 구축
This commit is contained in:
21
bin/purge-inquiries.php
Normal file
21
bin/purge-inquiries.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
if (PHP_SAPI !== 'cli') {
|
||||
http_response_code(404);
|
||||
exit;
|
||||
}
|
||||
|
||||
require dirname(__DIR__) . '/app/bootstrap.php';
|
||||
|
||||
use App\Database;
|
||||
|
||||
$statement = Database::connection()->prepare(
|
||||
'DELETE FROM inquiries
|
||||
WHERE closed_at IS NOT NULL
|
||||
AND closed_at < DATE_SUB(NOW(), INTERVAL 1 YEAR)'
|
||||
);
|
||||
$statement->execute();
|
||||
|
||||
fwrite(STDOUT, sprintf("보유기간이 지난 문의 %d건을 삭제했습니다.\n", $statement->rowCount()));
|
||||
Reference in New Issue
Block a user