//"/www/media/notification";
"/var/www/erp24/media/notification";
+ private static function getPathNotification()
+ {
+ return self::getPath() . "/notification";
+ }
+
private static function getPath()
{
return dirname(__DIR__, 1);
*/
$rawBody = Yii::$app->request->getRawBody();
- if (!is_dir(self::OUT_DIR)) {
- mkdir(self::OUT_DIR, 0777, true);
+ if (!is_dir(self::getPathNotification())) {
+ mkdir(self::getPathNotification(), 0777, true);
}
file_put_contents(
- self::OUT_DIR . '/notifications.txt',
+ self::getPathNotification() . '/notifications.txt',
PHP_EOL . date('Y-m-d H:i:s') . ' ' . $rawBody,
FILE_APPEND
);
Yii::error("Ошибка декодирования JSON: " . $e->getMessage());
Yii::$app->response->statusCode = 400;
file_put_contents(
- self::getPath() . '/notification_error.txt',
+ self::getPathNotification() . '/notification_error.txt',
PHP_EOL . date("d.m.Y H:i:s", time()) . " " . $e->getMessage() . $e->getLine(),
FILE_APPEND
);
} catch (\Exception $e) {
Yii::$app->response->statusCode = 400;
file_put_contents(
- self::OUT_DIR . '/notification_error.txt',
+ self::getPathNotification() . '/notification_error.txt',
PHP_EOL . date("d.m.Y H:i:s", time()) . $e->getMessage() . $e->getLine(),
FILE_APPEND
);
default:
Yii::info("Неизвестный тип события: {$eventType}");
file_put_contents(
- self::OUT_DIR . '/notification_error.txt',
+ self::getPathNotification() . '/notification_error.txt',
PHP_EOL . date("d.m.Y H:i:s", time()) . " Неизвестный тип события: {$eventType}",
FILE_APPEND
);
} catch (\Exception $e) {
Yii::error("Error processing event {$eventType}: " . $e->getMessage());
file_put_contents(
- self::OUT_DIR . '/notification_error.txt',
+ self::getPathNotification() . '/notification_error.txt',
PHP_EOL . date("d.m.Y H:i:s", time()) . $e->getMessage() . $e->getLine(),
FILE_APPEND
);