From: fomichev Date: Wed, 30 Oct 2024 09:15:39 +0000 (+0300) Subject: Заменил на алиас X-Git-Tag: 1.6~21^2~10 X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=6842f5a806f7151b62022a2d4a7780ebf1a23f9c;p=erp24_rep%2Fyii-erp24%2F.git Заменил на алиас --- diff --git a/erp24/api2/controllers/TelegramController.php b/erp24/api2/controllers/TelegramController.php index 597ee209..50c2b012 100644 --- a/erp24/api2/controllers/TelegramController.php +++ b/erp24/api2/controllers/TelegramController.php @@ -82,7 +82,7 @@ class TelegramController extends Controller $update = Json::decode($content); if (!$update) { - file_put_contents(self::$MESSAGES, "\nreceive wrong update, must not happen", FILE_APPEND); + file_put_contents(Yii::getAlias(self::$MESSAGES), "\nreceive wrong update, must not happen", FILE_APPEND); } if (isset($update["message"])) { @@ -105,7 +105,7 @@ class TelegramController extends Controller } // self::processMessage($update["callback_query"]["data"], $update["callback_query"]["from"]["id"], $update); } else { - file_put_contents(self::$MESSAGES, "\n" . Json::encode($update), FILE_APPEND); + file_put_contents(Yii::getAlias(self::$MESSAGES), "\n" . Json::encode($update), FILE_APPEND); } return "ok"; @@ -133,7 +133,7 @@ class TelegramController extends Controller $errno = curl_errno($handle); $error = curl_error($handle); error_log("Curl returned error $errno: $error\n"); - file_put_contents(self::$MESSAGES, "Curl returned error $errno: $error\n", FILE_APPEND); + file_put_contents(Yii::getAlias(self::$MESSAGES), "Curl returned error $errno: $error\n", FILE_APPEND); curl_close($handle); return false; } @@ -143,15 +143,15 @@ class TelegramController extends Controller if ($http_code >= 500) { // do not wat to DDOS server if something goes wrong - file_put_contents(self::$MESSAGES, "do not wat to DDOS server if something goes wrong\n", FILE_APPEND); + file_put_contents(Yii::getAlias(self::$MESSAGES), "do not wat to DDOS server if something goes wrong\n", FILE_APPEND); sleep(10); return false; } else if ($http_code != 200) { $response = json_decode($response, true); error_log("Request has failed with error {$response['error_code']}: {$response['description']}\n"); - file_put_contents(self::$MESSAGES, "Request has failed with error {$response['error_code']}: {$response['description']}\n", FILE_APPEND); + file_put_contents(Yii::getAlias(self::$MESSAGES), "Request has failed with error {$response['error_code']}: {$response['description']}\n", FILE_APPEND); if ($http_code == 401) { - file_put_contents(self::$MESSAGES, "Invalid access token provided\n", FILE_APPEND); + file_put_contents(Yii::getAlias(self::$MESSAGES), "Invalid access token provided\n", FILE_APPEND); throw new Exception('Invalid access token provided'); } return false; @@ -159,7 +159,7 @@ class TelegramController extends Controller $response = json_decode($response, true); if (isset($response['description'])) { error_log("Request was successful: {$response['description']}\n"); - file_put_contents(self::$MESSAGES, "Request was successful: {$response['description']}\n", FILE_APPEND); + file_put_contents(Yii::getAlias(self::$MESSAGES), "Request was successful: {$response['description']}\n", FILE_APPEND); } $response = $response['result']; } @@ -170,7 +170,7 @@ class TelegramController extends Controller private static function apiRequest($method, $parameters) { if (!is_string($method)) { error_log("Method name must be a string\n"); - file_put_contents(self::$MESSAGES, "Method name must be a string\n", FILE_APPEND); + file_put_contents(Yii::getAlias(self::$MESSAGES), "Method name must be a string\n", FILE_APPEND); return false; } @@ -178,7 +178,7 @@ class TelegramController extends Controller $parameters = array(); } else if (!is_array($parameters)) { error_log("Parameters must be an array\n"); - file_put_contents(self::$MESSAGES, "Parameters must be an array\n", FILE_APPEND); + file_put_contents(Yii::getAlias(Yii::getAlias(self::$MESSAGES)), "Parameters must be an array\n", FILE_APPEND); return false; } @@ -201,7 +201,7 @@ class TelegramController extends Controller private static function apiRequestJson($method, $parameters) { if (!is_string($method)) { error_log("Method name must be a string\n"); - file_put_contents(self::$MESSAGES, "Method name must be a string\n", FILE_APPEND); + file_put_contents(Yii::getAlias(self::$MESSAGES), "Method name must be a string\n", FILE_APPEND); return false; } @@ -209,7 +209,7 @@ class TelegramController extends Controller $parameters = array(); } else if (!is_array($parameters)) { error_log("Parameters must be an array\n"); - file_put_contents(self::$MESSAGES, "Parameters must be an array\n", FILE_APPEND); + file_put_contents(Yii::getAlias(self::$MESSAGES), "Parameters must be an array\n", FILE_APPEND); return false; }