### Eclipse Workspace Patch 1.0
#P dbcron
Index: dbcron.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/dbcron/dbcron.module,v
retrieving revision 1.5
diff -u -r1.5 dbcron.module
--- dbcron.module	17 Apr 2006 06:38:46 -0000	1.5
+++ dbcron.module	1 Feb 2008 20:41:19 -0000
@@ -11,10 +11,6 @@
  */
 function dbcron_help($section) {
   switch ($section) {
-    case 'admin/modules#description':
-      return t('Runs a set of user-defined SQL queries at regular intervals using cron.');
-    case 'admin/dbcron':
-      return t('<p>The DB cron module allows you to create and manage a set of SQL queries. Each query is run at a regular interval using the cron system, and you can specify a different interval for each query. To create a new query, click the <em>add</em> link on this page. If you have existing queries, you will see them listed on this page, and you can modify them if you wish.</p>');
     case 'admin/help#dbcron':
       return t('<p>The DB cron module allows you to create and manage a set of SQL queries. Each query is run at a regular interval using the cron system, and you can specify a different interval for each query. As this module allows you to directly run SQL queries on your site\'s database, it should only be accessible to advanced users who have a sound knowledge of the Drupal database schema, and who are competent in ANSI SQL. Do not give inexperienced or non-trustworthy users the \'administer cron queries\' permission under any circumstances!</p>');
   }
@@ -35,33 +31,42 @@
 
   if ($may_cache) {
     $items[] = array(
-      'path' => 'admin/dbcron',
-      'title' => t('cron queries'),
+      'path' => 'admin/build/dbcron',
+      'title' => t('Cron queries'),
       'callback' => 'dbcron_admin',
       'access' => user_access('administer cron queries'),
     );
     $items[] = array(
-      'path' => 'admin/dbcron/edit',
+      'path' => 'admin/build/dbcron/edit',
       'title' => t('edit'),
       'callback' => 'dbcron_edit',
       'access' => user_access('administer cron queries'),
       'type' => MENU_CALLBACK,
     );
     $items[] = array(
-      'path' => 'admin/dbcron/delete',
+      'path' => 'admin/build/dbcron/delete',
       'title' => t('delete'),
-      'callback' => 'dbcron_delete_confirm',
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('dbcron_delete_confirm'),
       'access' => user_access('administer cron queries'),
       'type' => MENU_CALLBACK,
     );
     $items[] = array(
-      'path' => 'admin/dbcron/list',
+      'path' => 'admin/build/dbcron/list',
       'title' => t('list'),
       'type' => MENU_DEFAULT_LOCAL_TASK,
-      'weight' => -10,
+      'weight' => -10
     );
     $items[] = array(
-      'path' => 'admin/dbcron/add',
+      'path' => 'admin/settings/dbcron',
+      'title' => t('DB Cron'),
+      'description' => t('<p>The DB cron module allows you to create and manage a set of SQL queries. Each query is run at a regular interval using the cron system, and you can specify a different interval for each query. To create a new query, click the <em>add</em> link on this page. If you have existing queries, you will see them listed on this page, and you can modify them if you wish.</p>'),
+      'callback' => 'drupal_get_form',
+      'callback arguments' => array('dbcron_admin_settings'),
+      'access' => user_access('administer cron queries'),
+    );
+    $items[] = array(
+      'path' => 'admin/build/dbcron/add',
       'title' => t('add'),
       'callback' => 'dbcron_edit',
       'access' => user_access('administer cron queries'),
@@ -113,9 +118,9 @@
 }
 
 /**
- * Implementation of hook_settings().
+ * Admin settings callback
  */
-function dbcron_settings() {
+function dbcron_admin_settings() {
   $form = array();
   $options = array(0 => t('None'), 5 => format_interval(5), 10 => format_interval(10), 15 => format_interval(15), 20 => format_interval(20), 30 => format_interval(30), 60 => format_interval(60));
 
@@ -139,7 +144,7 @@
     '#description' => t('If enabled, the site\'s search index will be reset every time a cron query is executed. Useful for cron queries that clear the site\'s content.')
   );
 
-  return $form;
+  return system_settings_form($form);
 }
 
 /**
@@ -159,7 +164,7 @@
 
   $destination = drupal_get_destination();
   while ($data = db_fetch_object($result)) {
-    $rows[] = array($data->title, ($data->run_interval ? format_interval($data->run_interval) : t('Never')), ($data->last_run ? format_date($data->last_run) : t('N/A')), ($data->exec_speed ? $data->exec_speed . 'ms' : t('N/A')), l(t('edit'), "admin/dbcron/edit/$data->dqid", array(), $destination), l(t('delete'), "admin/dbcron/delete/$data->dqid", array(), $destination));
+    $rows[] = array($data->title, ($data->run_interval ? format_interval($data->run_interval) : t('Never')), ($data->last_run ? format_date($data->last_run) : t('N/A')), ($data->exec_speed ? $data->exec_speed . 'ms' : t('N/A')), l(t('edit'), "admin/build/dbcron/edit/$data->dqid", array(), $destination), l(t('delete'), "admin/build/dbcron/delete/$data->dqid", array(), $destination));
   }
 
   if (!$rows) {
@@ -178,10 +183,10 @@
   if ($dqid) {
     $dq = dbcron_load($dqid);
     drupal_set_title($dq->title);
-    $output = dbcron_form(dbcron_load($dqid));
+    $output = drupal_get_form('dbcron_form', dbcron_load($dqid));
   }
   else {
-    $output = dbcron_form();
+    $output = drupal_get_form('dbcron_form');
   }
 
   return $output;
@@ -191,20 +196,16 @@
  * Menu callback; confirms deleting a cron query
  **/
 function dbcron_delete_confirm($dqid) {
-  $output = '';
   $dq = dbcron_load($dqid);
   if (user_access('administer cron queries')) {
     $form['dqid'] = array(
       '#type' => 'value',
       '#value' => $dqid,
     );
-    $output = confirm_form('dbcron_delete_confirm', $form,
-  t('Are you sure you want to delete cron query %title?', array('%title' => theme('placeholder', $dq->title))),
-   $_GET['destination'] ? $_GET['destination'] : 'admin/dbcron', t('This action cannot be undone.'),
-  t('Delete'), t('Cancel') );
+    return confirm_form($form, t('Are you sure you want to delete cron query %title?',
+     array('%title' => $dq->title)), $_GET['destination'] ? $_GET['destination'] : 'admin/build/dbcron', t('This action cannot be undone.'),
+     t('Delete'), t('Cancel') );
   }
-
-  return $output;
 }
 
 /**
@@ -213,7 +214,7 @@
 function dbcron_delete_confirm_submit($form_id, $form_values) {
   if ($form_values['confirm']) {
     dbcron_delete($form_values['dqid']);
-    drupal_goto('admin/dbcron');
+    drupal_goto('admin/build/dbcron');
   }
 }
 
@@ -292,7 +293,7 @@
     );
   }
 
-  return drupal_get_form('dbcron_form', $form);
+  return $form;
 }
 
 /**
@@ -302,7 +303,7 @@
   $dq = _dbcron_edit_into_object($edit);
 
   if (db_result(db_query("SELECT COUNT(run_interval) FROM {dbcron} WHERE dqid != %d AND title = '%s'", $dq->dqid, $dq->title))) {
-    form_set_error('title', t('The title %title is already in use.', array('%title' => theme('placeholder', $dq->title))));
+    form_set_error('title', t('The title %title is already in use.', array('%title' => $dq->title)));
   }
 }
 
@@ -315,7 +316,7 @@
   dbcron_save_query($dq);
 
   drupal_set_message(t('The cron query has been saved.'));
-  drupal_goto('admin/dbcron');
+  drupal_goto('admin/build/dbcron');
 }
 
 /**
