function collect_next_jobs() { $cur_size = 0; $jobs = array(); foreach (parts() as $job) { if ($job->isFinished() || $job->isRunning()) { continue; } if ($cur_size + $job->getSize() > MAX_SIZE_HOUR) { break; } $jobs[] = $job; $cur_size += $job->getSize(); } return $jobs; }
$r .= ($in != -1 ? str_repeat($c, $in) : '') . (is_null($k) ? '' : "{$k}: ") . '<br>'; foreach ($v as $sk => $vl) { $r .= $pretty($vl, $c, $in + 1, $sk) . '<br>'; } } else { $r .= ($in != -1 ? str_repeat($c, $in) : '') . (is_null($k) ? '' : "{$k}: ") . (is_null($v) ? '<NULL>' : "<strong>{$v}</strong>"); } return $r; }; //$words = cartesian(capitalise($dictionary), parts("124567890")); //$capitalise = capitalise($dictionary); //$all = cartesian($capitalise, parts("1234567890")); //$x = array_merge($capitalise, $all); //$letters_numbers = cartesian(parts("abcdefghijklmnopqrstuvwxyz"), parts("1234567890")); //echo $pretty($x); exit; check(parts("azsxdcfvgbhnjmk")); exit; function check($words) { global $hashes; foreach ($words as $word) { $word_md5 = md5($word); if (in_array($word_md5, $hashes)) { echo $word_md5 . ' ' . $word . '<br>'; } } } function cada($array, $function) { $output = array(); foreach ($array as $item) {
define("VAULT", "Backups_Server"); $start_time = new \DateTime(); parse_xml(XML_FILE); $running_jobs = get_running_jobs(); $most_recent_job = null; // download running jobs foreach ($running_jobs as $job) { $oResult = client()->describeJob(array('accountId' => '-', 'vaultName' => VAULT, 'jobId' => $job->get("jobId"))); if ($oResult->get('StatusCode') == "Succeeded") { downloadJob($job); } elseif ($oResult->get('StatusCode') == "Failed") { $job->set('running', 0); } } // controleer of er een job gestart is in het afgelopen uur foreach (parts() as $job) { if (!$job->get('start_time') instanceof \DateTime) { continue; } if (is_null($most_recent_job)) { $most_recent_job = $job; continue; } if ($job->get('start_time') > $most_recent_job->get('start_time')) { $most_recent_job = $job; } } sleep(5); // om te voorkomen dat de laatste job exact een uur geleden is en we dus nog een uur gaan wachten.. if ($most_recent_job === null || $most_recent_job->get('start_time') < new \DateTime("now -10 minutes")) { $next_jobs = collect_next_jobs();