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