Commit 38abff40 authored by Amit Asaravala's avatar Amit Asaravala
Browse files

Updated storage of timeout variables to allow multiple users on a site to run...

Updated storage of timeout variables to allow multiple users on a site to run scanner at the same time
parent 10affe6b
...@@ -16,9 +16,11 @@ among other things. ...@@ -16,9 +16,11 @@ among other things.
II. LIMITATIONS: II. LIMITATIONS:
1. Only works on sites using a MySQL database. 1. A user can only have one instance of Search and Replace Scanner running at a time. Attempting to open Scanner in two separate windows to perform replacements at the same time can lead to unknown errors if you encoutner a timeout.
2. Large search and replace actions may not be completed on sites that are 2. Only works on sites using a MySQL database.
3. Large search and replace actions may not be completed on sites that are
hosted in environments where PHP's max_execution_time variable can't be hosted in environments where PHP's max_execution_time variable can't be
dynamically expanded. The module automatically attempts to expand the dynamically expanded. The module automatically attempts to expand the
maximum execution time of a script to 10 minutes. (It's often set at 2 minutes.) maximum execution time of a script to 10 minutes. (It's often set at 2 minutes.)
......
...@@ -614,8 +614,8 @@ function scanner_execute($searchtype = 'search') { ...@@ -614,8 +614,8 @@ function scanner_execute($searchtype = 'search') {
$expanded = FALSE; $expanded = FALSE;
// get process and undo data if saved from timeout // get process and undo data if saved from timeout
$processed = variable_get('scanner_partially_processed', array()); $processed = variable_get('scanner_partially_processed_'. $user->uid, array());
$undo_data = variable_get('scanner_partial_undo', array()); $undo_data = variable_get('scanner_partial_undo_'. $user->uid, array());
unset($_SESSION['scanner_status']); unset($_SESSION['scanner_status']);
...@@ -750,8 +750,8 @@ function scanner_execute($searchtype = 'search') { ...@@ -750,8 +750,8 @@ function scanner_execute($searchtype = 'search') {
// if expanded environment still running out of time - shutdown process // if expanded environment still running out of time - shutdown process
else { else {
$shutting_down = TRUE; $shutting_down = TRUE;
variable_set('scanner_partially_processed', $processed); variable_set('scanner_partially_processed_'. $user->uid, $processed);
variable_set('scanner_partial_undo', $undo_data); variable_set('scanner_partial_undo_'. $user->uid, $undo_data);
if($searchtype == 'search') { if($searchtype == 'search') {
drupal_set_message(t('Did not have enough time to complete search.'),'error'); drupal_set_message(t('Did not have enough time to complete search.'),'error');
} }
...@@ -849,8 +849,8 @@ function scanner_execute($searchtype = 'search') { ...@@ -849,8 +849,8 @@ function scanner_execute($searchtype = 'search') {
// if completed // if completed
if(!$shutting_down) { if(!$shutting_down) {
variable_del('scanner_partially_processed'); variable_del('scanner_partially_processed_'. $user->uid);
variable_del('scanner_partial_undo'); variable_del('scanner_partial_undo_'. $user->uid);
} }
if ($searchtype == 'search') { if ($searchtype == 'search') {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment