[*] fix index
This commit is contained in:
1 parent
2d85ba8b46
commit
7ef42a9cf4
4 files changed
+44
-23
No files matched your search
@@ -29,6 +29,11 @@
|
|||||||
*/
|
*/
|
||||||
const TELEGRAM_BOT_TOKEN = '5232660453:AAGfMWu6EcRfBGSSURJsEEvGPmAqhCyzYHU';
|
const TELEGRAM_BOT_TOKEN = '5232660453:AAGfMWu6EcRfBGSSURJsEEvGPmAqhCyzYHU';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ID чата канала уведомлений в телеграм
|
||||||
|
*/
|
||||||
|
const TELEGRAM_NOTIFICATION_CHANNEL = '-1001714289174';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Время, в течении которого считаем пользователя онлайн, сек.
|
* Время, в течении которого считаем пользователя онлайн, сек.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -31,6 +31,11 @@
|
|||||||
*/
|
*/
|
||||||
public $body = '';
|
public $body = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Тип
|
||||||
|
*/
|
||||||
|
public $type = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Массив заголовков файлов
|
* Массив заголовков файлов
|
||||||
*/
|
*/
|
||||||
@@ -70,6 +75,14 @@
|
|||||||
$this->body = $body;
|
$this->body = $body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Тело письма
|
||||||
|
*/
|
||||||
|
public function setType($type = 'html')
|
||||||
|
{
|
||||||
|
$this->type = $type;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Добавление файла к письму
|
* Добавление файла к письму
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -127,7 +127,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Получение имени текущего пользователя
|
* Получение времени ппоследней активности
|
||||||
*
|
*
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
@@ -155,7 +155,7 @@
|
|||||||
* @return array
|
* @return array
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public static function getUsers(string $limit = '10', $sort = 'ASC')
|
public static function getUsers(string $limit = '10', string $sort = 'ASC'): array
|
||||||
{
|
{
|
||||||
$cacheId = md5('User_getUsers_' . $limit . '_' . $sort);
|
$cacheId = md5('User_getUsers_' . $limit . '_' . $sort);
|
||||||
if (Cache::check($cacheId)) {
|
if (Cache::check($cacheId)) {
|
||||||
@@ -186,6 +186,7 @@
|
|||||||
* Генерация GUID
|
* Генерация GUID
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
|
* @throws \Exception
|
||||||
*/
|
*/
|
||||||
private static function generateGUID(): string
|
private static function generateGUID(): string
|
||||||
{
|
{
|
||||||
@@ -272,7 +273,7 @@
|
|||||||
*
|
*
|
||||||
* @throws CoreException
|
* @throws CoreException
|
||||||
*/
|
*/
|
||||||
public static function registration(string $login, string $password, string $email, string $name = '', string $image = ''): int
|
public static function create(string $login, string $password, string $email, string $name = '', string $image = ''): int
|
||||||
{
|
{
|
||||||
Log::logToFile(__METHOD__, 'User.log', func_get_args());
|
Log::logToFile(__METHOD__, 'User.log', func_get_args());
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,27 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
//require_once $_SERVER['DOCUMENT_ROOT'] . '/core/bootstrap.php';
|
$_SERVER['DOCUMENT_ROOT'] = '/home/rsgrinko/sites/dev.it-stories.ru';
|
||||||
if (php_sapi_name() === 'cli') {
|
require_once $_SERVER['DOCUMENT_ROOT'] . '/core/bootstrap.php';
|
||||||
$cliMode = true;
|
use Core\ExternalServices\TelegramSender;
|
||||||
|
use Core\Helpers\Log;
|
||||||
|
|
||||||
|
$numProc = 4;
|
||||||
|
|
||||||
|
if (empty($argv[1])) {
|
||||||
|
$currentRunThread = (int)exec('ps -awx | grep \'test.php\' | grep -v \'grep\' | wc -l');
|
||||||
|
echo 'Now running: ' . $currentRunThread . PHP_EOL;
|
||||||
|
while ($currentRunThread <= $numProc) {
|
||||||
|
echo 'Run new (' . $currentRunThread . ')' . PHP_EOL;
|
||||||
|
$handler = '(php -f /home/rsgrinko/sites/dev.it-stories.ru/test.php ' . $currentRunThread . ' &) >> /dev/null 2>&1';
|
||||||
|
passthru($handler);
|
||||||
|
$currentRunThread = (int)exec('ps -awx | grep \'test.php\' | grep -v \'grep\' | wc -l');
|
||||||
|
echo 'Now running: ' . $currentRunThread . PHP_EOL;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$cliMode = false;
|
$res = (new TelegramSender(TELEGRAM_BOT_TOKEN))->setChat(TELEGRAM_NOTIFICATION_CHANNEL)->sendMessage('Start proc #' . $argv[1]);
|
||||||
}
|
Log::logToFile(json_encode($res, JSON_UNESCAPED_UNICODE), 'test.log', $argv[1]);
|
||||||
|
sleep(rand(2, 10));
|
||||||
|
$res = (new TelegramSender(TELEGRAM_BOT_TOKEN))->setChat(TELEGRAM_NOTIFICATION_CHANNEL)->sendMessage('End proc #' . $argv[1]);
|
||||||
if ($cliMode) {
|
Log::logToFile(json_encode($res, JSON_UNESCAPED_UNICODE), 'test.log', $argv[1]);
|
||||||
echo 'run' . PHP_EOL;
|
|
||||||
for ($i = 0; $i < 1024; $i++) {
|
|
||||||
|
|
||||||
}
|
|
||||||
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);
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference in new issue
Block a user