You are here

function _scanner_change_env in Search and Replace Scanner 5.2

Same name and namespace in other branches
  1. 6 scanner.module \_scanner_change_env()
  2. 7 scanner.module \_scanner_change_env()

Attempt to stretch the amount of time available for processing so that timeouts don't interrupt search and replace actions.

This only works in hosting environments where changing PHP and Apache settings on the fly is allowed.

1 call to _scanner_change_env()
scanner_execute in ./scanner.module
Handles the actual search and replace.

File

./scanner.module, line 1099
Search and Replace Scanner - works on all nodes text content.

Code

function _scanner_change_env($setting, $value, $verbose) {
  $old_value = ini_get($setting);
  if ($old_value != $value && $old_value != 0) {
    if (ini_set($setting, $value)) {
      if ($verbose) {
        drupal_set_message(t('%setting changed from %old_value to %value.', array(
          '%setting' => $setting,
          '%old_value' => $old_value,
          '%value' => $value,
        )));
      }
      return TRUE;
    }
    else {
      if ($verbose) {
        drupal_set_message(t('%setting could not be changed from %old_value to %value.', array(
          '%setting' => $setting,
          '%old_value' => $old_value,
          '%value' => $value,
        )), 'error');
      }
      return FALSE;
    }
  }
}