diff --git a/app/destinations/app_defaults.php b/app/destinations/app_defaults.php index c0d11ca399..f48e1d8757 100644 --- a/app/destinations/app_defaults.php +++ b/app/destinations/app_defaults.php @@ -58,7 +58,11 @@ if ($domains_processed == 1) { $database = new database; $destinations = $database->select($sql, null, 'all'); if (is_array($destinations)) { + //pre-set the numbers + $row_id = 0; $z=0; + + //loop through the array foreach ($destinations as $row) { //prepare the actions array if (isset($row['destination_app']) && $row['destination_data'] != '') { @@ -76,7 +80,33 @@ if ($domains_processed == 1) { $array['destinations'][$z]['destination_actions'] = json_encode($actions); $z++; } - + + //process a chunk of the array + if ($row_id === 1000) { + //save to the data + if (is_array($array)) { + //add temporary permissions + $p = new permissions; + $p->add('destination_edit', 'temp'); + + //create the database object and save the data + $database = new database; + $database->app_name = 'destinations'; + $database->app_uuid = '5ec89622-b19c-3559-64f0-afde802ab139'; + $database->save($array, false); + unset($array); + + //remove the temporary permissions + $p->delete('destination_edit', 'temp'); + } + + //set the row id back to 0 + $row_id = 0; + } + + //increment the number + $row_id++; + //unset actions unset($actions); }