diff --git a/core/modules/action/action.admin.inc b/core/modules/action/action.admin.inc index 303dfec..0d76905 100644 --- a/core/modules/action/action.admin.inc +++ b/core/modules/action/action.admin.inc @@ -25,17 +25,17 @@ function action_admin_manage() { } $row = array(); - $instances_present = db_query("SELECT aid FROM {action} WHERE parameters <> ''")->fetchField(); + $instances_present = db_query("SELECT aid FROM {actions} WHERE parameters <> ''")->fetchField(); $header = array( array('data' => t('Action type'), 'field' => 'type'), array('data' => t('Label'), 'field' => 'label'), array('data' => $instances_present ? t('Operations') : '', 'colspan' => '2') ); - $query = db_select('action') + $query = db_select('actions') ->extend('Drupal\Core\Database\Query\PagerSelectExtender') ->extend('Drupal\Core\Database\Query\TableSortExtender'); $result = $query - ->fields('action') + ->fields('actions') ->limit(50) ->orderByHeader($header) ->execute(); @@ -137,7 +137,7 @@ function action_admin_configure($form, &$form_state, $action = NULL) { if (is_numeric($action)) { $aid = $action; // Load stored parameter values from database. - $data = db_query("SELECT * FROM {action} WHERE aid = :aid", array(':aid' => $aid))->fetch(); + $data = db_query("SELECT * FROM {actions} WHERE aid = :aid", array(':aid' => $aid))->fetch(); $edit['action_label'] = $data->label; $edit['action_type'] = $data->type; $function = $data->callback; diff --git a/core/modules/action/action.install b/core/modules/action/action.install index ecd7e6a..4e500fd 100644 --- a/core/modules/action/action.install +++ b/core/modules/action/action.install @@ -9,7 +9,8 @@ * Implements hook_schema(). */ function action_schema() { - $schema['action'] = array( + // 'action' is a reserved SQL keyword. + $schema['actions'] = array( 'description' => 'Stores action information.', 'fields' => array( 'aid' => array( diff --git a/core/modules/action/action.module b/core/modules/action/action.module index 506d773..596b93a 100644 --- a/core/modules/action/action.module +++ b/core/modules/action/action.module @@ -162,11 +162,11 @@ function actions_do($action_ids, $object = NULL, $context = NULL, $a1 = NULL, $a // When we have action instances we must go to the database to retrieve // instance data. if (!empty($conditions)) { - $query = db_select('action'); - $query->addField('action', 'aid'); - $query->addField('action', 'type'); - $query->addField('action', 'callback'); - $query->addField('action', 'parameters'); + $query = db_select('actions'); + $query->addField('actions', 'aid'); + $query->addField('actions', 'type'); + $query->addField('actions', 'callback'); + $query->addField('actions', 'parameters'); $query->condition('aid', $conditions, 'IN'); $result = $query->execute(); foreach ($result as $action) { @@ -199,7 +199,7 @@ function actions_do($action_ids, $object = NULL, $context = NULL, $a1 = NULL, $a else { // If it's a configurable action, retrieve stored parameters. if (is_numeric($action_ids)) { - $action = db_query("SELECT callback, parameters FROM {action} WHERE aid = :aid", array(':aid' => $action_ids))->fetchObject(); + $action = db_query("SELECT callback, parameters FROM {actions} WHERE aid = :aid", array(':aid' => $action_ids))->fetchObject(); $function = $action->callback; if (function_exists($function)) { $context = array_merge($context, unserialize($action->parameters)); @@ -270,7 +270,7 @@ function action_list($reset = FALSE) { * array with keys 'callback', 'label', 'type' and 'configurable'. */ function action_get_all_actions() { - $actions = db_query("SELECT aid, type, callback, parameters, label FROM {action}")->fetchAllAssoc('aid', PDO::FETCH_ASSOC); + $actions = db_query("SELECT aid, type, callback, parameters, label FROM {actions}")->fetchAllAssoc('aid', PDO::FETCH_ASSOC); foreach ($actions as &$action) { $action['configurable'] = (bool) $action['parameters']; unset($action['parameters']); @@ -330,7 +330,7 @@ function action_function_lookup($hash) { } $aid = FALSE; // Must be a configurable action; check database. - $result = db_query("SELECT aid FROM {action} WHERE parameters <> ''")->fetchAll(PDO::FETCH_ASSOC); + $result = db_query("SELECT aid FROM {actions} WHERE parameters <> ''")->fetchAll(PDO::FETCH_ASSOC); foreach ($result as $row) { if (drupal_hash_base64($row['aid']) == $hash) { $aid = $row['aid']; @@ -355,7 +355,7 @@ function action_function_lookup($hash) { */ function action_synchronize($delete_orphans = FALSE) { $actions_in_code = action_list(TRUE); - $actions_in_db = db_query("SELECT aid, callback, label FROM {action} WHERE parameters = ''")->fetchAllAssoc('callback', PDO::FETCH_ASSOC); + $actions_in_db = db_query("SELECT aid, callback, label FROM {actions} WHERE parameters = ''")->fetchAllAssoc('callback', PDO::FETCH_ASSOC); // Go through all the actions provided by modules. foreach ($actions_in_code as $callback => $array) { @@ -368,7 +368,7 @@ function action_synchronize($delete_orphans = FALSE) { } else { // This is a new singleton that we don't have an aid for; assign one. - db_insert('action') + db_insert('actions') ->fields(array( 'aid' => $callback, 'type' => $array['type'], @@ -387,7 +387,7 @@ function action_synchronize($delete_orphans = FALSE) { $orphaned = array_keys($actions_in_db); if ($delete_orphans) { - $actions = db_query('SELECT aid, label FROM {action} WHERE callback IN (:orphaned)', array(':orphaned' => $orphaned))->fetchAll(); + $actions = db_query('SELECT aid, label FROM {actions} WHERE callback IN (:orphaned)', array(':orphaned' => $orphaned))->fetchAll(); foreach ($actions as $action) { action_delete($action->aid); watchdog('action', "Removed orphaned action '%action' from database.", array('%action' => $action->label)); @@ -429,7 +429,7 @@ function action_save($function, $type, $params, $label, $aid = NULL) { $aid = db_next_id(); } - db_merge('action') + db_merge('actions') ->key(array('aid' => $aid)) ->fields(array( 'callback' => $function, @@ -453,7 +453,7 @@ function action_save($function, $type, $params, $label, $aid = NULL) { * The appropriate action row from the database as an object. */ function action_load($aid) { - return db_query("SELECT aid, type, callback, parameters, label FROM {action} WHERE aid = :aid", array(':aid' => $aid))->fetchObject(); + return db_query("SELECT aid, type, callback, parameters, label FROM {actions} WHERE aid = :aid", array(':aid' => $aid))->fetchObject(); } /** @@ -463,7 +463,7 @@ function action_load($aid) { * The ID of the action to delete. */ function action_delete($aid) { - db_delete('action') + db_delete('actions') ->condition('aid', $aid) ->execute(); module_invoke_all('action_delete', $aid); diff --git a/core/modules/action/lib/Drupal/action/Tests/ConfigurationTest.php b/core/modules/action/lib/Drupal/action/Tests/ConfigurationTest.php index f44ae38..651a4f7 100644 --- a/core/modules/action/lib/Drupal/action/Tests/ConfigurationTest.php +++ b/core/modules/action/lib/Drupal/action/Tests/ConfigurationTest.php @@ -78,7 +78,7 @@ function testActionConfiguration() { $this->assertRaw(t('Action %action was deleted', array('%action' => $new_action_label)), t('Make sure that we get a delete confirmation message.')); $this->drupalGet('admin/config/system/actions/manage'); $this->assertNoText($new_action_label, t("Make sure the action label does not appear on the overview page after we've deleted the action.")); - $exists = db_query('SELECT aid FROM {action} WHERE callback = :callback', array(':callback' => 'drupal_goto_action'))->fetchField(); + $exists = db_query('SELECT aid FROM {actions} WHERE callback = :callback', array(':callback' => 'drupal_goto_action'))->fetchField(); $this->assertFalse($exists, t('Make sure the action is gone from the database after being deleted.')); } } diff --git a/core/modules/system/system.install b/core/modules/system/system.install index e52c329..a0885ee 100644 --- a/core/modules/system/system.install +++ b/core/modules/system/system.install @@ -1951,8 +1951,6 @@ function system_update_8020() { * Enable the Actions module. */ function system_update_8021() { - // Rename {actions} table into {action}. - db_rename_table('actions', 'action'); // Enable the module without re-installing the schema. update_module_enable(array('action')); // Rename former System module actions. @@ -1962,7 +1960,7 @@ function system_update_8021() { 'system_goto_action' => 'action_goto_action', ); foreach ($map as $old => $new) { - db_update('action') + db_update('actions') ->fields(array('aid' => $new, 'callback' => $new)) ->condition('callback', $old) ->execute();