parseUrl($cms, ADMINISTRATION_FOLDER); //------------------------------------------------------------------ // Check hash & submit operations //------------------------------------------------------------------ if ($sKey = getG('ctp')) { if ($sKey == cMail::MAIL_REQUEST_KEY) { // Simulate CRON user login :D $user = new sysUsersController(); $user->suser->id = CRON_ID; $user->suser->b2FAEnabled = true; $user->suser->permissions = $user->oModule->loadUserPermissionArray(CRON_ID); if ($debug = getG('debug')) { $timer = new cTimer(); $timer->start(); } switch (getG('ct')) { //------------------------------------------------------------------ // Send immediately mail request //------------------------------------------------------------------ case 'send': if ($mailId = getG('id')) { sleep(5); $mailOverView = new cmsMailEngine(getFirstMatchByMapId(259, true)); $mailOverView->controller->cronSendMails([$mailId]); } break; //------------------------------------------------------------------ // Check immediately for new account activation //------------------------------------------------------------------ case 'registration-activation': sleep(5); $mailActivationCRON = new cmsAccountActivation(getFirstMatchByMapId(839, true)); $mailActivationCRON->controller->chkUserRegDataCRONCall(); break; //------------------------------------------------------------------ // Different type of operations: // Send mail, generate attachments, check //------------------------------------------------------------------ case 'check': // Call CRON every 2min cDbLogModule::baseActionLog('chk_cron */2 * * * *'); //------------------------------------------------------------------------- // Send mail //------------------------------------------------------------------------- $mailOverView = new cmsMailEngine(getFirstMatchByMapId(259, true)); $mailOverView->controller->cronSendMails(); //------------------------------------------------------------------------- // 1x per day do: //------------------------------------------------------------------------- $DATE = date("d-m-Y"); if (betweenTime(array( "{$DATE} 05:00:00" => "{$DATE} 05:01:59", /*"{$DATE} 14:50:00" => "{$DATE} 14:54:50", "{$DATE} 00:00:00" => "{$DATE} 23:59:59"*/ ))) { // Generate Bug mails // $cBugs = new pubBugs(getFirstMatchByMapId(699, true)); // $cBugs->controller->sendEmailWithCreatedList( // strtotime("-1 day 00:00:00"), // strtotime("-1 day 23:59:59") // ); // Generate XML data files $export = new pubExport(getFirstMatchByMapId(840)); // export site map id $export->controller->genExportXML(); cDbLogModule::baseActionLog('XML GEN -- OK!'); // Clear access tokens, temp links, ect. from db $cr = new cCron(); $cr->execBDEndCronScripts(); cDbLogModule::baseActionLog('CRON_CLEANUP -- OK!'); } //------------------------------------------------------------------------- // Project export request check //------------------------------------------------------------------------- $oUpdRequest = new cmsSvnProjectManager(); $oUpdRequest->controller->chkActiveProjectExportRequests(); $oUpdRequest = new sysUpdater(); $oUpdRequest->controller->chkProjectUpdateStatus(); //------------------------------------------------------------------------- // Create times for cron call for gathering data for welcome page - EVERY HOUR //------------------------------------------------------------------------- $iTime = sysEmptyController::$iRefreshRate; $x = $iTime; $xx = strtotime("00:00:00"); $vDates = array(); while ($x < 24 * 60 * 60) { // 24h $vDates["{$DATE} " . date('H:i:s', $xx + $x)] = "{$DATE} " . date('H:i:s', $xx + $x + 119); $x += $iTime; } if (!!$vDates && betweenTime($vDates)) { if (!!sysEmptyController::$vGAViews) { foreach (sysEmptyController::$vGAViews as $k => $v) { sysEmptyController::cronGatherDataAndSetToAPC( $v, 'Maison Alexandra Analytics application', false, true ); } } cDbLogModule::baseActionLog('GOOGLE_API_USERS -- OK!'); } break; default: break; } if ($debug) { $timer->stop(); echo round($timer->elapsed, 3); } } else { http_response_code(404); die(); } }