From 27a62d912a89c2f7ade29e4edabaec5d584abc25 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 28 Sep 2006 00:37:49 +0000 Subject: [PATCH] r1194: Lots of changes to get the internals of the rename to work --- admin/automation.php | 2 +- docs/recache.php | 2 +- explain.php | 30 +++++----- includes/api_automation.php | 8 +-- includes/functions_datastore.php | 16 +++--- install/upgrade5.php | 99 ++++++++++++++++++++++++++++++++ templates/explain_automation.tpl | 2 +- 7 files changed, 129 insertions(+), 30 deletions(-) create mode 100644 install/upgrade5.php diff --git a/admin/automation.php b/admin/automation.php index 182ffe3..a28899b 100644 --- a/admin/automation.php +++ b/admin/automation.php @@ -219,7 +219,7 @@ if ($_REQUEST['do'] == 'modify') $admin->table_start(); $admin->table_head(_('Automations')); - $actions = $db->query("SELECT * FROM " . TABLE_PREFIX . "autoaction ORDER BY name ASC"); + $actions = $db->query("SELECT * FROM " . TABLE_PREFIX . "automation ORDER BY name ASC"); while ($action = $db->fetch_array($actions)) { $admin->row_text($action['name'] . "\n
$action[description]
", "[" . _('Edit') . "] [" . _('Delete') . "]"); diff --git a/docs/recache.php b/docs/recache.php index eba5dc9..9570c22 100755 --- a/docs/recache.php +++ b/docs/recache.php @@ -52,7 +52,7 @@ build_permissions(); echo '

Permissions cached

'; -build_auto_actions(); +build_automations(); echo '

Auto actions cached

'; diff --git a/explain.php b/explain.php index b84ebe8..fc59924 100644 --- a/explain.php +++ b/explain.php @@ -106,42 +106,42 @@ if ($_REQUEST['do'] == 'automations') $fields["$field[fieldid]"] = $field; } - if (is_array($bugsys->datastore['autoaction'])) + if (is_array($bugsys->datastore['automation'])) { - foreach ($bugsys->datastore['autoaction'] AS $autoaction) + foreach ($bugsys->datastore['automation'] AS $automation) { - $autoaction['fieldchanges'] = unserialize($autoaction['fieldchanges']); + $automation['fieldchanges'] = unserialize($automation['fieldchanges']); - $left = $autoaction['name']; - $right = $autoaction['description']; + $left = $automation['name']; + $right = $automation['description']; $trextra = ' class="listinghead"'; - eval('$autoactions .= "' . $template->fetch('explain_row') . '";'); + eval('$automations .= "' . $template->fetch('explain_row') . '";'); - if ($autoaction['comment']) + if ($automation['comment']) { $left = _('Add Comment'); - $right = $autoaction['comment']; + $right = $automation['comment']; $trextra = ' style="background-color: ' . $stylevar['alt_color'] . '"'; - eval('$autoactions .= "' . $template->fetch('explain_row') . '";'); + eval('$automations .= "' . $template->fetch('explain_row') . '";'); } $trextra = ''; - if (is_array($autoaction['fieldchanges']['builtin'])) + if (is_array($automation['fieldchanges']['builtin'])) { - foreach ($autoaction['fieldchanges']['builtin'] AS $name => $value) + foreach ($automation['fieldchanges']['builtin'] AS $name => $value) { $left = $name; $right = $bugsys->datastore["$left"]["$value"]["$left"]; - eval('$autoactions .= "' . $template->fetch('explain_row') . '";'); + eval('$automations .= "' . $template->fetch('explain_row') . '";'); } } - if (is_array($autoaction['fieldchanges']['custom'])) + if (is_array($automation['fieldchanges']['custom'])) { - foreach ($autoaction['fieldchanges']['custom'] AS $id => $value) + foreach ($automation['fieldchanges']['custom'] AS $id => $value) { if (!$fields["$id"]) { @@ -150,7 +150,7 @@ if ($_REQUEST['do'] == 'automations') $left = $fields["$id"]['name'] . ' ' . sprintf(_('(Custom #%1$d, type: %2$s)'), $id, $fields["$id"]['type']); $right = $value; - eval('$autoactions .= "' . $template->fetch('explain_row') . '";'); + eval('$automations .= "' . $template->fetch('explain_row') . '";'); } } } diff --git a/includes/api_automation.php b/includes/api_automation.php index 97e5f11..fda59cc 100644 --- a/includes/api_automation.php +++ b/includes/api_automation.php @@ -52,7 +52,7 @@ class AutomationAPI extends API * @var string * @access private */ - var $table = 'autoaction'; + var $table = 'automation'; /** * Table prefix @@ -69,7 +69,7 @@ class AutomationAPI extends API */ function post_insert() { - build_auto_actions(); + build_automations(); } // ################################################################### @@ -80,7 +80,7 @@ class AutomationAPI extends API */ function post_update() { - build_auto_actions(); + build_automations(); } // ################################################################### @@ -91,7 +91,7 @@ class AutomationAPI extends API */ function post_delete() { - build_auto_actions(); + build_automations(); } // ################################################################### diff --git a/includes/functions_datastore.php b/includes/functions_datastore.php index 5d08fcf..b9a9561 100755 --- a/includes/functions_datastore.php +++ b/includes/functions_datastore.php @@ -244,24 +244,24 @@ function build_permissions() $bugsys->datastore['permission'] = $tempstore; } -// ##################### Start build_auto_actions #################### -function build_auto_actions() +// ##################### Start build_automations #################### +function build_automations() { global $bugsys; - $autoactions = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "autoaction ORDER BY name ASC"); - while ($autoaction = $bugsys->db->fetch_array($autoactions)) + $automations = $bugsys->db->query("SELECT * FROM " . TABLE_PREFIX . "automation ORDER BY name ASC"); + while ($automation = $bugsys->db->fetch_array($automations)) { - $actions["$autoaction[actionid]"] = $autoaction; + $actions["$automation[actionid]"] = $automation; } $bugsys->db->query(" - ### replacing auto action cache ### + ### replacing automation cache ### REPLACE INTO " . TABLE_PREFIX . "datastore (title, data) - VALUES ('autoaction', '" . $bugsys->escape(serialize($actions)) . "')" + VALUES ('automation', '" . $bugsys->escape(serialize($actions)) . "')" ); - $bugsys->datastore['autoaction'] = $actions; + $bugsys->datastore['automation'] = $actions; } // ###################### Start build_user_help ###################### diff --git a/install/upgrade5.php b/install/upgrade5.php new file mode 100644 index 0000000..2457c0c --- /dev/null +++ b/install/upgrade5.php @@ -0,0 +1,99 @@ +in['mark'] == 0) +{ +?> +

Welcome to Bugdar

+ +

This upgrade will take from Bugdar 1.1.0 Release Candidate 1 to Bugdar 1.1.0 (final).

+ +

Not much has to be done, we just have a quick rename and version number change.

+ +

To begin the process, please click the button below.

+in['mark'] == 1) +{ +?> +

Rename Automatic Actions

+ +

Simply for aesthetic's sake, we've ranamed "Automatic Actions" to "Automations." This does all the necessary database changes to make that rename work internally.

+query("ALTER TABLE " . TABLE_PREFIX . "autoaction RENAME " . TABLE_PREFIX . "automation"); + echo "Renaming datbase table
\n"; + + $db->query("DELETE FROM " . TABLE_PREFIX . "datastore WHERE title = 'autoaction'"); + echo "Clearing old datastore information
\n"; + + build_automations(); + echo "Rebuilding the automations cahce
\n"; +} + +// ################################################################### + +if ($bugsys->in['mark'] == 2) +{ +?> +

Version Number Change

+ +

This step finishes the upgrade by inreasing your version number.

+ +query("UPDATE " . TABLE_PREFIX . "setting SET value = '1.1.0' WHERE varname = 'trackerversion'"); + + build_settings(); + +?> + +... done. + + \ No newline at end of file diff --git a/templates/explain_automation.tpl b/templates/explain_automation.tpl index 2f6483a..cdefa9a 100644 --- a/templates/explain_automation.tpl +++ b/templates/explain_automation.tpl @@ -12,7 +12,7 @@ $header

{@"Explication of Automations"}

-$autoactions +$automations
$footer \ No newline at end of file -- 2.43.5