[*] новые фичи 3

This commit is contained in:
rsgrinko committed 2022-06-17 16:02:12 +03:00
1 parent 7fc566430f
commit 259575f2b1
8 files changed
+316 -119

No files matched your search

+19 -49
View File
@@ -1,55 +1,25 @@
<?php
error_reporting(E_ALL);
require_once $_SERVER['DOCUMENT_ROOT'] . '/core/bootstrap.php';
$smarty = new Smarty;
// Включение кэширования.
$smarty->caching = true;
//require_once $_SERVER['DOCUMENT_ROOT'] . '/core/bootstrap.php';
if (php_sapi_name() === 'cli') {
$cliMode = true;
} else {
$cliMode = false;
}
// Время жизни кеша в секундах (-1 - включает его навсегда).
$smarty->cache_lifetime = 120;
// Передача значений в шаблон:
$smarty->assign('h1', 'хелоу');
$smarty->assign('text', 'Hello World...');
$smarty->assign('number', 200);
if ($cliMode) {
echo 'run' . PHP_EOL;
for ($i = 0; $i < 1024; $i++) {
// Обычный массив.
$smarty->assign(
'array_1', array(
'Понедельник',
'Вторник',
'Среда'
)
);
// Ассоциативный массив.
$smarty->assign(
'array_2', array(
'item_a' => 'Январь',
'item_b' => 'Февраль',
'item_c' => 'Март'
)
);
// Многомерный массив.
$smarty->assign(
'array_3', array(
array(
'id' => 1,
'name' => 'Весна',
),
array(
'id' => 2,
'name' => 'Лето',
),
array(
'id' => 3,
'name' => 'Осень',
),
)
);
// Вывод шаблона.
$smarty->display('index.tpl');
}
echo 'stop' . PHP_EOL;
} else {
//$currentRunThread = (int)exec('ps -awx | grep \'test.php\' | grep -v \'grep\' | wc -l');
//if ($currentRunThread < 4) {
//echo 'run new (' . $currentRunThread . ')';
$handler = 'php /home/rsgrinko/sites/dev.it-stories.ru/test.php cli &';
exec($handler);
//}
}