getSetting('daily_cron_previous_run'); // Check if there is even a reason to run this if ($previous_run) { // Using (Day - Hour) as a check, timing could be imperfect if (($now - $previous_run) < 82800) { $runnable = false; } } if ($runnable) { // Update last run time $setting = new Setting("daily_cron_previous_run"); $setting->updateValue($now); // Run methods self::dailyWaitingApproval(); return true; } return false; } static private function hourlyRunner() { global $Dippler; $runnable = true; $now = time(); $previous_run = (int)$Dippler->getSetting('hourly_cron_previous_run'); // Check if there is even a reason to run this if ($previous_run) { // Using (Hour - 5 Minutes) as a check, timing could be imperfect if (($now - $previous_run) < 3300) { $runnable = false; } } if ($runnable) { // Update last run time $setting = new Setting("hourly_cron_previous_run"); $setting->updateValue($now); // Run methods return true; } return false; } /* Runnable functionalities */ static private function dailyWaitingApproval() { global $Dippler; $unapproved_count = $Dippler->backoffice->getOrganizationUnapprovedUsersCount(); if ($unapproved_count) { $administrators = $Dippler->listAdminsFull(); if (is_array($administrators) && sizeof($administrators) > 0) { Mailer::sendWaitingApproval($unapproved_count, $administrators); } } } }