Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implemented deletion of notices at expiry date #107

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions tools/docker-dev/sql/bootstrap.sql
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@ CREATE TABLE `notices` (
`id` int(11) NOT NULL,
`date` timestamp NOT NULL DEFAULT current_timestamp(),
`title` varchar(300) NOT NULL,
`message` longtext NOT NULL
`message` longtext NOT NULL,
`expiry` timestamp NOT NULL DEFAULT DATE_ADD(CURDATE(), INTERVAL 7 DAY)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
Expand All @@ -156,7 +157,7 @@ CREATE TABLE `notices` (

INSERT INTO `notices` (`id`, `date`, `title`, `message`) VALUES

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't there be an 'expiry' here?

(9, '2022-09-19 15:49:10', 'Example Notice 1', '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>'),
(10, '2022-09-14 11:48:39', 'Example Notice 2', '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>');
(10, '2022-09-14 11:48:39', 'Example Notice 2', '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>', '2024-05-29');

-- --------------------------------------------------------

Expand Down
1 change: 1 addition & 0 deletions tools/docker-dev/unity-web-portal

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this new directory meant to be here?

Submodule unity-web-portal added at 7087b7
6 changes: 6 additions & 0 deletions workers/notices-expiry-deletion.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?php

require_once "../resources/autoload.php";
require_once "../resources/init.php";

$SQL->getConn()->prepare("DELETE FROM `notices` WHERE `expiry` <= CURDATE()")->execute();
Loading