Index: includes/actions.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/actions.inc,v retrieving revision 1.16 diff -u -p -r1.16 actions.inc --- includes/actions.inc 5 Sep 2008 09:29:06 -0000 1.16 +++ includes/actions.inc 12 Sep 2008 01:00:07 -0000 @@ -327,10 +327,14 @@ function actions_save($function, $type, watchdog('actions', 'Action %action saved.', array('%action' => $desc)); } else { - // aid is the callback for singleton actions so we need to keep a - // separate table for numeric aids. - db_query('INSERT INTO {actions_aid} VALUES (default)'); - $aid = db_last_insert_id('actions_aid', 'aid'); + // Get the last numberic aid from the actions table (is this compatible with other databases?) + //$aid = db_result(db_query_range("SELECT CAST(aid AS UNSIGNED) aid FROM actions ORDER BY aid DESC", NULL, 0, 1)); + //$aid = is_numeric($aid) ? $aid++ : 1; + + // Get the last aid inserted and increment + $aid = variable_get('actions_last_aid', 0) + 1; + variable_set('actions_last_aid', $aid); + db_query("INSERT INTO {actions} (aid, callback, type, parameters, description) VALUES ('%s', '%s', '%s', '%s', '%s')", $aid, $function, $type, $serialized, $desc); watchdog('actions', 'Action %action created.', array('%action' => $desc)); } Index: modules/system/system.install =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.install,v retrieving revision 1.263 diff -u -p -r1.263 system.install --- modules/system/system.install 6 Sep 2008 08:36:21 -0000 1.263 +++ modules/system/system.install 12 Sep 2008 01:00:21 -0000 @@ -500,19 +500,6 @@ function system_schema() { 'primary key' => array('aid'), ); - $schema['actions_aid'] = array( - 'description' => t('Stores action IDs for non-default actions.'), - 'fields' => array( - 'aid' => array( - 'description' => t('Primary Key: Unique actions ID.'), - 'type' => 'serial', - 'unsigned' => TRUE, - 'not null' => TRUE, - ), - ), - 'primary key' => array('aid'), - ); - $schema['batch'] = array( 'description' => t('Stores details about batches (processes that run in multiple HTTP requests).'), 'fields' => array( @@ -3049,6 +3036,18 @@ function system_update_7010() { } /** + * Remove the 'actions_aid' table. + */ +function system_update_7011() { + $ret = array(); + $aid = db_query("SELECT aid FROM {actions_aid} ORDER BY aid DESC"); + variable_set('actions_last_aid', is_numeric($aid) ? $aid : 0); + db_drop_table($ret, 'actions_aid'); + + return $ret; +} + +/** * @} End of "defgroup updates-6.x-to-7.x" * The next series of updates should start at 8000. */