r1194: Lots of changes to get the internals of the rename to work
authorRobert Sesek <rsesek@bluestatic.org>
Thu, 28 Sep 2006 00:37:49 +0000 (00:37 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Thu, 28 Sep 2006 00:37:49 +0000 (00:37 +0000)
admin/automation.php
docs/recache.php
explain.php
includes/api_automation.php
includes/functions_datastore.php
install/upgrade5.php [new file with mode: 0644]
templates/explain_automation.tpl

index 182ffe3c2f00988d77b347bb24ad85f1bcd7b001..a28899b2c66d77593e4e94475acb4475a7c3ead5 100644 (file)
@@ -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<div class=\"smallfont\">$action[description]</div>", "<a href=\"automation.php?do=edit&amp;actionid=$action[actionid]\">[" . _('Edit') . "]</a> <a href=\"automation.php?do=delete&amp;actionid=$action[actionid]\">[" . _('Delete') . "]</a>");
index eba5dc9b81941d482559d7f210168e3227af51a8..9570c228843ea29fc7475967bc6ea7fa43599bf4 100755 (executable)
@@ -52,7 +52,7 @@ build_permissions();
 
 echo '<p>Permissions cached</p>';
 
-build_auto_actions();
+build_automations();
 
 echo '<p>Auto actions cached</p>';
 
index b84ebe8a30e6edbad0e586574cbca8dc5d0f1c2b..fc59924eedab16c41bee6901804c72ab69035b25 100644 (file)
@@ -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') . '";');
                                }
                        }
                }
index 97e5f113643bd706fc17e9478981f1bf19e6af80..fda59ccbcfcb28d7f990a4503d5ecc400708bbf4 100644 (file)
@@ -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();
        }
        
        // ###################################################################
index 5d08fcf89a3ce47adb6fef703560ea4a968dde88..b9a9561c51cd310a2164a0f4d477906d9ca6f1d5 100755 (executable)
@@ -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 (file)
index 0000000..2457c0c
--- /dev/null
@@ -0,0 +1,99 @@
+<?php
+/*=====================================================================*\
+|| ###################################################################
+|| # Bugdar [#]version[#]
+|| # Copyright ©2002-[#]year[#] Blue Static
+|| #
+|| # This program is free software; you can redistribute it and/or modify
+|| # it under the terms of the GNU General Public License as published by
+|| # the Free Software Foundation; version [#]gpl[#] of the License.
+|| #
+|| # This program is distributed in the hope that it will be useful, but
+|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+|| # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+|| # more details.
+|| #
+|| # You should have received a copy of the GNU General Public License along
+|| # with this program; if not, write to the Free Software Foundation, Inc.,
+|| # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+|| ###################################################################
+\*=====================================================================*/
+
+define('STOP_MARK', 2);
+define('ACTIVE_SITE', 'upgrade5.php');
+
+require_once('./global.php');
+require_once('./includes/functions_datastore.php');
+
+page_start();
+
+// ###################################################################
+
+if ($bugsys->in['mark'] == 0)
+{
+?>
+<h1>Welcome to Bugdar</h1>
+
+<p>This upgrade will take from Bugdar 1.1.0 Release Candidate 1 to Bugdar 1.1.0 (final).</p>
+
+<p>Not much has to be done, we just have a quick rename and version number change.</p>
+
+<p>To begin the process, please click the button below.</p>
+<?php
+}
+
+// ###################################################################
+
+if ($bugsys->in['mark'] == 1)
+{
+?>
+       <h1>Rename Automatic Actions</h1>
+       
+       <p>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.</p>
+<?php
+       
+       $db->query("ALTER TABLE " . TABLE_PREFIX . "autoaction RENAME " . TABLE_PREFIX . "automation");
+       echo "Renaming datbase table<br />\n";
+       
+       $db->query("DELETE FROM " . TABLE_PREFIX . "datastore WHERE title = 'autoaction'");
+       echo "Clearing old datastore information<br />\n";
+       
+       build_automations();
+       echo "Rebuilding the automations cahce<br />\n";
+}
+
+// ###################################################################
+
+if ($bugsys->in['mark'] == 2)
+{
+?>
+<h1>Version Number Change</h1>
+
+<p>This step finishes the upgrade by inreasing your version number.</p>
+
+<?php
+       
+       require_once('./includes/settings.php');
+               
+       $db->query("UPDATE " . TABLE_PREFIX . "setting SET value = '1.1.0' WHERE varname = 'trackerversion'");
+       
+       build_settings();
+       
+?>
+
+... done.
+
+<?php
+}
+
+// ###################################################################
+
+page_end();
+
+/*=====================================================================*\
+|| ###################################################################
+|| # $HeadURL$
+|| # $Id$
+|| ###################################################################
+\*=====================================================================*/
+?>
\ No newline at end of file
index 2f6483a99cca857f5b4ee5549900b9d2a5e96e5b..cdefa9a10c5234b80dd8249d4b0753ca55d597af 100644 (file)
@@ -12,7 +12,7 @@ $header
 <h2>{@"Explication of Automations"}</h2>
 
 <table border="$stylevar[border]" cellspacing="$stylevar[spacing]" cellpadding="$stylevar[padding]px" width="$stylevar[normal_width]">
-$autoactions
+$automations
 </table>
 
 $footer
\ No newline at end of file