From: Aleksey Filippov Date: Mon, 2 Mar 2026 15:14:27 +0000 (+0300) Subject: fix(ERP-251): replace file_put_contents with Yii logging in DataBuhController X-Git-Url: https://gitweb.erp-flowers.ru/?a=commitdiff_plain;h=1186aec64d43d900703510bb468b275629a3bb9c;p=erp24_rep%2Fyii-erp24%2F.git fix(ERP-251): replace file_put_contents with Yii logging in DataBuhController Hardcoded path /var/www/erp24/api2/json_buh does not exist on deploy server (/var/www/erp24_deploy/), causing file_put_contents errors. Replace debug file dumps with Yii::info/Yii::error under 'buh.upload' category. Request data is already persisted via ApiCronBuh model. Co-Authored-By: Claude Opus 4.6 --- diff --git a/erp24/api2/controllers/DataBuhController.php b/erp24/api2/controllers/DataBuhController.php index 31559597..4f112071 100644 --- a/erp24/api2/controllers/DataBuhController.php +++ b/erp24/api2/controllers/DataBuhController.php @@ -12,11 +12,7 @@ use yii_app\services\MotivationServiceBuh; class DataBuhController extends BaseController { - const OUT_DIR = -// DIR . "/../json"; - "/var/www/erp24/api2/json_buh"; - -// "/var/www/www-root/data/www/api.bazacvetov24.ru/data/json"; + private const LOG_CATEGORY = 'buh.upload'; public function actionRequest($inn) { @@ -94,7 +90,7 @@ class DataBuhController extends BaseController $fl = time(); } - file_put_contents(self::OUT_DIR . '/upload_' . $fl . '.json', PHP_EOL . $request); + Yii::info("upload_{$fl}: " . mb_substr($request, 0, 500), self::LOG_CATEGORY); try { @@ -110,7 +106,7 @@ class DataBuhController extends BaseController } } catch (Exception $e) { - file_put_contents(self::OUT_DIR . '/error_buh_upload.txt', PHP_EOL . 'result empty', FILE_APPEND); + Yii::error('error_buh_upload: ' . $e->getMessage(), self::LOG_CATEGORY); } return $this->asJson(['request_id' => $requestId, 'response' => true]);