|
|
@ -15,6 +15,7 @@ use Illuminate\Support\Facades\Http; |
|
|
|
use Laravel\Lumen\Routing\Controller as BaseController; |
|
|
|
use Laravel\Lumen\Routing\Controller as BaseController; |
|
|
|
use RecursiveIteratorIterator; |
|
|
|
use RecursiveIteratorIterator; |
|
|
|
use RecursiveDirectoryIterator; |
|
|
|
use RecursiveDirectoryIterator; |
|
|
|
|
|
|
|
use Exception; |
|
|
|
|
|
|
|
|
|
|
|
class Controller extends BaseController |
|
|
|
class Controller extends BaseController |
|
|
|
{ |
|
|
|
{ |
|
|
@ -60,13 +61,25 @@ class Controller extends BaseController |
|
|
|
{ |
|
|
|
{ |
|
|
|
$directory = 'assets/' . urldecode($company_name); |
|
|
|
$directory = 'assets/' . urldecode($company_name); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!is_dir($directory)) { |
|
|
|
|
|
|
|
return "Directory not found"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$size = 0; |
|
|
|
$size = 0; |
|
|
|
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $file) { |
|
|
|
|
|
|
|
$size += $file->getSize(); |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
foreach (new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directory)) as $file) { |
|
|
|
|
|
|
|
$size += $file->getSize(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception $e) { |
|
|
|
|
|
|
|
return "Error while calculating size: " . $e->getMessage(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return round($size / 1048576, 2); |
|
|
|
return round($size / 1048576, 2); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected function setLimitsStorage($company, $dokumen, $name, $initPath, $destinatePath) |
|
|
|
protected function setLimitsStorage($company, $dokumen, $name, $initPath, $destinatePath) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$totalSize = 0; |
|
|
|
$totalSize = 0; |
|
|
|