mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-03 15:34:37 -04:00
Minor cleanups
This commit is contained in:
parent
0475722827
commit
2571f5eb79
@ -61,7 +61,6 @@ class SelfUpdateController extends BaseController
|
|||||||
|
|
||||||
nlog('copying release file');
|
nlog('copying release file');
|
||||||
|
|
||||||
// if (copy($this->getDownloadUrl(), storage_path('app/invoiceninja.zip'))) {
|
|
||||||
if (copy($this->getDownloadUrl(), storage_path("app/{$this->filename}"))) {
|
if (copy($this->getDownloadUrl(), storage_path("app/{$this->filename}"))) {
|
||||||
nlog('Copied file from URL');
|
nlog('Copied file from URL');
|
||||||
} else {
|
} else {
|
||||||
@ -70,21 +69,16 @@ class SelfUpdateController extends BaseController
|
|||||||
|
|
||||||
nlog('Finished copying');
|
nlog('Finished copying');
|
||||||
|
|
||||||
// if($this->use_zip) {
|
$file = Storage::disk('local')->path($this->filename);
|
||||||
$file = Storage::disk('local')->path($this->filename);
|
|
||||||
|
|
||||||
nlog('Extracting tar');
|
nlog('Extracting tar');
|
||||||
|
|
||||||
$phar = new \PharData($file);
|
$phar = new \PharData($file);
|
||||||
$phar->extractTo(base_path(), null, true);
|
$phar->extractTo(base_path(), null, true);
|
||||||
|
|
||||||
nlog('Finished extracting files');
|
nlog('Finished extracting files');
|
||||||
|
|
||||||
unlink($file);
|
unlink($file);
|
||||||
// }
|
|
||||||
// else {
|
|
||||||
// $this->extractUsingZip();
|
|
||||||
// }
|
|
||||||
|
|
||||||
nlog('Deleted release zip file');
|
nlog('Deleted release zip file');
|
||||||
|
|
||||||
@ -110,31 +104,13 @@ class SelfUpdateController extends BaseController
|
|||||||
return response()->json(['message' => 'Update completed'], 200);
|
return response()->json(['message' => 'Update completed'], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
// private function extractUsingZip()
|
|
||||||
// {
|
|
||||||
|
|
||||||
// $file = Storage::disk('local')->path($this->filename);
|
|
||||||
|
|
||||||
// nlog('Extracting zip');
|
|
||||||
|
|
||||||
// $zipFile = new \PhpZip\ZipFile();
|
|
||||||
// $zipFile->openFile($file);
|
|
||||||
// $zipFile->deleteFromName(".htaccess");
|
|
||||||
// $zipFile->rewrite();
|
|
||||||
// $zipFile->extractTo(base_path());
|
|
||||||
// $zipFile->close();
|
|
||||||
// $zipFile = null;
|
|
||||||
|
|
||||||
// unlink($file);
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
private function clearCacheDir()
|
private function clearCacheDir()
|
||||||
{
|
{
|
||||||
$directoryIterator = new \RecursiveDirectoryIterator(base_path('bootstrap/cache'), \RecursiveDirectoryIterator::SKIP_DOTS);
|
$directoryIterator = new \RecursiveDirectoryIterator(base_path('bootstrap/cache'), \RecursiveDirectoryIterator::SKIP_DOTS);
|
||||||
|
|
||||||
foreach (new \RecursiveIteratorIterator($directoryIterator) as $file) {
|
foreach (new \RecursiveIteratorIterator($directoryIterator) as $file) {
|
||||||
unlink(base_path('bootstrap/cache/').$file->getFileName());
|
unlink(base_path('bootstrap/cache/').$file->getFileName());
|
||||||
|
$file = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$directoryIterator = null;
|
$directoryIterator = null;
|
||||||
@ -155,6 +131,8 @@ class SelfUpdateController extends BaseController
|
|||||||
throw new FilePermissionsFailure("Cannot update system because {$file->getFileName()} is not writable");
|
throw new FilePermissionsFailure("Cannot update system because {$file->getFileName()} is not writable");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$file = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$directoryIterator = null;
|
$directoryIterator = null;
|
||||||
@ -169,10 +147,8 @@ class SelfUpdateController extends BaseController
|
|||||||
|
|
||||||
private function getDownloadUrl()
|
private function getDownloadUrl()
|
||||||
{
|
{
|
||||||
$version = $this->checkVersion();
|
|
||||||
|
|
||||||
// if(request()->has('zip'))
|
$version = $this->checkVersion();
|
||||||
// return "https://github.com/invoiceninja/invoiceninja/releases/download/v{$version}/invoiceninja.zip";
|
|
||||||
|
|
||||||
return "https://github.com/invoiceninja/invoiceninja/releases/download/v{$version}/invoiceninja.tar";
|
return "https://github.com/invoiceninja/invoiceninja/releases/download/v{$version}/invoiceninja.tar";
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user