Author: Shivam Mathur (shivammathur)
Date: 2025-01-27T18:59:29+05:30
Commit: Create missing directories · php/web-downloads@f1a7fe0 · GitHub
Raw diff: https://github.com/php/web-downloads/commit/f1a7fe05fcde281547cf3b287f1cc747f7be2cf6.diff
Create missing directories
Changed paths:
M src/Http/Controllers/PeclController.php
M src/Http/Controllers/PhpController.php
Diff:
diff --git a/src/Http/Controllers/PeclController.php b/src/Http/Controllers/PeclController.php
index 43b0b4d..73fe86e 100644
--- a/src/Http/Controllers/PeclController.php
+++ b/src/Http/Controllers/PeclController.php
@@ -45,7 +45,12 @@ public function execute(array $data): void
*/
protected function fetchExtension(string $extension, string $ref, string $url, string $token): void
{
- $filepath = getenv('BUILDS_DIRECTORY') . "/pecl/$extension-$ref-" . hash('sha256', $url) . strtotime('now') . ".zip";
+ $directory = getenv('BUILDS_DIRECTORY') . "/pecl";
+ $filepath = $directory . "/$extension-$ref-" . hash('sha256', $url) . strtotime('now') . ".zip";
+
+ if(!is_dir($directory)) {
+ mkdir($directory, 0755, true);
+ }
(new FetchArtifact)->handle($url, $filepath, $token);
diff --git a/src/Http/Controllers/PhpController.php b/src/Http/Controllers/PhpController.php
index 4c25442..05f9b1b 100644
--- a/src/Http/Controllers/PhpController.php
+++ b/src/Http/Controllers/PhpController.php
@@ -46,7 +46,13 @@ private function fetchPhpBuild(string $url, string $token): void
{
$hash = hash('sha256', $url) . strtotime('now');
- $filepath = getenv('BUILDS_DIRECTORY') . "/php/php-" . $hash . ".tar.gz";
+ $directory = getenv('BUILDS_DIRECTORY') . "/php";
+
+ $filepath = $directory . "/php-" . $hash . ".tar.gz";
+
+ if(!is_dir($directory)) {
+ mkdir($directory, 0755, true);
+ }
(new FetchArtifact)->handle($url, $filepath, $token);