You are here

function _scanner_change_env in Search and Replace Scanner 7

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

Attempt to stretch the amount of time available for processing.

This way timeouts won't interrupt search and replace actions. This only works in hosting environments where changing PHP and Apache settings on the fly is allowed.

Parameters

$setting: The name of the PHP setting to change.

$value: The new value to assign.

bool $verbose: If set to TRUE, an extra message will be displayed indicating the status of the execution.

Return value

bool Indicates whether the setting is changed.

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

File

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

Code

function _scanner_change_env($setting, $value, $verbose = FALSE) {
  $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;
    }
  }
}