summaryrefslogtreecommitdiff
path: root/includes/actions.inc
diff options
context:
space:
mode:
authorAngie Byron <webchick@24967.no-reply.drupal.org>2008-09-26 16:13:37 +0000
committerAngie Byron <webchick@24967.no-reply.drupal.org>2008-09-26 16:13:37 +0000
commitd02d89985a4acc8339c4a134b7a16eab8564bbf9 (patch)
tree35cca1d038e3455fb56cd3fd5d8d0281c7bd82b4 /includes/actions.inc
parent1fc0b924f2c042d319ae9948100a0a313df5aae5 (diff)
downloadbrdo-d02d89985a4acc8339c4a134b7a16eab8564bbf9.tar.gz
brdo-d02d89985a4acc8339c4a134b7a16eab8564bbf9.tar.bz2
#266773 by Susurrus and Dave Reid: actions_syncronize() cleanup.
Diffstat (limited to 'includes/actions.inc')
-rw-r--r--includes/actions.inc14
1 files changed, 3 insertions, 11 deletions
diff --git a/includes/actions.inc b/includes/actions.inc
index 79cd0f7ec..69971d84a 100644
--- a/includes/actions.inc
+++ b/includes/actions.inc
@@ -277,19 +277,10 @@ function actions_synchronize($actions_in_code = array(), $delete_orphans = FALSE
// Any actions that we have left in $actions_in_db are orphaned.
if ($actions_in_db) {
- $orphaned = array();
- $placeholder = array();
-
- foreach ($actions_in_db as $callback => $array) {
- $orphaned[] = $callback;
- $placeholder[] = "'%s'";
- }
-
- $orphans = implode(', ', $orphaned);
+ $orphaned = array_keys($actions_in_db);
if ($delete_orphans) {
- $placeholders = implode(', ', $placeholder);
- $results = db_query("SELECT a.aid, a.description FROM {actions} a WHERE callback IN ($placeholders)", $orphaned);
+ $results = db_query("SELECT a.aid, a.description FROM {actions} a WHERE callback IN (" . db_placeholders($orphaned, 'varchar') . ")", $orphaned);
while ($action = db_fetch_object($results)) {
actions_delete($action->aid);
watchdog('actions', "Removed orphaned action '%action' from database.", array('%action' => filter_xss_admin($action->description)));
@@ -298,6 +289,7 @@ function actions_synchronize($actions_in_code = array(), $delete_orphans = FALSE
else {
$link = l(t('Remove orphaned actions'), 'admin/build/actions/orphan');
$count = count($actions_in_db);
+ $orphans = implode(', ', $orphaned);
watchdog('actions', format_plural($count, 'One orphaned action (%orphans) exists in the actions table. !link', '@count orphaned actions (%orphans) exist in the actions table. !link'), array('@count' => $count, '%orphans' => $orphans, '!link' => $link), WATCHDOG_WARNING);
}
}