From eb600b0c0443e5bf53d5f3c4f3cd444788b68578 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 15 Oct 2005 18:06:04 +0000 Subject: [PATCH] r550: Place auto actions in the datastore --- admin/autoaction.php | 7 +++++++ docs/recache.php | 4 ++++ includes/functions_datastore.php | 20 ++++++++++++++++++++ showreport.php | 3 +-- 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/admin/autoaction.php b/admin/autoaction.php index 26332e2..40c512a 100644 --- a/admin/autoaction.php +++ b/admin/autoaction.php @@ -11,6 +11,7 @@ \*=====================================================================*/ require_once('./global.php'); +require_once('./includes/functions_datastore.php'); if (!can_perform('canadminbugs')) { @@ -36,6 +37,8 @@ if ($_REQUEST['do'] == 'kill') $db->query("DELETE FROM " . TABLE_PREFIX . "autoaction WHERE actionid = $action[actionid]"); + build_auto_actions(); + $admin->redirect('autoaction.php?do=modify'); } @@ -93,6 +96,8 @@ if ($_POST['do'] == 'insert' OR $_POST['do'] == 'update') )" ); + build_auto_actions(); + $admin->redirect('autoaction.php'); } else @@ -111,6 +116,8 @@ if ($_POST['do'] == 'insert' OR $_POST['do'] == 'update') WHERE actionid = " . intval($bugsys->in['actionid']) ); + build_auto_actions(); + $admin->redirect('autoaction.php'); } } diff --git a/docs/recache.php b/docs/recache.php index 18eab6b..a92474d 100755 --- a/docs/recache.php +++ b/docs/recache.php @@ -48,6 +48,10 @@ build_permissions(); echo '

Permissions cached

'; +build_auto_actions(); + +echo '

Auto actions cached

'; + // $Id$ ?> \ No newline at end of file diff --git a/includes/functions_datastore.php b/includes/functions_datastore.php index c0ec352..efd865c 100755 --- a/includes/functions_datastore.php +++ b/includes/functions_datastore.php @@ -236,6 +236,26 @@ function build_permissions() $bugsys->datastore['permission'] = $tempstore; } +// ##################### Start build_auto_actions #################### +function build_auto_actions() +{ + global $bugsys; + + $autoactions = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "autoaction ORDER BY name ASC"); + while ($autoaction = $bugsys->db->fetch_array($autoactions)) + { + $actions["$autoaction[actionid]"] = $autoaction; + } + + $bugsys->db->query(" + ### replacing auto action cache ### + REPLACE INTO " . TABLE_PREFIX . "datastore (title, data) + VALUES ('autoaction', '" . $bugsys->escape(serialize($actions)) . "')" + ); + + $bugsys->datastore['autoaction'] = $actions; +} + /*=====================================================================*\ || ################################################################### || # $HeadURL$ diff --git a/showreport.php b/showreport.php index 60d4ec5..0cfa9c3 100644 --- a/showreport.php +++ b/showreport.php @@ -145,10 +145,9 @@ if ($show['edit']) $dependencies = implode(' ', $depends); } - $actions = $db->query("SELECT * FROM " . TABLE_PREFIX . "autoaction ORDER BY name ASC"); $select['autoactions'] = ''; $show['autoactions'] = false; - while ($action = $db->fetch_array($actions)) + foreach ($bugsys->datastore['autoaction'] AS $action) { $label = $action['name']; $value = $action['actionid']; -- 2.22.5