posts: save post update time
This commit is contained in:
parent
bf8b8f22b6
commit
9ddc847aee
@ -2,6 +2,9 @@
|
||||
|
||||
class mysql {
|
||||
|
||||
const DATE_FORMAT = 'Y-m-d';
|
||||
const DATETIME_FORMAT = 'Y-m-d H:i:s';
|
||||
|
||||
protected ?mysqli $link = null;
|
||||
|
||||
function __construct(
|
||||
|
@ -15,12 +15,18 @@ class Post extends model {
|
||||
|
||||
public int $id;
|
||||
public string $date;
|
||||
public ?string $updateTime;
|
||||
public bool $visible;
|
||||
public string $shortName;
|
||||
public string $sourceUrl;
|
||||
|
||||
protected array $texts = [];
|
||||
|
||||
public function edit(array $fields) {
|
||||
$fields['update_time'] = date(mysql::DATETIME_FORMAT, time());
|
||||
parent::edit($fields);
|
||||
}
|
||||
|
||||
public function addText(PostLanguage $lang, string $title, string $md, bool $toc): ?PostText {
|
||||
$html = markup::markdownToHtml($md, lang: $lang);
|
||||
$text = markup::htmlToText($html);
|
||||
|
Loading…
x
Reference in New Issue
Block a user