added some consts

This commit is contained in:
Micha Espey 2019-07-29 00:39:27 +02:00
parent c15e329116
commit e0f4c8a3d4
1 changed files with 10 additions and 4 deletions

View File

@ -5,6 +5,9 @@
define('PHPBB_ROOT_PATH', '../'); define('PHPBB_ROOT_PATH', '../');
define('IN_PHPBB', true); define('IN_PHPBB', true);
define('SUPPORTED_RELEASE_MAJOR', 3);
define('SUPPORTED_RELEASE_MINOR', 2);
function confirm($message = 'Are you sure? ', $options = array('y', 'n'), $default ='n') function confirm($message = 'Are you sure? ', $options = array('y', 'n'), $default ='n')
{ {
@ -136,8 +139,8 @@ if (!empty($argv[1])) {
// phpBB has major, minor and maintenance version scheme // phpBB has major, minor and maintenance version scheme
list($major, $minor, $patch) = explode('.', $installedVersion); list($major, $minor, $patch) = explode('.', $installedVersion);
if ((intval($major) != 3) || (intval($minor) != 2)) { if ((intval($major) != SUPPORTED_RELEASE_MAJOR) || (intval($minor) != SUPPORTED_RELEASE_MINOR)) {
echo "This script only supports phpBB 3.2 branch.", PHP_EOL; echo 'This script only supports phpBB ' . SUPPORTED_RELEASE_MAJOR . '.' . SUPPORTED_RELEASE_MINOR . ' branch.', PHP_EOL;
exit(1); exit(1);
} }
@ -165,7 +168,7 @@ if (!empty($argv[1])) {
// http://version.phpbb.com/phpbb/versions.json // http://version.phpbb.com/phpbb/versions.json
$json = file_get_contents('http://version.phpbb.com/phpbb/versions.json'); $json = file_get_contents('http://version.phpbb.com/phpbb/versions.json');
$versions = json_decode($json); $versions = json_decode($json);
$currentVersion = $versions->{'stable'}->{'3.2'}->{'current'}; $currentVersion = $versions->{'stable'}->{SUPPORTED_RELEASE_MAJOR . '.' . SUPPORTED_RELEASE_MINOR}->{'current'};
print("Current version: $currentVersion" . PHP_EOL); print("Current version: $currentVersion" . PHP_EOL);
// check for existing update // check for existing update
@ -174,7 +177,10 @@ if (!empty($argv[1])) {
mkdir ('dist'); mkdir ('dist');
} }
$currentFile = "phpBB-$currentVersion-deutsch.tar.bz2"; $currentFile = "phpBB-$currentVersion-deutsch.tar.bz2";
$filePath = "http://downloads.phpbb.de/pakete/deutsch/3.2/$currentVersion/$currentFile"; $filePath = 'http://downloads.phpbb.de/pakete/deutsch/' . SUPPORTED_RELEASE_MAJOR . '.' . SUPPORTED_RELEASE_MINOR . "/$currentVersion/$currentFile";
echo $filePath;
die();
$target = "dist/$currentFile"; $target = "dist/$currentFile";
if (!file_exists($target)) { if (!file_exists($target)) {