? sites/default/files
? sites/default/settings.php
Index: includes/actions.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/actions.inc,v
retrieving revision 1.15
diff -u -p -r1.15 actions.inc
--- includes/actions.inc	12 Aug 2008 06:57:45 -0000	1.15
+++ includes/actions.inc	31 Aug 2008 11:47:34 -0000
@@ -67,7 +67,7 @@ function actions_do($action_ids, $object
       // Strip off leading 'OR '.
       $where_clause = '(' . strstr($where_clause, " ") . ')';
       $result_db = db_query('SELECT * FROM {actions} WHERE ' . $where_clause, $where_values);
-      while ($action = db_fetch_object($result_db)) {
+      foreach ($result_db as $action) {
         $actions[$action->aid] = $action->parameters ? unserialize($action->parameters) : array();
         $actions[$action->aid]['callback'] = $action->callback;
         $actions[$action->aid]['type'] = $action->type;
@@ -91,7 +91,7 @@ function actions_do($action_ids, $object
   else {
     // If it's a configurable action, retrieve stored parameters.
     if (is_numeric($action_ids)) {
-      $action = db_fetch_object(db_query("SELECT * FROM {actions} WHERE aid = %d", $action_ids));
+      $action = db_query("SELECT * FROM {actions} WHERE aid = ?", $action_ids)->fetch();
       $function = $action->callback;
       $context = array_merge($context, unserialize($action->parameters));
       $result[$action_ids] = $function($object, $context, $a1, $a2);
@@ -176,7 +176,7 @@ function actions_list($reset = FALSE) {
 function actions_get_all_actions() {
   $actions = array();
   $result = db_query("SELECT * FROM {actions}");
-  while ($action = db_fetch_object($result)) {
+  foreach ($result as $action) {
     $actions[$action->aid] = array(
       'callback' => $action->callback,
       'description' => $action->description,
@@ -254,7 +254,7 @@ function actions_synchronize($actions_in
   }
   $actions_in_db = array();
   $result = db_query("SELECT * FROM {actions} WHERE parameters = ''");
-  while ($action = db_fetch_object($result)) {
+  foreach ($result as $action) {
     $actions_in_db[$action->callback] = array('aid' => $action->aid, 'description' => $action->description);
   }
 
@@ -290,7 +290,7 @@ function actions_synchronize($actions_in
     if ($delete_orphans) {
       $placeholders = implode(', ', $placeholder);
       $results = db_query("SELECT a.aid, a.description FROM {actions} a WHERE callback IN ($placeholders)", $orphaned);
-      while ($action = db_fetch_object($results)) {
+      foreach ($results as $action) {
         actions_delete($action->aid);
         watchdog('actions', "Removed orphaned action '%action' from database.", array('%action' => filter_xss_admin($action->description)));
       }
@@ -348,7 +348,7 @@ function actions_save($function, $type, 
  *   The appropriate action row from the database as an object.
  */
 function actions_load($aid) {
-  return db_fetch_object(db_query("SELECT * FROM {actions} WHERE aid = %d", $aid));
+  return db_query("SELECT * FROM {actions} WHERE aid = ?", $aid)->fetch();
 }
 
 /**
Index: includes/bootstrap.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v
retrieving revision 1.220
diff -u -p -r1.220 bootstrap.inc
--- includes/bootstrap.inc	21 Aug 2008 19:36:36 -0000	1.220
+++ includes/bootstrap.inc	31 Aug 2008 11:47:34 -0000
@@ -479,7 +479,7 @@ function variable_init($conf = array()) 
   }
   else {
     $result = db_query('SELECT * FROM {variable}');
-    while ($variable = db_fetch_object($result)) {
+    foreach ($result as $variable) {
       $variables[$variable->name] = unserialize($variable->value);
     }
     cache_set('variables', $variables);
@@ -1149,7 +1149,7 @@ function language_list($field = 'languag
   if (!isset($languages)) {
     if (variable_get('language_count', 1) > 1 || module_exists('locale')) {
       $result = db_query('SELECT * FROM {languages} ORDER BY weight ASC, name ASC');
-      while ($row = db_fetch_object($result)) {
+      foreach ($result as $row) {
         $languages['language'][$row->language] = $row;
       }
     }
@@ -1478,8 +1478,8 @@ function registry_cache_path_files() {
       $params = array_merge($params, $names);
       $params[] = $type;
     }
-    $res = db_query("SELECT DISTINCT filename FROM {registry} WHERE " . implode(' OR ', $type_sql), $params);
-    while ($row = db_fetch_object($res)) {
+    $result = db_query("SELECT DISTINCT filename FROM {registry} WHERE " . implode(' OR ', $type_sql), $params);
+    foreach ($result as $row) {
       $files[] = $row->filename;
     }
     if ($files) {
Index: includes/cache.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/cache.inc,v
retrieving revision 1.21
diff -u -p -r1.21 cache.inc
--- includes/cache.inc	21 Aug 2008 19:36:36 -0000	1.21
+++ includes/cache.inc	31 Aug 2008 11:47:34 -0000
@@ -24,7 +24,7 @@ function cache_get($cid, $table = 'cache
     db_query("DELETE FROM {" . $table . "} WHERE expire != %d AND expire <= %d", CACHE_PERMANENT, $cache_flush);
   }
 
-  $cache = db_fetch_object(db_query("SELECT data, created, headers, expire, serialized FROM {" . $table . "} WHERE cid = '%s'", $cid));
+  $cache = db_query("SELECT data, created, headers, expire, serialized FROM {" . $table . "} WHERE cid = ?", $cid)->fetch();
   if (isset($cache->data)) {
     // If the data is permanent or we're not enforcing a minimum cache lifetime
     // always return the cached data.
Index: includes/install.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/install.inc,v
retrieving revision 1.67
diff -u -p -r1.67 install.inc
--- includes/install.inc	28 Aug 2008 08:40:33 -0000	1.67
+++ includes/install.inc	31 Aug 2008 11:47:34 -0000
@@ -135,7 +135,7 @@ function drupal_get_installed_schema_ver
   if (!$versions) {
     $versions = array();
     $result = db_query("SELECT name, schema_version FROM {system} WHERE type = '%s'", 'module');
-    while ($row = db_fetch_object($result)) {
+    foreach ($result as $row) {
       $versions[$row->name] = $row->schema_version;
     }
   }
Index: includes/locale.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/locale.inc,v
retrieving revision 1.180
diff -u -p -r1.180 locale.inc
--- includes/locale.inc	21 Aug 2008 19:36:36 -0000	1.180
+++ includes/locale.inc	31 Aug 2008 11:47:35 -0000
@@ -198,7 +198,7 @@ function locale_languages_custom_form() 
  *   Language code of the language to edit.
  */
 function locale_languages_edit_form(&$form_state, $langcode) {
-  if ($language = db_fetch_object(db_query("SELECT * FROM {languages} WHERE language = '%s'", $langcode))) {
+  if ($language = db_query("SELECT * FROM {languages} WHERE language = ?", $langcode)->fetch()) {
     $form = array();
     _locale_languages_common_controls($form, $language);
     $form['submit'] = array(
@@ -341,13 +341,13 @@ function locale_languages_edit_form_vali
   if (!empty($form_state['values']['domain']) && !empty($form_state['values']['prefix'])) {
     form_set_error('prefix', t('Domain and path prefix values should not be set at the same time.'));
   }
-  if (!empty($form_state['values']['domain']) && $duplicate = db_fetch_object(db_query("SELECT language FROM {languages} WHERE domain = '%s' AND language <> '%s'", $form_state['values']['domain'], $form_state['values']['langcode']))) {
+  if (!empty($form_state['values']['domain']) && $duplicate = db_query("SELECT language FROM {languages} WHERE domain = ? AND language <> ?", $form_state['values']['domain'], $form_state['values']['langcode'])->fetch()) {
     form_set_error('domain', t('The domain (%domain) is already tied to a language (%language).', array('%domain' => $form_state['values']['domain'], '%language' => $duplicate->language)));
   }
   if (empty($form_state['values']['prefix']) && language_default('language') != $form_state['values']['langcode'] && empty($form_state['values']['domain'])) {
     form_set_error('prefix', t('Only the default language can have both the domain and prefix empty.'));
   }
-  if (!empty($form_state['values']['prefix']) && $duplicate = db_fetch_object(db_query("SELECT language FROM {languages} WHERE prefix = '%s' AND language <> '%s'", $form_state['values']['prefix'], $form_state['values']['langcode']))) {
+  if (!empty($form_state['values']['prefix']) && $duplicate = db_query("SELECT language FROM {languages} WHERE prefix = ? AND language <> ?", $form_state['values']['prefix'], $form_state['values']['langcode'])->fetch()) {
     form_set_error('prefix', t('The prefix (%prefix) is already tied to a language (%language).', array('%prefix' => $form_state['values']['prefix'], '%language' => $duplicate->language)));
   }
 }
@@ -494,7 +494,7 @@ function locale_translate_overview_scree
   // Collect summaries of all source strings in all groups.
   $sums = db_query("SELECT COUNT(*) AS strings, textgroup FROM {locales_source} GROUP BY textgroup");
   $groupsums = array();
-  while ($group = db_fetch_object($sums)) {
+  foreach ($sums as $group) {
     $groupsums[$group->textgroup] = $group->strings;
   }
 
@@ -509,7 +509,7 @@ function locale_translate_overview_scree
 
   // Languages with at least one record in the locale table.
   $translations = db_query("SELECT COUNT(*) AS translation, t.language, s.textgroup FROM {locales_source} s INNER JOIN {locales_target} t ON s.lid = t.lid GROUP BY textgroup, language");
-  while ($data = db_fetch_object($translations)) {
+  foreach ($translations as $data) {
     $ratio = (!empty($groupsums[$data->textgroup]) && $data->translation > 0) ? round(($data->translation/$groupsums[$data->textgroup])*100., 2) : 0;
     $rows[$data->language][$data->textgroup] = $data->translation . '/' . $groupsums[$data->textgroup] . " ($ratio%)";
   }
@@ -771,7 +771,7 @@ function locale_translate_export_po_form
  */
 function locale_translate_edit_form(&$form_state, $lid) {
   // Fetch source string, if possible.
-  $source = db_fetch_object(db_query('SELECT source, textgroup, location FROM {locales_source} WHERE lid = %d', $lid));
+  $source = db_query('SELECT source, textgroup, location FROM {locales_source} WHERE lid = ?', $lid)->fetch();
   if (!$source) {
     drupal_set_message(t('String not found.'), 'error');
     drupal_goto('admin/build/translate/search');
@@ -819,7 +819,7 @@ function locale_translate_edit_form(&$fo
 
   // Fetch translations and fill in default values in the form.
   $result = db_query("SELECT DISTINCT translation, language FROM {locales_target} WHERE lid = %d AND language <> '%s'", $lid, $omit);
-  while ($translation = db_fetch_object($result)) {
+  foreach ($result as $translation) {
     $form['translations'][$translation->language]['#default_value'] = $translation->translation;
   }
 
@@ -874,7 +874,7 @@ function locale_translate_edit_form_subm
  * String deletion confirmation page.
  */
 function locale_translate_delete_page($lid) {
-  if ($source = db_fetch_object(db_query('SELECT * FROM {locales_source} WHERE lid = %d', $lid))) {
+  if ($source = db_query('SELECT * FROM {locales_source} WHERE lid = ?', $lid)->fetch()) {
     return drupal_get_form('locale_translate_delete_form', $source);
   }
   else {
@@ -992,7 +992,7 @@ function _locale_import_po($file, $langc
   }
 
   // Check if we have the language already in the database.
-  if (!db_fetch_object(db_query("SELECT language FROM {languages} WHERE language = '%s'", $langcode))) {
+  if (!db_query("SELECT language FROM {languages} WHERE language = ?", $langcode)->fetch()) {
     drupal_set_message(t('The language selected for import is not supported.'), 'error');
     return FALSE;
   }
@@ -1666,7 +1666,7 @@ function _locale_parse_js_file($filepath
       $string = implode('', preg_split('~(?<!\\\\)[\'"]\s*\+\s*[\'"]~s', substr($string, 1, -1)));
 
       $result = db_query("SELECT lid, location FROM {locales_source} WHERE source = '%s' AND textgroup = 'default'", $string);
-      if ($source = db_fetch_object($result)) {
+      if ($source = $result->fetch()) {
         // We already have this source string and now have to add the location
         // to the location column, if this file is not yet present in there.
         $locations = preg_split('~\s*;\s*~', $source->location);
@@ -1711,7 +1711,7 @@ function _locale_export_get_strings($lan
     $result = db_query("SELECT s.lid, s.source, s.location, t.plid, t.plural FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid WHERE s.textgroup = '%s' ORDER BY t.plid, t.plural", $group);
   }
   $strings = array();
-  while ($child = db_fetch_object($result)) {
+  foreach ($result as $child) {
     $string = array(
       'comment'     => $child->location,
       'source'      => $child->source,
@@ -1992,7 +1992,7 @@ function _locale_translate_seek() {
     $groups = module_invoke_all('locale', 'groups');
     $header = array(t('Text group'), t('String'), ($limit_language) ? t('Language') : t('Languages'), array('data' => t('Operations'), 'colspan' => '2'));
     $arr = array();
-    while ($locale = db_fetch_object($result)) {
+    foreach ($result as $locale) {
       $arr[$locale->lid]['group'] = $groups[$locale->textgroup];
       $arr[$locale->lid]['languages'][$locale->language] = $locale->translation;
       $arr[$locale->lid]['location'] = $locale->location;
@@ -2099,7 +2099,7 @@ function _locale_rebuild_js($langcode = 
     ORDER BY t.plural DESC", array(':language' => $language->language));
 
   $translations = $plurals = array();
-  while ($data = db_fetch_object($result)) {
+  foreach ($result as $data) {
     // Only add this to the translations array when there is actually a translation.
     if (!empty($data->translation)) {
       if ($data->plural) {
@@ -2178,7 +2178,7 @@ function _locale_rebuild_js($langcode = 
     // version of the language and to prevent checking against an outdated hash.
     $default_langcode = language_default('language');
     if ($default_langcode == $language->language) {
-      $default = db_fetch_object(db_query("SELECT * FROM {languages} WHERE language = '%s'", $default_langcode));
+      $default = db_query("SELECT * FROM {languages} WHERE language = ?", $default_langcode)->fetch();
       variable_set('language_default', $default);
     }
   }
@@ -2473,7 +2473,7 @@ function locale_batch_by_language($langc
     $query .= " AND name NOT IN (" . db_placeholders($skip, 'varchar') . ")";
   }
   $result = db_query($query, $skip);
-  while ($component = db_fetch_object($result)) {
+  foreach ($result as $component) {
     // Collect all files for all components, names as $langcode.po or
     // with names ending with $langcode.po. This allows for filenames
     // like node-module.de.po to let translators use small files and
@@ -2504,7 +2504,7 @@ function locale_batch_by_component($comp
     $language_list = join('|', array_keys($languages[1]));
     // Collect all files to import for all $components.
     $result = db_query("SELECT name, filename FROM {system} WHERE status = 1");
-    while ($component = db_fetch_object($result)) {
+    foreach ($result as $component) {
       if (in_array($component->name, $components)) {
         // Collect all files for this component in all enabled languages, named
         // as $langcode.po or with names ending with $langcode.po. This allows
Index: includes/module.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/module.inc,v
retrieving revision 1.124
diff -u -p -r1.124 module.inc
--- includes/module.inc	21 Aug 2008 19:36:36 -0000	1.124
+++ includes/module.inc	31 Aug 2008 11:47:35 -0000
@@ -54,7 +54,7 @@ function module_list($refresh = FALSE, $
       else {
         $result = db_query("SELECT name, filename FROM {system} WHERE type = 'module' AND status = 1 ORDER BY weight ASC, filename ASC");
       }
-      while ($module = db_fetch_object($result)) {
+      foreach ($result as $module) {
         if (file_exists($module->filename)) {
           drupal_get_filename('module', $module->name, $module->filename);
           $list[$module->name] = $module->name;
@@ -273,8 +273,8 @@ function module_load_all_includes($type,
 function module_enable($module_list) {
   $invoke_modules = array();
   foreach ($module_list as $module) {
-    $existing = db_fetch_object(db_query("SELECT status FROM {system} WHERE type = '%s' AND name = '%s'", 'module', $module));
-    if ($existing->status == 0) {
+    $existing = db_query("SELECT status FROM {system} WHERE type = ? AND name = ?", 'module', $module)->fetchField();
+    if ($existing == 0) {
       module_load_install($module);
       db_query("UPDATE {system} SET status = %d WHERE type = '%s' AND name = '%s'", 1, 'module', $module);
       drupal_load('module', $module);
Index: includes/session.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/session.inc,v
retrieving revision 1.52
diff -u -p -r1.52 session.inc
--- includes/session.inc	23 Aug 2008 07:13:49 -0000	1.52
+++ includes/session.inc	31 Aug 2008 11:47:35 -0000
@@ -40,7 +40,7 @@ function sess_read($key) {
     $user->roles = array();
     $user->roles[DRUPAL_AUTHENTICATED_RID] = 'authenticated user';
     $result = db_query("SELECT r.rid, r.name FROM {role} r INNER JOIN {users_roles} ur ON ur.rid = r.rid WHERE ur.uid = :uid", array(':uid' => $user->uid));
-    while ($role = db_fetch_object($result)) {
+    foreach ($result as $role) {
       $user->roles[$role->rid] = $role->name;
     }
   }
Index: includes/theme.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/theme.inc,v
retrieving revision 1.432
diff -u -p -r1.432 theme.inc
--- includes/theme.inc	16 Aug 2008 21:05:49 -0000	1.432
+++ includes/theme.inc	31 Aug 2008 11:47:35 -0000
@@ -434,7 +434,7 @@ function list_themes($refresh = FALSE) {
     // Also check that the site is not in the middle of an install or update.
     if (db_is_active() && !defined('MAINTENANCE_MODE')) {
       $result = db_query("SELECT * FROM {system} WHERE type = '%s'", 'theme');
-      while ($theme = db_fetch_object($result)) {
+      foreach ($result as $theme) {
         if (file_exists($theme->filename)) {
           $theme->info = unserialize($theme->info);
           $themes[] = $theme;
