Revert "INSERT ... RETURNING is well-supported now" - mysql doesn't...

This reverts commit 633d5c5348.
This commit is contained in:
Shish
2023-06-25 20:31:11 +00:00
parent 1f908bdd05
commit 33f32f7b22
11 changed files with 55 additions and 47 deletions

View File

@@ -65,12 +65,11 @@ class Blocks extends Extension
if ($event->page_matches("blocks") && $user->can(Permissions::MANAGE_BLOCKS)) {
if ($event->get_arg(0) == "add") {
if ($user->check_auth_token()) {
$blockID = $database->get_one("
$database->execute("
INSERT INTO blocks (pages, title, area, priority, content)
VALUES (:pages, :title, :area, :priority, :content)
RETURNING id
", ['pages'=>$_POST['pages'], 'title'=>$_POST['title'], 'area'=>$_POST['area'], 'priority'=>(int)$_POST['priority'], 'content'=>$_POST['content']]);
log_info("blocks", "Added Block #$blockID (".$_POST['title'].")");
log_info("blocks", "Added Block #".($database->get_last_insert_id('blocks_id_seq'))." (".$_POST['title'].")");
$cache->delete("blocks");
$page->set_mode(PageMode::REDIRECT);
$page->set_redirect(make_link("blocks/list"));