fixed #9
This commit is contained in:
parent
646f85407a
commit
d106dcdbe9
@ -2,13 +2,12 @@
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
use App\Utilities\Info;
|
||||
use Artisan;
|
||||
use File;
|
||||
use Zipper;
|
||||
use Module;
|
||||
|
||||
use App\Utilities\Info;
|
||||
use GuzzleHttp\Client;
|
||||
use Module;
|
||||
use ZipArchive;
|
||||
|
||||
trait Modules
|
||||
{
|
||||
@ -152,28 +151,30 @@ trait Modules
|
||||
$file = $temp_path . '/upload.zip';
|
||||
|
||||
// Unzip the file
|
||||
try {
|
||||
Zipper::make($file)->extractTo($temp_path);
|
||||
} catch (\RuntimeException $e) {
|
||||
return array(
|
||||
$zip = new ZipArchive();
|
||||
|
||||
if (!$zip->open($file) || !$zip->extractTo($temp_path)) {
|
||||
return [
|
||||
'success' => false,
|
||||
'errors' => true,
|
||||
'data' => null,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
$zip->close();
|
||||
|
||||
// Remove Zip
|
||||
Zipper::delete();
|
||||
File::delete($file);
|
||||
|
||||
$data = array(
|
||||
$data = [
|
||||
'path' => $path
|
||||
);
|
||||
];
|
||||
|
||||
return array(
|
||||
return [
|
||||
'success' => true,
|
||||
'errors' => false,
|
||||
'data' => $data,
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
public function installModule($path)
|
||||
|
@ -10,7 +10,7 @@ use Cache;
|
||||
use Date;
|
||||
use File;
|
||||
use Module;
|
||||
use Zipper;
|
||||
use ZipArchive;
|
||||
|
||||
class Updater
|
||||
{
|
||||
@ -50,14 +50,16 @@ class Updater
|
||||
}
|
||||
|
||||
// Unzip the file
|
||||
try {
|
||||
Zipper::make($file)->extractTo($temp_path);
|
||||
} catch (\RuntimeException $e) {
|
||||
$zip = new ZipArchive();
|
||||
|
||||
if (!$zip->open($file) || !$zip->extractTo($temp_path)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$zip->close();
|
||||
|
||||
// Remove Zip
|
||||
Zipper::delete();
|
||||
File::delete($file);
|
||||
|
||||
if ($alias == 'core') {
|
||||
// Move all files/folders from temp path then delete it
|
||||
|
@ -14,7 +14,6 @@
|
||||
"barryvdh/laravel-dompdf": "0.*",
|
||||
"barryvdh/laravel-ide-helper": "2.3.*",
|
||||
"cebe/markdown": "1.1.*",
|
||||
"chumper/zipper": "v1.0.*",
|
||||
"cknow/laravel-money": "1.0.*",
|
||||
"dingo/api": "1.0.0-beta8",
|
||||
"fzaninotto/faker": "1.6.*",
|
||||
|
@ -187,7 +187,6 @@ return [
|
||||
Akaunting\Setting\Provider::class,
|
||||
Akaunting\Version\Provider::class,
|
||||
Barryvdh\DomPDF\ServiceProvider::class,
|
||||
Chumper\Zipper\ZipperServiceProvider::class,
|
||||
ClickNow\Money\MoneyServiceProvider::class,
|
||||
Collective\Html\HtmlServiceProvider::class,
|
||||
Dingo\Api\Provider\LaravelServiceProvider::class,
|
||||
@ -268,7 +267,6 @@ return [
|
||||
'PDF' => Barryvdh\DomPDF\Facade::class,
|
||||
'Setting' => Akaunting\Setting\Facade::class,
|
||||
'Version' => Akaunting\Version\Facade::class,
|
||||
'Zipper' => Chumper\Zipper\Zipper::class,
|
||||
|
||||
],
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user