I get the error:

Fatal error: Call to undefined function drupal_current_script_url() in /home/rgracia/public_html/update.php on line 251

After uploading the 7.10 update to my site running 7.9 and attempting to run update.php. I can access the admin area, just can't run update.php to complete the upgrade. What can I do? Can't find anything on google with drupal 7 sites having this issue. Please help!

Comments

rgracia’s picture

Here's the code in that block; lines 232 through 255:

function update_info_page() {
  // Change query-strings on css/js files to enforce reload for all users.
  _drupal_flush_css_js();
  // Flush the cache of all data for the update status module.
  if (db_table_exists('cache_update')) {
    cache_clear_all('*', 'cache_update', TRUE);
  }

  update_task_list('info');
  drupal_set_title('Drupal database update');
  $token = drupal_get_token('update');
  $output = '<p>Use this utility to update your database whenever a new release of Drupal or a module is installed.</p><p>For more detailed information, see the <a href="http://drupal.org/upgrade">upgrading handbook</a>. If you are unsure what these terms mean you should probably contact your hosting provider.</p>';
  $output .= "<ol>\n";
  $output .= "<li><strong>Back up your database</strong>. This process will change your database values and in case of emergency you may need to revert to a backup.</li>\n";
  $output .= "<li><strong>Back up your code</strong>. Hint: when backing up module code, do not leave that backup in the 'modules' or 'sites/*/modules' directories as this may confuse Drupal's auto-discovery mechanism.</li>\n";
  $output .= '<li>Put your site into <a href="' . base_path() . '?q=admin/config/development/maintenance">maintenance mode</a>.</li>' . "\n";
  $output .= "<li>Install your new files in the appropriate location, as described in the handbook.</li>\n";
  $output .= "</ol>\n";
  $output .= "<p>When you have performed the steps above, you may proceed.</p>\n";
  $form_action = check_url(drupal_current_script_url(array('op' => 'selection', 'token' => $token)));
  $output .= '<form method="post" action="' . $form_action . '"><p><input type="submit" value="Continue" class="form-submit" /></p></form>';
  $output .= "\n";
  return $output;
}
rgracia’s picture

Strange. It resolved itself. I did have to delete the files from my server and replace them with the new core, even though Dreamweaver was supposed to replace them anyway during sync.

louloubug’s picture

I'm having the same problem. Replacing the code with the above didn't work. I'm at a loss on what to do.

rgracia’s picture

katragina I had to specifically delete the update.php twice and re upload the one included on 7.10, then clear the cache several times and also on my browser. Then it worked. Hope that helps.

dllsethr’s picture

Hi! You just have to re upload the update.php from your original installation file. Then you may be able to proceed with the database update. Hope this works for you

carusen’s picture

I have exactly the same error and clearing caches or re-uploading the update.php file did not help.

Any other ideas?

wooody’s picture

Hello,
Try to check 2 files,

Install.inc includes/ directory
system.install modules/system directory

try to find the the original from Drupal version and re-upload.

Regards,

carusen’s picture

Wow! This worked. Thank you very much!

diazcooper’s picture

Great suggestion. That worked for me too. Question: I purchased a template that specifically asked me to replace these 2 files with the ones that came with the template. I backed them up anyways just in case and replaced them with those that come with Drupal core. Should I place them back after I've run my maintenance successfully?

psimchick’s picture

I opened the file includes/install.inc and checked if the function was defined. It wasn't, so I added the function from Drupal in the file:

function drupal_current_script_url($query = array()) {
$uri = $_SERVER['SCRIPT_NAME'];
$query = array_merge(drupal_get_query_parameters(), $query);
if (!empty($query)) {
$uri .= '?' . drupal_http_build_query($query);
}
return $uri;
}

Then, update.php worked and all my module updates were run in the database and all the errors went away.

northron’s picture

Thanks, it work like a charm!

northron’s picture

Thanks, it work like a charm!

brankolo’s picture

Thanks, your editing works.
I had that problem with a template of TemplateMonster, and now works.
Thank you again!

dhompas’s picture

Thanks psimchick, adding drupal_current_script_url to the bottom of includes/install.inc worked for me also.

PS, as with some others, I had originally updated this file from a template from templates.com ...