So i have this code as follows
So i have this code as follows
And i modified it to do multiple overwrites instead of one.
However each destination overwrites the first instead of adding to the array
can someone help me... this is the way the code currently looks
So i have this code as follows
| Code: |
| $new_files_info = (!empty($xml_actions['COPY'])) ? $xml_actions['COPY'] : array();
for ($i = 0; $i < sizeof($new_files_info); $i++) { $new_files = $new_files_info[$i]['children']['FILE']; for ($j = 0; $j < sizeof($new_files); $j++) { $from = str_replace('\\', '/', $new_files[$j]['attrs']['FROM']); $to = str_replace('\\', '/', $new_files[$j]['attrs']['TO']); $actions['NEW_FILES'][$from] = $to; } } |
And i modified it to do multiple overwrites instead of one.
However each destination overwrites the first instead of adding to the array
can someone help me... this is the way the code currently looks
| Code: |
| $new_files_info = (!empty($xml_actions['COPY'])) ? $xml_actions['COPY'] : array();
for ($i = 0; $i < sizeof($new_files_info); $i++) { $new_files = $new_files_info[$i]['children']['FILE']; for ($j = 0; $j < sizeof($new_files); $j++) { $from = str_replace('\\', '/', $new_files[$j]['attrs']['FROM']); $to = str_replace('\\', '/', $new_files[$j]['attrs']['TO']); //mod for prosilver replace if(strpos($to, 'prosilver') ? true : false) { $fixedpath = str_replace('prosilver', '*', $to); $staroccur = strpos($fixedpath, '*'); $frontpath = substr($fixedpath , 0, $staroccur); $backpath = strstr($fixedpath, '*'); $backoccur = strpos($backpath, '/', 2); $backpathb = substr($backpath , $backoccur); $backsub = substr($backpath , 2, ($backoccur-2)); $pathread = $frontpath . "*/" . $backsub; $paths = glob($_SERVER['DOCUMENT_ROOT'] ."/anime/". $pathread); for ($q = 0; $q < sizeof($paths); $q++) { $returnpath = str_replace($_SERVER['DOCUMENT_ROOT'] ."/anime/", '', $paths[$q]); $actions['NEW_FILES'][$from] = $returnpath . $backpathb; } } else { $actions['NEW_FILES'][$from] = $to; } } } |
