kernel update
This commit is contained in:
@ -11,7 +11,7 @@ class Files
|
||||
{
|
||||
if (is_dir($d1)) {
|
||||
if (!file_exists($d2)){
|
||||
$_d2 = mkdir($d2, permissions: 0755, recursive: true);
|
||||
$_d2 = mkdir($d2, permissions: 0774, recursive: true);
|
||||
if (!$_d2) {
|
||||
return;
|
||||
}
|
||||
@ -74,6 +74,12 @@ class Files
|
||||
$zip->close();
|
||||
}
|
||||
|
||||
public static function uploadByUrl(string $url, string $uploadDir = RESOURCES_DIR . "/upload"): void
|
||||
{
|
||||
$file_name = basename($url);
|
||||
file_put_contents($uploadDir . '/' . $file_name, file_get_contents($url));
|
||||
}
|
||||
|
||||
private function recursiveAddFile(ZipArchive $zip, string $dir, string $folder = ''): void
|
||||
{
|
||||
$includes = new FilesystemIterator($dir);
|
||||
|
21
kernel/helpers/RESTClient.php
Normal file
21
kernel/helpers/RESTClient.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace kernel\helpers;
|
||||
|
||||
use http\Client;
|
||||
|
||||
class RESTClient
|
||||
{
|
||||
|
||||
|
||||
public static function request(string $url, string $method = 'GET')
|
||||
{
|
||||
$client = new \GuzzleHttp\Client();
|
||||
return $client->request($method, $url, [
|
||||
'headers' => [
|
||||
'Authorization' => 'Bearer ' . $_ENV['MODULE_SHOP_TOKEN']
|
||||
]
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user