show-next-crontabs.php
См. документацию.
1 <?php
2 
3 /**
4  * @file
5  * @brief действие возвращает список расписания следующих крон задач по id задачи
6  */
7 
8 isset($user) or require $_SERVER['DOCUMENT_ROOT'] . '/page/404.php';
9 
10 header("Content-type: application/json");
11 
12 array_walk_recursive($_POST, function (&$item) {
13  $item = trim(htmlspecialchars($item, ENT_QUOTES));
14 });
15 
16 $_POST['id'] = abs(intval($_POST['id']));
17 
18 
19 try {
20  $cron = Cron\CronExpression::factory($_POST['shedule']);
21 } catch (\Throwable $th) {
22  exit(json_encode(['error' => $th->getMessage(), 'id' => $_POST['id']]));
23 }
24 
25 
26 $shedules = [];
27 for ($i = 0; $i < 25; $i++) {
28  $shedules[] = $cron->getNextRunDate(null, $i)->format('Y-m-d H:i:s');
29 }
30 
31 
32 exit(json_encode(['result' => 'ok', 'message' => 'Успешно', 'id' => $_POST['id'], 'shedules' => $shedules]));
if(empty($_POST['name'])) if(empty($_POST['type'])||!in_array($_POST['type'], ['page', 'modal', 'incode', 'select', 'action'])) $i
$user
Definition: from-user.php:38
setcookie('FROM_UID', $uid, [ 'expires'=> time()+31536000, 'path'=> '/', 'domain'=> $_SERVER['HTTP_HOST'], 'secure'=> Wrong\Start\Env::$e->IS_SECURE, 'httponly'=> false, 'samesite'=> Wrong\Start\Env::$e->IS_SECURE ? 'None' :'Lax']) or setcookie('FROM_UID' $_SERVER['HTTP_HOST']
Definition: from-user.php:36
if(($dbh=Connect::getInstance(true) ->dbh) && $dbh->query("SHOW TABLES") ->fetchAll() && $dbh->query("SELECT COUNT(*) FROM `users`") ->fetchColumn()) if(!empty($_POST)) exit
Definition: install.php:198
$_POST['id']
catch(\Throwable $th) $shedules