I am attempting to wrap my head around some of the advance features of drush. i am using Drush User's Guide and it's example code and ran into this error [Fatal error: Call to undefined function updatedb() in /home/trakz/.drush/user_blocker.drush.inc on line 68]from the code below.

Line 68 is: [$query= updatedb('users')]

Can anyone tell me what is wrong? I have checked the Drush guide and updatedb() is valid. Googling around did not help.

drupal 6.28 drush 5.7

any assistance woudl be greatly appreciated. Thank you.

 * Callback implementation for user-blocker command
function drush_user_blocker() {
  // Grab all languages given. If any.
  $languages = func_get_args();

  // See if we received a date from which we should filter
  $since = strtotime(drush_get_option('since', '2 years ago')); 

  // Perform the update over the users table
  $query= updatedb('users')
  ->fields(array('status' => 0,))
  ->condition('uid', array(0, 1), 'NOT IN')
  ->condition('access', array(1, $since), 'BETWEEN');

  // Add the condition to filter by language
  if (count($languages)) {
    $query->condition('language', $languages, 'IN');

  $total_blocked = $query->execute();
  drush_log(dt("Blocked !total_blocked users", array('!total_blocked' => $total_blocked)), 'success');

1 Answer 1


drush updatedb is a valid command.

updatedb (updb) Apply any database updates required (as with running update.php).

However, I'm not sure about using it in place of db_query.

In D7 you would use db_update there.

In D6, you're stuck with db_query

It looks like a syntax error in the module code, it probably needs to use D6 style db_query

  • HI David. I added the d6 style and at least got past the line, now I get an error on the next line [->fields(array('status' => 0,))] member function field is a non-object. Think I had better find another tutorial to use. Thank you for your help. Commented Nov 19, 2013 at 2:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.