deploy: auto commit repo-root changes 2026-06-13 11:43:39

This commit is contained in:
hajimi
2026-06-13 11:43:39 +08:00
parent 6b3bbab5ce
commit d246ab44e2
@@ -839,7 +839,10 @@ class CommunityController extends BaseApiController
$relativeDir = 'uploads/ai_lottery_posts/' . date('Ymd'); $relativeDir = 'uploads/ai_lottery_posts/' . date('Ymd');
$publicRoot = rtrim(public_path(), DIRECTORY_SEPARATOR . '/'); $publicRoot = rtrim(public_path(), DIRECTORY_SEPARATOR . '/');
$targetDir = $publicRoot . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $relativeDir); $targetDir = $publicRoot . DIRECTORY_SEPARATOR . str_replace('/', DIRECTORY_SEPARATOR, $relativeDir);
if (!is_dir($targetDir) && !mkdir($targetDir, 0755, true) && !is_dir($targetDir)) { if (!is_dir($targetDir) && !@mkdir($targetDir, 0755, true) && !is_dir($targetDir)) {
return '';
}
if (!is_writable($targetDir)) {
return ''; return '';
} }
@@ -847,7 +850,7 @@ class CommunityController extends BaseApiController
$relativeUri = $relativeDir . '/' . $filename; $relativeUri = $relativeDir . '/' . $filename;
$targetPath = $targetDir . DIRECTORY_SEPARATOR . $filename; $targetPath = $targetDir . DIRECTORY_SEPARATOR . $filename;
if (!is_file($targetPath) && file_put_contents($targetPath, $body) === false) { if (!is_file($targetPath) && @file_put_contents($targetPath, $body) === false) {
return ''; return '';
} }