Only update to the latest stable version

This commit is contained in:
Sergio Brighenti 2019-10-23 11:55:08 +02:00
parent 5514d8c661
commit d4f85241d0
7 changed files with 212 additions and 187 deletions

View file

@ -9,135 +9,143 @@ use ZipArchive;
class UpgradeController extends Controller
{
const GITHUB_SOURCE_API = 'https://api.github.com/repos/SergiX44/XBackBone/releases';
const GITHUB_SOURCE_API = 'https://api.github.com/repos/SergiX44/XBackBone/releases';
/**
* @param Request $request
* @param Response $response
* @return Response
*/
public function upgrade(Request $request, Response $response): Response
{
if (!is_writable(BASE_DIR)) {
$this->session->alert(lang('path_not_writable', BASE_DIR), 'warning');
return redirect($response, 'system');
}
/**
* @param Request $request
* @param Response $response
* @return Response
*/
public function upgrade(Request $request, Response $response): Response
{
if (!is_writable(BASE_DIR)) {
$this->session->alert(lang('path_not_writable', BASE_DIR), 'warning');
return redirect($response, 'system');
}
try {
$json = $this->getApiJson();
} catch (\RuntimeException $e) {
$this->session->alert($e->getMessage(), 'danger');
return redirect($response, 'system');
}
try {
$json = $this->getApiJson();
} catch (\RuntimeException $e) {
$this->session->alert($e->getMessage(), 'danger');
return redirect($response, 'system');
}
if (version_compare($json[0]->tag_name, PLATFORM_VERSION, '<=')) {
$this->session->alert(lang('already_latest_version'), 'warning');
return redirect($response, 'system');
}
if (version_compare($json[0]->tag_name, PLATFORM_VERSION, '<=')) {
$this->session->alert(lang('already_latest_version'), 'warning');
return redirect($response, 'system');
}
$tmpFile = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'xbackbone_update.zip';
$tmpFile = sys_get_temp_dir().DIRECTORY_SEPARATOR.'xbackbone_update.zip';
if (file_put_contents($tmpFile, file_get_contents($json[0]->assets[0]->browser_download_url)) === false) {
$this->session->alert(lang('cannot_retrieve_file'), 'danger');
return redirect($response, 'system');
};
if (file_put_contents($tmpFile, file_get_contents($json[0]->assets[0]->browser_download_url)) === false) {
$this->session->alert(lang('cannot_retrieve_file'), 'danger');
return redirect($response, 'system');
};
if (filesize($tmpFile) !== $json[0]->assets[0]->size) {
$this->session->alert(lang('file_size_no_match'), 'danger');
return redirect($response, 'system');
}
if (filesize($tmpFile) !== $json[0]->assets[0]->size) {
$this->session->alert(lang('file_size_no_match'), 'danger');
return redirect($response, 'system');
}
$config = require BASE_DIR . 'config.php';
$config['maintenance'] = true;
$config = require BASE_DIR.'config.php';
$config['maintenance'] = true;
file_put_contents(BASE_DIR . 'config.php', '<?php' . PHP_EOL . 'return ' . var_export($config, true) . ';');
file_put_contents(BASE_DIR.'config.php', '<?php'.PHP_EOL.'return '.var_export($config, true).';');
$currentFiles = array_merge(
glob_recursive(BASE_DIR . 'app/*'),
glob_recursive(BASE_DIR . 'bin/*'),
glob_recursive(BASE_DIR . 'bootstrap/*'),
glob_recursive(BASE_DIR . 'resources/templates/*'),
glob_recursive(BASE_DIR . 'resources/lang/*'),
glob_recursive(BASE_DIR . 'resources/schemas/*'),
glob_recursive(BASE_DIR . 'static/*')
);
$currentFiles = array_merge(
glob_recursive(BASE_DIR.'app/*'),
glob_recursive(BASE_DIR.'bin/*'),
glob_recursive(BASE_DIR.'bootstrap/*'),
glob_recursive(BASE_DIR.'resources/templates/*'),
glob_recursive(BASE_DIR.'resources/lang/*'),
glob_recursive(BASE_DIR.'resources/schemas/*'),
glob_recursive(BASE_DIR.'static/*')
);
removeDirectory(BASE_DIR . 'vendor/');
removeDirectory(BASE_DIR.'vendor/');
$updateZip = new ZipArchive();
$updateZip->open($tmpFile);
$updateZip = new ZipArchive();
$updateZip->open($tmpFile);
for ($i = 0; $i < $updateZip->numFiles; $i++) {
$nameIndex = $updateZip->getNameIndex($i);
for ($i = 0; $i < $updateZip->numFiles; $i++) {
$nameIndex = $updateZip->getNameIndex($i);
$updateZip->extractTo(BASE_DIR, $nameIndex);
$updateZip->extractTo(BASE_DIR, $nameIndex);
if (($key = array_search(rtrim(BASE_DIR . $nameIndex, '/'), $currentFiles)) !== false) {
unset($currentFiles[$key]);
}
}
if (($key = array_search(rtrim(BASE_DIR.$nameIndex, '/'), $currentFiles)) !== false) {
unset($currentFiles[$key]);
}
}
foreach ($currentFiles as $extraneous) {
unlink($extraneous);
}
foreach ($currentFiles as $extraneous) {
unlink($extraneous);
}
$updateZip->close();
unlink($tmpFile);
$updateZip->close();
unlink($tmpFile);
return redirect($response, '/install');
}
return redirect($response, '/install');
}
/**
* @param Request $request
* @param Response $response
* @return Response
*/
public function checkForUpdates(Request $request, Response $response): Response
{
$jsonResponse = [
'status' => null,
'message' => null,
'upgrade' => false,
];
/**
* @param Request $request
* @param Response $response
* @return Response
*/
public function checkForUpdates(Request $request, Response $response): Response
{
$jsonResponse = [
'status' => null,
'message' => null,
'upgrade' => false,
];
try {
$json = $this->getApiJson();
$acceptPrerelease = $request->getParam('prerelease', 'false') === 'true';
$jsonResponse['status'] = 'OK';
if (version_compare($json[0]->tag_name, PLATFORM_VERSION, '>')) {
$jsonResponse['message'] = lang('new_version_available', $json[0]->tag_name);
$jsonResponse['upgrade'] = true;
} else {
$jsonResponse['message'] = lang('already_latest_version');
$jsonResponse['upgrade'] = false;
}
} catch (\RuntimeException $e) {
$jsonResponse['status'] = 'ERROR';
$jsonResponse['message'] = $e->getMessage();
}
return $response->withJson($jsonResponse);
}
try {
$json = $this->getApiJson();
protected function getApiJson()
{
$opts = [
'http' => [
'method' => 'GET',
'header' => [
'User-Agent: XBackBone-App',
'Accept: application/vnd.github.v3+json',
],
],
];
$jsonResponse['status'] = 'OK';
foreach ($json as $release) {
if (version_compare($release->tag_name, PLATFORM_VERSION, '>') && ($release->prerelease === $acceptPrerelease)) {
$jsonResponse['message'] = lang('new_version_available', $release->tag_name);
$jsonResponse['upgrade'] = true;
break;
}
$data = @file_get_contents(self::GITHUB_SOURCE_API, false, stream_context_create($opts));
if (version_compare($release->tag_name, PLATFORM_VERSION, '<=')) {
$jsonResponse['message'] = lang('already_latest_version');
$jsonResponse['upgrade'] = false;
break;
}
}
} catch (\RuntimeException $e) {
$jsonResponse['status'] = 'ERROR';
$jsonResponse['message'] = $e->getMessage();
}
return $response->withJson($jsonResponse);
}
if ($data === false) {
throw new \RuntimeException('Cannot contact the Github API. Try again.');
}
protected function getApiJson()
{
$opts = [
'http' => [
'method' => 'GET',
'header' => [
'User-Agent: XBackBone-App',
'Accept: application/vnd.github.v3+json',
],
],
];
return json_decode($data);
}
$data = @file_get_contents(self::GITHUB_SOURCE_API, false, stream_context_create($opts));
if ($data === false) {
throw new \RuntimeException('Cannot contact the Github API. Try again.');
}
return json_decode($data);
}
}

View file

@ -1,6 +1,6 @@
{
"name": "sergix44/xbackbone",
"version": "2.6.5",
"version": "2.6.6",
"description": "A lightweight ShareX PHP backend",
"type": "project",
"require": {
@ -19,6 +19,8 @@
"ext-pdo": "*",
"ext-zip": "*"
},
"prefer-stable": true,
"minimum-stability": "dev",
"autoload": {
"files": [
"app/helpers.php"

159
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": "ebbdff1fa0c06d25785f6d437dc7e11f",
"content-hash": "94fb8de56fe9b216b1db862119cb8aa0",
"packages": [
{
"name": "aws/aws-sdk-php",
"version": "3.112.2",
"version": "3.112.26",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "0d7a3ecb5dca10d1872ee5106cb154cbef52cf1c"
"reference": "eda066813388de5ab8584f06707dacd0b15908b0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/0d7a3ecb5dca10d1872ee5106cb154cbef52cf1c",
"reference": "0d7a3ecb5dca10d1872ee5106cb154cbef52cf1c",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/eda066813388de5ab8584f06707dacd0b15908b0",
"reference": "eda066813388de5ab8584f06707dacd0b15908b0",
"shasum": ""
},
"require": {
@ -87,7 +87,7 @@
"s3",
"sdk"
],
"time": "2019-09-17T18:07:57+00:00"
"time": "2019-10-22T18:17:52+00:00"
},
{
"name": "container-interop/container-interop",
@ -168,16 +168,16 @@
},
{
"name": "google/auth",
"version": "v1.5.2",
"version": "v1.6.0",
"source": {
"type": "git",
"url": "https://github.com/googleapis/google-auth-library-php.git",
"reference": "2ee962e5df3e9427fda859f1b0515d6d62c4afa5"
"reference": "6d5455b4c0f4a58b1f1b4bdf2ba49221123698b3"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/2ee962e5df3e9427fda859f1b0515d6d62c4afa5",
"reference": "2ee962e5df3e9427fda859f1b0515d6d62c4afa5",
"url": "https://api.github.com/repos/googleapis/google-auth-library-php/zipball/6d5455b4c0f4a58b1f1b4bdf2ba49221123698b3",
"reference": "6d5455b4c0f4a58b1f1b4bdf2ba49221123698b3",
"shasum": ""
},
"require": {
@ -196,7 +196,7 @@
"sebastian/comparator": ">=1.2.3"
},
"suggest": {
"phpseclib/phpseclib": "May be used in place of OpenSSL for signing strings. Please require version ^2."
"phpseclib/phpseclib": "May be used in place of OpenSSL for signing strings or for token management. Please require version ^2."
},
"type": "library",
"autoload": {
@ -215,24 +215,24 @@
"google",
"oauth2"
],
"time": "2019-07-22T21:01:31+00:00"
"time": "2019-10-01T18:35:05+00:00"
},
{
"name": "google/cloud-core",
"version": "v1.33.0",
"version": "v1.33.1",
"source": {
"type": "git",
"url": "https://github.com/googleapis/google-cloud-php-core.git",
"reference": "c8a83c12af2c860afe86b4d7c36e38b878d8d4ec"
"reference": "7b8773a5c6d501b3ed31655a8e243e1c17e2862e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/c8a83c12af2c860afe86b4d7c36e38b878d8d4ec",
"reference": "c8a83c12af2c860afe86b4d7c36e38b878d8d4ec",
"url": "https://api.github.com/repos/googleapis/google-cloud-php-core/zipball/7b8773a5c6d501b3ed31655a8e243e1c17e2862e",
"reference": "7b8773a5c6d501b3ed31655a8e243e1c17e2862e",
"shasum": ""
},
"require": {
"google/auth": "^1.5.1",
"google/auth": "^1.6",
"guzzlehttp/guzzle": "^5.3|^6.0",
"guzzlehttp/promises": "^1.3",
"guzzlehttp/psr7": "^1.2",
@ -276,7 +276,7 @@
"Apache-2.0"
],
"description": "Google Cloud PHP shared dependency, providing functionality useful to all components.",
"time": "2019-09-12T22:13:37+00:00"
"time": "2019-10-02T20:38:25+00:00"
},
{
"name": "google/cloud-storage",
@ -684,16 +684,16 @@
},
{
"name": "league/flysystem",
"version": "1.0.55",
"version": "1.0.57",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/flysystem.git",
"reference": "33c91155537c6dc899eacdc54a13ac6303f156e6"
"reference": "0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/33c91155537c6dc899eacdc54a13ac6303f156e6",
"reference": "33c91155537c6dc899eacdc54a13ac6303f156e6",
"url": "https://api.github.com/repos/thephpleague/flysystem/zipball/0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a",
"reference": "0e9db7f0b96b9f12dcf6f65bc34b72b1a30ea55a",
"shasum": ""
},
"require": {
@ -764,7 +764,7 @@
"sftp",
"storage"
],
"time": "2019-08-24T11:17:19+00:00"
"time": "2019-10-16T21:01:05+00:00"
},
{
"name": "league/flysystem-aws-s3-v3",
@ -1554,16 +1554,16 @@
},
{
"name": "superbalist/flysystem-google-storage",
"version": "7.2.1",
"version": "7.2.2",
"source": {
"type": "git",
"url": "https://github.com/Superbalist/flysystem-google-cloud-storage.git",
"reference": "97cf8a5c9a9d368260b2791ec130690a1bec0cbd"
"reference": "87e2f450c0e4b5200fef9ffe6863068cc873d734"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/Superbalist/flysystem-google-cloud-storage/zipball/97cf8a5c9a9d368260b2791ec130690a1bec0cbd",
"reference": "97cf8a5c9a9d368260b2791ec130690a1bec0cbd",
"url": "https://api.github.com/repos/Superbalist/flysystem-google-cloud-storage/zipball/87e2f450c0e4b5200fef9ffe6863068cc873d734",
"reference": "87e2f450c0e4b5200fef9ffe6863068cc873d734",
"shasum": ""
},
"require": {
@ -1597,7 +1597,7 @@
}
],
"description": "Flysystem adapter for Google Cloud Storage",
"time": "2019-02-21T08:07:24+00:00"
"time": "2019-10-10T12:22:54+00:00"
},
{
"name": "symfony/polyfill-ctype",
@ -1718,16 +1718,16 @@
},
{
"name": "twig/twig",
"version": "v2.11.3",
"version": "v2.12.1",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "699ed2342557c88789a15402de5eb834dedd6792"
"reference": "ddd4134af9bfc6dba4eff7c8447444ecc45b9ee5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/699ed2342557c88789a15402de5eb834dedd6792",
"reference": "699ed2342557c88789a15402de5eb834dedd6792",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/ddd4134af9bfc6dba4eff7c8447444ecc45b9ee5",
"reference": "ddd4134af9bfc6dba4eff7c8447444ecc45b9ee5",
"shasum": ""
},
"require": {
@ -1737,13 +1737,13 @@
},
"require-dev": {
"psr/container": "^1.0",
"symfony/debug": "^2.7",
"symfony/phpunit-bridge": "^3.4.19|^4.1.8|^5.0"
"symfony/debug": "^3.4|^4.2",
"symfony/phpunit-bridge": "^4.4@dev|^5.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.11-dev"
"dev-master": "2.12-dev"
}
},
"autoload": {
@ -1761,19 +1761,19 @@
"authors": [
{
"name": "Fabien Potencier",
"role": "Lead Developer",
"email": "fabien@symfony.com",
"homepage": "http://fabien.potencier.org"
},
{
"name": "Armin Ronacher",
"role": "Project Founder",
"email": "armin.ronacher@active-4.com"
"homepage": "http://fabien.potencier.org",
"role": "Lead Developer"
},
{
"name": "Twig Team",
"role": "Contributors",
"homepage": "https://twig.symfony.com/contributors"
"homepage": "https://twig.symfony.com/contributors",
"role": "Contributors"
},
{
"name": "Armin Ronacher",
"email": "armin.ronacher@active-4.com",
"role": "Project Founder"
}
],
"description": "Twig, the flexible, fast, and secure template language for PHP",
@ -1781,7 +1781,7 @@
"keywords": [
"templating"
],
"time": "2019-06-18T15:37:11+00:00"
"time": "2019-10-17T07:34:53+00:00"
}
],
"packages-dev": [
@ -1882,16 +1882,16 @@
},
{
"name": "nette/bootstrap",
"version": "v3.0.0",
"version": "v3.0.1",
"source": {
"type": "git",
"url": "https://github.com/nette/bootstrap.git",
"reference": "e1075af05c211915e03e0c86542f3ba5433df4a3"
"reference": "b45a1e33b6a44beb307756522396551e5a9ff249"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/bootstrap/zipball/e1075af05c211915e03e0c86542f3ba5433df4a3",
"reference": "e1075af05c211915e03e0c86542f3ba5433df4a3",
"url": "https://api.github.com/repos/nette/bootstrap/zipball/b45a1e33b6a44beb307756522396551e5a9ff249",
"reference": "b45a1e33b6a44beb307756522396551e5a9ff249",
"shasum": ""
},
"require": {
@ -1899,6 +1899,9 @@
"nette/utils": "^3.0",
"php": ">=7.1"
},
"conflict": {
"tracy/tracy": "<2.6"
},
"require-dev": {
"latte/latte": "^2.2",
"nette/application": "^3.0",
@ -1951,7 +1954,7 @@
"configurator",
"nette"
],
"time": "2019-03-26T12:59:07+00:00"
"time": "2019-09-30T08:19:38+00:00"
},
{
"name": "nette/di",
@ -2329,16 +2332,16 @@
},
{
"name": "nette/utils",
"version": "v3.0.1",
"version": "v3.0.2",
"source": {
"type": "git",
"url": "https://github.com/nette/utils.git",
"reference": "bd961f49b211997202bda1d0fbc410905be370d4"
"reference": "c133e18c922dcf3ad07673077d92d92cef25a148"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/utils/zipball/bd961f49b211997202bda1d0fbc410905be370d4",
"reference": "bd961f49b211997202bda1d0fbc410905be370d4",
"url": "https://api.github.com/repos/nette/utils/zipball/c133e18c922dcf3ad07673077d92d92cef25a148",
"reference": "c133e18c922dcf3ad07673077d92d92cef25a148",
"shasum": ""
},
"require": {
@ -2354,6 +2357,7 @@
"ext-intl": "to use Strings::webalize(), toAscii(), normalize() and compare()",
"ext-json": "to use Nette\\Utils\\Json",
"ext-mbstring": "to use Strings::lower() etc...",
"ext-tokenizer": "to use Nette\\Utils\\Reflection::getUseStatements()",
"ext-xml": "to use Strings::length() etc. when mbstring is not available"
},
"type": "library",
@ -2401,7 +2405,7 @@
"utility",
"validation"
],
"time": "2019-03-22T01:00:30+00:00"
"time": "2019-10-21T20:40:16+00:00"
},
{
"name": "nikic/php-parser",
@ -2553,16 +2557,16 @@
},
{
"name": "phpstan/phpstan",
"version": "0.11.16",
"version": "0.11.19",
"source": {
"type": "git",
"url": "https://github.com/phpstan/phpstan.git",
"reference": "635cf20f3b92ce34ee94a8d2f282d62eb9dc6e1b"
"reference": "63cc502f6957b7f74efbac444b4cf219dcadffd7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/635cf20f3b92ce34ee94a8d2f282d62eb9dc6e1b",
"reference": "635cf20f3b92ce34ee94a8d2f282d62eb9dc6e1b",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/63cc502f6957b7f74efbac444b4cf219dcadffd7",
"reference": "63cc502f6957b7f74efbac444b4cf219dcadffd7",
"shasum": ""
},
"require": {
@ -2570,6 +2574,7 @@
"jean85/pretty-package-versions": "^1.0.3",
"nette/bootstrap": "^2.4 || ^3.0",
"nette/di": "^2.4.7 || ^3.0",
"nette/neon": "^2.4.3 || ^3.0",
"nette/robot-loader": "^3.0.1",
"nette/schema": "^1.0",
"nette/utils": "^2.4.5 || ^3.0",
@ -2623,20 +2628,20 @@
"MIT"
],
"description": "PHPStan - PHP Static Analysis Tool",
"time": "2019-09-17T11:19:51+00:00"
"time": "2019-10-22T20:20:22+00:00"
},
{
"name": "symfony/console",
"version": "v4.3.4",
"version": "v4.3.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/console.git",
"reference": "de63799239b3881b8a08f8481b22348f77ed7b36"
"reference": "929ddf360d401b958f611d44e726094ab46a7369"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/de63799239b3881b8a08f8481b22348f77ed7b36",
"reference": "de63799239b3881b8a08f8481b22348f77ed7b36",
"url": "https://api.github.com/repos/symfony/console/zipball/929ddf360d401b958f611d44e726094ab46a7369",
"reference": "929ddf360d401b958f611d44e726094ab46a7369",
"shasum": ""
},
"require": {
@ -2698,20 +2703,20 @@
],
"description": "Symfony Console Component",
"homepage": "https://symfony.com",
"time": "2019-08-26T08:26:39+00:00"
"time": "2019-10-07T12:36:49+00:00"
},
{
"name": "symfony/finder",
"version": "v4.3.4",
"version": "v4.3.5",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
"reference": "86c1c929f0a4b24812e1eb109262fc3372c8e9f2"
"reference": "5e575faa95548d0586f6bedaeabec259714e44d1"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/86c1c929f0a4b24812e1eb109262fc3372c8e9f2",
"reference": "86c1c929f0a4b24812e1eb109262fc3372c8e9f2",
"url": "https://api.github.com/repos/symfony/finder/zipball/5e575faa95548d0586f6bedaeabec259714e44d1",
"reference": "5e575faa95548d0586f6bedaeabec259714e44d1",
"shasum": ""
},
"require": {
@ -2747,7 +2752,7 @@
],
"description": "Symfony Finder Component",
"homepage": "https://symfony.com",
"time": "2019-08-14T12:26:46+00:00"
"time": "2019-09-16T11:29:48+00:00"
},
{
"name": "symfony/polyfill-php73",
@ -2809,16 +2814,16 @@
},
{
"name": "symfony/service-contracts",
"version": "v1.1.6",
"version": "v1.1.7",
"source": {
"type": "git",
"url": "https://github.com/symfony/service-contracts.git",
"reference": "ea7263d6b6d5f798b56a45a5b8d686725f2719a3"
"reference": "ffcde9615dc5bb4825b9f6aed07716f1f57faae0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/ea7263d6b6d5f798b56a45a5b8d686725f2719a3",
"reference": "ea7263d6b6d5f798b56a45a5b8d686725f2719a3",
"url": "https://api.github.com/repos/symfony/service-contracts/zipball/ffcde9615dc5bb4825b9f6aed07716f1f57faae0",
"reference": "ffcde9615dc5bb4825b9f6aed07716f1f57faae0",
"shasum": ""
},
"require": {
@ -2863,13 +2868,13 @@
"interoperability",
"standards"
],
"time": "2019-08-20T14:44:19+00:00"
"time": "2019-09-17T11:12:18+00:00"
}
],
"aliases": [],
"minimum-stability": "stable",
"minimum-stability": "dev",
"stability-flags": [],
"prefer-stable": false,
"prefer-stable": true,
"prefer-lowest": false,
"platform": {
"php": ">=7.1",

View file

@ -101,4 +101,5 @@ return [
'lang_name' => 'language name',
'default_lang_behavior' => 'XBackBone will try to match the browser language by default (fallback is English).',
'lang_set' => 'System language enforced to "%s"',
'prerelease_channel' => 'Prerelease Channel',
];

View file

@ -101,4 +101,5 @@ return [
'lang_name' => 'nome della lingua',
'default_lang_behavior' => 'Per impostazione predefinita, XBackbone cercherà di abbinare la lingua del browser (il fallback è l\'inglese).',
'lang_set' => 'Lingua di sistema applicata a "%s"',
'prerelease_channel' => 'Canale prerelease',
];

View file

@ -101,11 +101,19 @@
</div>
</div>
<div class="card shadow-sm">
<div class="card-header"><i class="fas fa-cloud-download-alt fa-fw"></i> {{ lang('updates') }} <b>[BETA]</b> <span class="float-right">v{{ PLATFORM_VERSION }}</span></div>
<div class="card-header"><i class="fas fa-cloud-download-alt fa-fw"></i> {{ lang('updates') }} <span class="float-right">v{{ PLATFORM_VERSION }}</span></div>
<div class="card-body">
<div class="row">
<div class="col">
<button type="button" id="checkForUpdatesButton" class="btn btn-block btn-outline-info"><i class="fas fa-sync fa-fw"></i> {{ lang('check_for_updates') }}</button>
<div class="btn-group">
<button type="button" class="btn btn-block btn-outline-info checkForUpdatesButton" data-prerelease="false"><i class="fas fa-sync fa-fw"></i> {{ lang('check_for_updates') }}</button>
<button type="button" class="btn btn-outline-info dropdown-toggle dropdown-toggle-split" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="sr-only">Toggle Dropdown</span>
</button>
<div class="dropdown-menu">
<a class="dropdown-item checkForUpdatesButton" href="javascript:void(0);" data-prerelease="true">{{ lang('prerelease_channel') }}</a>
</div>
</div>
</div>
<div class="col text-center"><span class="text-muted" id="checkForUpdatesMessage"></span></div>

View file

@ -8,7 +8,7 @@ var app = {
$('.publish-toggle').click(app.publishToggle);
$('.refresh-token').click(app.refreshToken);
$('#themes').mousedown(app.loadThemes);
$('#checkForUpdatesButton').click(app.checkForUpdates);
$('.checkForUpdatesButton').click(app.checkForUpdates);
$('.alert').fadeTo(4000, 500).slideUp(500, function () {
$('.alert').slideUp(500);
@ -99,7 +99,7 @@ var app = {
checkForUpdates: function () {
$('#checkForUpdatesMessage').empty().text('...');
$('#doUpgradeButton').prop('disabled', true);
$.get(window.AppConfig.base_url + '/system/checkForUpdates', function (data) {
$.get(window.AppConfig.base_url + '/system/checkForUpdates?prerelease=' + $(this).data('prerelease'), function (data) {
$('#checkForUpdatesMessage').empty().text(data.message);
if (data.upgrade) {
$('#doUpgradeButton').prop('disabled', false);