|
|
@@ -51,6 +51,9 @@ $regex_search = "";
|
|
|
$replace_str = "";
|
|
|
$thisFile = __DIR__ . "/" . $argv[0];
|
|
|
|
|
|
+$script_time_start = 0;
|
|
|
+$script_time_end = 0;
|
|
|
+
|
|
|
function GET_DIR_CONTENTS($dir, &$results = array()) {
|
|
|
$files = scandir($dir);
|
|
|
|
|
|
@@ -176,6 +179,7 @@ else{
|
|
|
}
|
|
|
|
|
|
echo " > Performing initial directory traversal, please wait...\n";
|
|
|
+$script_time_start = microtime(true);
|
|
|
|
|
|
$contents = array();
|
|
|
GET_DIR_CONTENTS($dirToTraverse, $contents);
|
|
|
@@ -190,8 +194,10 @@ if ($remove_self){
|
|
|
}
|
|
|
|
|
|
// var_dump($contents);
|
|
|
+$script_time_end = microtime(true);
|
|
|
+$script_runtime = $script_time_end - $script_time_start;
|
|
|
|
|
|
-echo " > Initial directory traversal complete.\n";
|
|
|
+echo " > Initial directory traversal complete [" . $script_runtime . " ms].\n";
|
|
|
|
|
|
$counter = 0;
|
|
|
$stop_preview = false;
|
|
|
@@ -234,9 +240,12 @@ foreach ($contents as $c){
|
|
|
|
|
|
$content_map_new = $content_map;
|
|
|
|
|
|
+echo " > Creating new content map based on supplied search and replace settings, please wait...\n";
|
|
|
+
|
|
|
// print_r($content_map);
|
|
|
// Build the replacement content map. This contains the same path => filename
|
|
|
// format but with the updated filename instead of the original.
|
|
|
+$script_time_start = microtime(true);
|
|
|
foreach ($content_map_new as $p => $f){
|
|
|
|
|
|
// REPLACE2($str, $search, $replace)
|
|
|
@@ -245,7 +254,10 @@ foreach ($content_map_new as $p => $f){
|
|
|
$content_map_new[$p] = $filename_new;
|
|
|
}
|
|
|
|
|
|
-echo " > New content map created. See below for preview.\n";
|
|
|
+$script_time_end = microtime(true);
|
|
|
+$script_runtime = $script_time_end - $script_time_start;
|
|
|
+
|
|
|
+echo " > Success: new content map created [" . $script_runtime . " ms].\n";
|
|
|
|
|
|
echo " > FILE AND DIRECTORY PREVIEW:\n ================================\n";
|
|
|
|
|
|
@@ -303,6 +315,8 @@ if (ARE_STRINGS_EQUAL($begin_operation, "Y", true)){
|
|
|
$items_remaining = $total_items;
|
|
|
$curr_item = 0;
|
|
|
$progress_val = 0;
|
|
|
+ $script_time_start = microtime(true);
|
|
|
+
|
|
|
foreach ($content_map as $p => $f){
|
|
|
|
|
|
$curr_item++;
|
|
|
@@ -346,9 +360,12 @@ if (ARE_STRINGS_EQUAL($begin_operation, "Y", true)){
|
|
|
|
|
|
$items_remaining--;
|
|
|
|
|
|
- }
|
|
|
+ }
|
|
|
+
|
|
|
+ $script_time_end = microtime(true);
|
|
|
+ $script_runtime = $script_time_end - $script_time_start;
|
|
|
|
|
|
- echo " > Operation complete.\n";
|
|
|
+ echo " > Operation complete. [" . $script_runtime . " ms].\n";
|
|
|
exit(0);
|
|
|
|
|
|
}
|