Added check if the zip extension is not loaded

This commit is contained in:
Sergio Brighenti 2020-04-09 13:09:57 +02:00
parent d77b83b1d6
commit a99d9a7fc7
5 changed files with 27 additions and 20 deletions

View file

@ -27,6 +27,11 @@ class UpgradeController extends Controller
*/
public function upgrade(Response $response, Logger $logger, Session $session): Response
{
if (!extension_loaded('zip')) {
$session->alert(lang('zip_ext_not_loaded'), 'danger');
return redirect($response, route('system'));
}
if (!is_writable(BASE_DIR)) {
$session->alert(lang('path_not_writable', BASE_DIR), 'warning');
@ -92,6 +97,9 @@ class UpgradeController extends Controller
}
}
$updateZip->close();
unlink($tmpFile);
foreach ($currentFiles as $extraneous) {
if (is_dir($extraneous)) {
removeDirectory($extraneous);
@ -100,9 +108,6 @@ class UpgradeController extends Controller
}
}
$updateZip->close();
unlink($tmpFile);
$logger->info('System update completed.');
return redirect($response, urlFor('/install'));

View file

@ -1,6 +1,6 @@
{
"name": "sergix44/xbackbone",
"version": "3.1.RC4",
"version": "3.1.RC5",
"description": "A lightweight ShareX PHP backend",
"type": "project",
"require": {

32
composer.lock generated
View file

@ -4,20 +4,20 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "6a0e292aa56135b799030a6b1e2152c0",
"content-hash": "f9b195438102a5213e65b9aef73ad6ef",
"packages": [
{
"name": "aws/aws-sdk-php",
"version": "3.134.5",
"version": "3.134.6",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "f5a2d82660e73ed613643a5e7ad833d2569d5fdf"
"reference": "3ebf1d8b24dc38339d93d943971d7d3e1102327b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/f5a2d82660e73ed613643a5e7ad833d2569d5fdf",
"reference": "f5a2d82660e73ed613643a5e7ad833d2569d5fdf",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/3ebf1d8b24dc38339d93d943971d7d3e1102327b",
"reference": "3ebf1d8b24dc38339d93d943971d7d3e1102327b",
"shasum": ""
},
"require": {
@ -88,7 +88,7 @@
"s3",
"sdk"
],
"time": "2020-04-07T18:11:11+00:00"
"time": "2020-04-08T18:27:07+00:00"
},
{
"name": "firebase/php-jwt",
@ -194,16 +194,16 @@
},
{
"name": "google/cloud-core",
"version": "v1.36.0",
"version": "v1.36.1",
"source": {
"type": "git",
"url": "https://github.com/googleapis/google-cloud-php-core.git",
"reference": "4764850f256a43b7513226a54a04b349f8f385d8"
"reference": "52254d4e59a0f0d29650d713c228ef74a088b86b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/4764850f256a43b7513226a54a04b349f8f385d8",
"reference": "4764850f256a43b7513226a54a04b349f8f385d8",
"url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/52254d4e59a0f0d29650d713c228ef74a088b86b",
"reference": "52254d4e59a0f0d29650d713c228ef74a088b86b",
"shasum": ""
},
"require": {
@ -251,20 +251,20 @@
"Apache-2.0"
],
"description": "Google Cloud PHP shared dependency, providing functionality useful to all components.",
"time": "2020-03-25T23:00:37+00:00"
"time": "2020-04-07T20:58:05+00:00"
},
{
"name": "google/cloud-storage",
"version": "v1.20.0",
"version": "v1.20.1",
"source": {
"type": "git",
"url": "https://github.com/googleapis/google-cloud-php-storage.git",
"reference": "d09ef3d47079e4a3cac1419856302cc5c07c5e1f"
"reference": "876b5563555014563a3d8b2842674d95dacf95e1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/googleapis/google-cloud-php-storage/zipball/d09ef3d47079e4a3cac1419856302cc5c07c5e1f",
"reference": "d09ef3d47079e4a3cac1419856302cc5c07c5e1f",
"url": "https://api.github.com/repos/googleapis/google-cloud-php-storage/zipball/876b5563555014563a3d8b2842674d95dacf95e1",
"reference": "876b5563555014563a3d8b2842674d95dacf95e1",
"shasum": ""
},
"require": {
@ -302,7 +302,7 @@
"Apache-2.0"
],
"description": "Cloud Storage Client for PHP",
"time": "2020-03-30T20:36:58+00:00"
"time": "2020-04-07T20:58:05+00:00"
},
{
"name": "google/crc32",

View file

@ -14,6 +14,7 @@ XBackBone require PHP >= `7.1`, with installed the required extensions:
+ `php-json` json file support.
+ `php-intl` internationalization functions.
+ `php-fileinfo` file related functions.
+ `php-zip` compressed files related functions.
+ (optional) `php-ftp` to use the FTP remote storage driver.
+ (optional) `php-ldap` to use LDAP authentication.

View file

@ -155,4 +155,5 @@ return [
'upload_max_file_size' => 'The max file size is currently %s.',
'no_tags' => 'No tags added',
'auto_tagging' => 'Auto upload tagging',
'zip_ext_not_loaded' => 'The required "zip" extension is not loaded',
];