Compare commits
21 Commits
364ad27157
...
master
Author | SHA1 | Date | |
---|---|---|---|
32532147e8 | |||
2fd033a8c5 | |||
a1b030e463 | |||
21fb878ffb | |||
2114bcc8b5 | |||
7d88fc5066 | |||
08a53a737f | |||
46e90bd798 | |||
c8b88021ed | |||
dabe69967d | |||
154bd410a4 | |||
7e85faf2f2 | |||
21e577b2ca | |||
04ae283e13 | |||
9f31cf0304 | |||
e3a9fb1454 | |||
b99438c925 | |||
ab55fd9abb | |||
ff93b288c2 | |||
8ea6328f43 | |||
fd1ef5153a |
@ -6,6 +6,7 @@ error_reporting(error_level: E_ALL);
|
||||
|
||||
use DirectoryIterator;
|
||||
use Exception;
|
||||
use JetBrains\PhpStorm\NoReturn;
|
||||
use PDO;
|
||||
use PharData;
|
||||
|
||||
@ -18,10 +19,29 @@ const SUPPORTED_RELEASE_MINOR = 2;
|
||||
*/
|
||||
class UpdateController
|
||||
{
|
||||
private $pdo;
|
||||
/**
|
||||
* @var true
|
||||
*/
|
||||
private bool $dryRun = false;
|
||||
private string $installedVersion = '';
|
||||
|
||||
function parseOpts(): array
|
||||
{
|
||||
$shortOpts = 'h::d::';
|
||||
|
||||
function handleUpdate()
|
||||
$longOpts = [
|
||||
'help',
|
||||
'dry-run',
|
||||
];
|
||||
|
||||
return getopt(
|
||||
short_options: $shortOpts,
|
||||
long_options: $longOpts
|
||||
);
|
||||
}
|
||||
|
||||
#[NoReturn]
|
||||
function handleUpdate(): void
|
||||
{
|
||||
define(constant_name: "PHPBB_ROOT_PATH", value: dirname(path: __DIR__, levels: 2));
|
||||
|
||||
@ -51,6 +71,7 @@ class UpdateController
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if (!$this->dryRun) {
|
||||
include $phpBBRootPath . 'config.php';
|
||||
|
||||
/** @var String $dbhost */
|
||||
@ -58,16 +79,16 @@ class UpdateController
|
||||
/** @var String $dbname */
|
||||
/** @var String $dbuser */
|
||||
/** @var String $dbpasswd */
|
||||
$this->pdo = new PDO(
|
||||
dsn : "mysql:host=$dbhost;port=$dbport;charset=utf8mb4;dbname=$dbname",
|
||||
$pdo = new PDO(
|
||||
dsn: "mysql:host=$dbhost;port=$dbport;charset=utf8mb4;dbname=$dbname",
|
||||
username: $dbuser,
|
||||
password: $dbpasswd
|
||||
);
|
||||
|
||||
|
||||
/** @var String $table_prefix */
|
||||
$sql = "SELECT config_value FROM ${table_prefix}config WHERE config_name = 'version'";
|
||||
$statement = $this->pdo->prepare(query: $sql);
|
||||
$sql = "SELECT config_value FROM {$table_prefix}config WHERE config_name = 'version'";
|
||||
$statement = $pdo->prepare(query: $sql);
|
||||
$statement->execute();
|
||||
$result = $statement->fetch();
|
||||
|
||||
@ -80,15 +101,30 @@ class UpdateController
|
||||
echo 'This script only supports phpBB ' . SUPPORTED_RELEASE_MAJOR . '.' . SUPPORTED_RELEASE_MINOR . ' and above branch.', PHP_EOL;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
echo "Checking for the current version …" . PHP_EOL;
|
||||
$json = file_get_contents(filename: 'https://version.phpbb.com/phpbb/versions.json');
|
||||
$versions = json_decode(json: $json);
|
||||
$versions = json_decode(json: $json, associative: true);
|
||||
|
||||
$stableVersions = $versions->stable;
|
||||
$availableUpdate = $stableVersions->{$major . '.' . $minor}->{'current'};
|
||||
$stableVersions = $versions['stable'];
|
||||
|
||||
echo 'Current Version: ' . $availableUpdate . PHP_EOL;
|
||||
// Get the highest stable version
|
||||
$highestStableVersion = null;
|
||||
foreach ($stableVersions as $version => $details) {
|
||||
if ($highestStableVersion === null || version_compare(version1: $version, version2: $highestStableVersion, operator: '>')) {
|
||||
$highestStableVersion = $version;
|
||||
}
|
||||
}
|
||||
|
||||
echo "Highest Stable Version: $highestStableVersion" . PHP_EOL;
|
||||
if (!$this->dryRun) {
|
||||
echo 'Installed Version: '. $this->installedVersion . PHP_EOL;
|
||||
}
|
||||
|
||||
[$major, $minor, $patch] = explode(separator: '.', string: $stableVersions[$highestStableVersion]['current']);
|
||||
echo "Latest stable release: $major.$minor.$patch" . PHP_EOL;
|
||||
$availableUpdate = $stableVersions[$highestStableVersion]['current'];
|
||||
// check for existing update
|
||||
if (!file_exists(filename: 'dist')) {
|
||||
echo "'dist' folder is missing, create a new one …'";
|
||||
@ -105,48 +141,56 @@ class UpdateController
|
||||
$phpBBtbz = file_get_contents(filename: $filePath);
|
||||
file_put_contents(filename: $phpBBTarget, data: $phpBBtbz);
|
||||
} else {
|
||||
echo $currentFile . ' already exists' . PHP_EOL;
|
||||
echo $currentFile . ' already exists. Skipping download.' . PHP_EOL;
|
||||
}
|
||||
|
||||
// TODO check SHA256?
|
||||
|
||||
// check for available language files
|
||||
|
||||
$useLangDeDu = false;
|
||||
if (file_exists(filename: $phpBBRootPath . 'language/de')) {
|
||||
$useLangDeDu = true;
|
||||
// https://downloads.phpbb.de/pakete/deutsch/3.3/3.3.7/phpBB_lang_de-3.3.7.tar.bz2
|
||||
$languageFile = "phpBB_lang_de-$availableUpdate.tar.bz2";
|
||||
$langDeDuTarget = "dist/$languageFile";
|
||||
|
||||
if (!file_exists(filename: $langDeDuTarget)) {
|
||||
echo "Downloading language $languageFile" . PHP_EOL;
|
||||
echo " Downloading $languageFile" . PHP_EOL;
|
||||
$filePath = "https://downloads.phpbb.de/pakete/deutsch/$major.$minor/$availableUpdate/$languageFile";
|
||||
$phpBBtbz = file_get_contents(filename: $filePath);
|
||||
|
||||
if ($phpBBtbz = file_get_contents(filename: $filePath)) {
|
||||
file_put_contents(filename: $langDeDuTarget, data: $phpBBtbz);
|
||||
} else {
|
||||
echo 'Language file ' . $languageFile . ' already exists' . PHP_EOL;
|
||||
echo " Language file $languageFile does not exist." . PHP_EOL;
|
||||
$useLangDeDu = false;
|
||||
}
|
||||
} else {
|
||||
echo ' Language file ' . $languageFile . ' already exists' . PHP_EOL;
|
||||
}
|
||||
} else {
|
||||
$useLangDeDu = false;
|
||||
echo 'Language Deutsch "Du" ist not installed, skipping' . PHP_EOL;
|
||||
}
|
||||
|
||||
$useLangDeSie = false;
|
||||
if (file_exists(filename: $phpBBRootPath . 'language/de_x_sie')) {
|
||||
$useLangDeSie = true;
|
||||
//https://downloads.phpbb.de/pakete/deutsch/3.3/3.3.7/phpBB_lang_de_x_sie-3.3.7.tar.bz2
|
||||
$languageFile = "phpBB_lang_de_x_sie-$availableUpdate.tar.bz2";
|
||||
$langDeSieTarget = "dist/$languageFile";
|
||||
|
||||
if (!file_exists(filename: $langDeSieTarget)) {
|
||||
echo "Downloading language $languageFile" . PHP_EOL;
|
||||
echo " Downloading language $languageFile" . PHP_EOL;
|
||||
$filePath = "https://downloads.phpbb.de/pakete/deutsch/$major.$minor/$availableUpdate/$languageFile";
|
||||
$phpBBtbz = file_get_contents(filename: $filePath);
|
||||
|
||||
if ($phpBBtbz = file_get_contents(filename: $filePath)) {
|
||||
file_put_contents(filename: $langDeSieTarget, data: $phpBBtbz);
|
||||
} else {
|
||||
echo 'Language file ' . $languageFile . ' already exists' . PHP_EOL;
|
||||
echo ' Language file ' . $languageFile . ' does not exist' . PHP_EOL;
|
||||
$useLangDeSie = false;
|
||||
}
|
||||
} else {
|
||||
echo ' Language file ' . $languageFile . ' already exists' . PHP_EOL;
|
||||
}
|
||||
} else {
|
||||
$useLangDeSie = false;
|
||||
echo 'Language Deutsch "Sie" ist not installed, skipping' . PHP_EOL;
|
||||
}
|
||||
|
||||
@ -154,14 +198,19 @@ class UpdateController
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if ($this->dryRun) {
|
||||
echo 'Dry run, exiting.' . PHP_EOL;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
// ok, start update
|
||||
$now = date(format: 'd.m.Y H:i');
|
||||
$disableMsg = "Software-update at $now, the forum ist down due to maintenance. We'll be back soon.";
|
||||
$sql = "UPDATE ${table_prefix}config SET config_value = :disable_message WHERE config_name = 'board_disable_msg'";
|
||||
$statement = $this->pdo->prepare(query: $sql);
|
||||
$sql = "UPDATE {$table_prefix}config SET config_value = :disable_message WHERE config_name = 'board_disable_msg'";
|
||||
$statement = $pdo->prepare(query: $sql);
|
||||
$statement->bindParam(param: 'disable_message', var: $disableMsg);
|
||||
|
||||
if ($result = $statement->execute()) {
|
||||
if ($statement->execute()) {
|
||||
echo "Disable Message set …", PHP_EOL;
|
||||
} else {
|
||||
echo 'There was an error talking to the DB.' . PHP_EOL;
|
||||
@ -169,9 +218,9 @@ class UpdateController
|
||||
exit(1);
|
||||
}
|
||||
|
||||
$sql = "UPDATE ${table_prefix}config SET config_value = '1' WHERE config_name = 'board_disable'";
|
||||
$statement = $this->pdo->prepare(query: $sql);
|
||||
if ($result = $statement->execute()) {
|
||||
$sql = "UPDATE {$table_prefix}config SET config_value = '1' WHERE config_name = 'board_disable'";
|
||||
$statement = $pdo->prepare(query: $sql);
|
||||
if ($statement->execute()) {
|
||||
echo "Board disabled …", PHP_EOL;
|
||||
} else {
|
||||
echo 'There was an error talking to the DB.' . PHP_EOL;
|
||||
@ -185,8 +234,8 @@ class UpdateController
|
||||
echo 'Extensions state already stored. Remove extensions.txt if you wish to recreate it.' . PHP_EOL;
|
||||
} else {
|
||||
// check for enabled extensions
|
||||
$sql = "SELECT ext_name FROM ${table_prefix}ext WHERE ext_active = '1'";
|
||||
$statement = $this->pdo->prepare(query: $sql);
|
||||
$sql = "SELECT ext_name FROM {$table_prefix}ext WHERE ext_active = '1'";
|
||||
$statement = $pdo->prepare(query: $sql);
|
||||
if ($statement->execute()) {
|
||||
$result = $statement->fetchAll();
|
||||
|
||||
@ -200,8 +249,8 @@ class UpdateController
|
||||
echo 'Stored extensions state';
|
||||
|
||||
// disable all extensions
|
||||
$sql = "UPDATE ${table_prefix}ext SET ext_active = '0' WHERE ext_active = '1'";
|
||||
$statement = $this->pdo->prepare(query: $sql);
|
||||
$sql = "UPDATE {$table_prefix}ext SET ext_active = '0' WHERE ext_active = '1'";
|
||||
$statement = $pdo->prepare(query: $sql);
|
||||
if ($statement->execute()) {
|
||||
echo 'Disabled all extensions';
|
||||
}
|
||||
@ -215,8 +264,8 @@ class UpdateController
|
||||
echo 'Styles state already stored. Remove styles.txt if you wish to recreate it' . PHP_EOL;
|
||||
} else {
|
||||
// check for enabled style
|
||||
$sql = "SELECT style_name FROM ${table_prefix}styles WHERE style_active = '1'";
|
||||
$statement = $this->pdo->prepare(query: $sql);
|
||||
$sql = "SELECT style_name FROM {$table_prefix}styles WHERE style_active = '1'";
|
||||
$statement = $pdo->prepare(query: $sql);
|
||||
if ($statement->execute()) {
|
||||
$result = $statement->fetchAll();
|
||||
|
||||
@ -230,8 +279,8 @@ class UpdateController
|
||||
echo 'Stored styles state.' . PHP_EOL;
|
||||
|
||||
// disable all styles except prosilver
|
||||
$sql = "UPDATE ${table_prefix}styles SET style_active = '0' WHERE NOT style_name = 'prosilver'";
|
||||
$statement = $this->pdo->prepare(query: $sql);
|
||||
$sql = "UPDATE {$table_prefix}styles SET style_active = '0' WHERE NOT style_name = 'prosilver'";
|
||||
$statement = $pdo->prepare(query: $sql);
|
||||
if ($statement->execute()) {
|
||||
echo 'Disabled all styles except prosilver.' . PHP_EOL;
|
||||
}
|
||||
@ -296,7 +345,6 @@ class UpdateController
|
||||
|
||||
$command = <<<EOC
|
||||
cd ..
|
||||
pwd
|
||||
php install/phpbbcli.php update update-config.yml
|
||||
EOC;
|
||||
|
||||
@ -327,6 +375,7 @@ class UpdateController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// update langDeSie
|
||||
if ($useLangDeSie) {
|
||||
$data = new PharData(filename: $langDeSieTarget);
|
||||
@ -340,9 +389,8 @@ class UpdateController
|
||||
}
|
||||
|
||||
|
||||
|
||||
$sql = "UPDATE ${table_prefix}config SET config_value = '0' WHERE config_name = 'board_disable'";
|
||||
$statement = $this->pdo->prepare(query: $sql);
|
||||
$sql = "UPDATE {$table_prefix}config SET config_value = '0' WHERE config_name = 'board_disable'";
|
||||
$statement = $pdo->prepare(query: $sql);
|
||||
$statement->execute();
|
||||
|
||||
echo "Board reenabled …", PHP_EOL;
|
||||
@ -356,8 +404,8 @@ class UpdateController
|
||||
|
||||
foreach ($extensions as $extension) {
|
||||
$ext = $extension['ext_name'];
|
||||
$sql = "UPDATE ${table_prefix}ext SET ext_active = '1' WHERE ext_name = '$ext'";
|
||||
$statement = $this->pdo->prepare(query: $sql);
|
||||
$sql = "UPDATE {$table_prefix}ext SET ext_active = '1' WHERE ext_name = '$ext'";
|
||||
$statement = $pdo->prepare(query: $sql);
|
||||
$statement->execute();
|
||||
echo '.';
|
||||
}
|
||||
@ -374,8 +422,8 @@ class UpdateController
|
||||
|
||||
foreach ($styles as $style) {
|
||||
$style = $style['style_name'];
|
||||
$sql = "UPDATE ${table_prefix}styles SET style_active = '1' WHERE style_name = '$style'";
|
||||
$statement = $this->pdo->prepare(query: $sql);
|
||||
$sql = "UPDATE {$table_prefix}styles SET style_active = '1' WHERE style_name = '$style'";
|
||||
$statement = $pdo->prepare(query: $sql);
|
||||
$statement->execute();
|
||||
echo '.';
|
||||
}
|
||||
@ -470,7 +518,7 @@ class UpdateController
|
||||
$skip = true;
|
||||
}
|
||||
}
|
||||
if ($skip == false) {
|
||||
if (!$skip) {
|
||||
rmdir(directory: $dir);
|
||||
}
|
||||
}
|
||||
@ -513,4 +561,17 @@ class UpdateController
|
||||
// ignore links, not part of phpBB arch
|
||||
}
|
||||
|
||||
public function printHelp(): void
|
||||
{
|
||||
echo "Usage: php update.php [options]", PHP_EOL;
|
||||
echo "Options:", PHP_EOL;
|
||||
echo "-h --help Print this help", PHP_EOL;
|
||||
echo "-d --dry-run Just check for downloadable files, don't connect to database.", PHP_EOL;
|
||||
}
|
||||
|
||||
public function setDryRun(): void
|
||||
{
|
||||
$this->dryRun = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
32
README.md
32
README.md
@ -1,3 +1,35 @@
|
||||
# phpbb_updates
|
||||
|
||||
Shell Script to update phpBB to current version.
|
||||
|
||||
|
||||
Usage:
|
||||
|
||||
Switch into your current phpBB root directory, then
|
||||
|
||||
`git clone https://git.24unix.net/tracer/phpbb_updates.git`
|
||||
|
||||
Or download either:
|
||||
https://git.24unix.net/tracer/phpbb_updates/archive/v0.0.1.zip
|
||||
|
||||
or:
|
||||
https://git.24unix.net/tracer/phpbb_updates/archive/v0.0.1.tar.gz
|
||||
|
||||
and unpack them into the same directory and change into phpbb_updates.
|
||||
|
||||
Then: Install composer (https://getcomposer.org/download/) and run
|
||||
`composer install`
|
||||
|
||||
followed by:
|
||||
`php update.php` or `/update.php`
|
||||
|
||||
If you are using KeyHelp, replace
|
||||
|
||||
`composer install` with `keyhelp-php81 composer install`
|
||||
and
|
||||
`php update.php` with `keyhelp-php81 update.php`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
21
composer.json
Normal file
21
composer.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "tracer/phpbb_updates",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Micha Espey",
|
||||
"email": "tracer@24unix.net"
|
||||
}
|
||||
],
|
||||
|
||||
"require": {
|
||||
"php-school/cli-menu": "^4.3",
|
||||
"ext-posix": "*",
|
||||
"ext-pdo": "*"
|
||||
},
|
||||
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"App\\": "Controller/"
|
||||
}
|
||||
}
|
||||
}
|
207
composer.lock
generated
Normal file
207
composer.lock
generated
Normal file
@ -0,0 +1,207 @@
|
||||
{
|
||||
"_readme": [
|
||||
"This file locks the dependencies of your project to a known state",
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "ea334e217cccb22191ad5b9d31c65f64",
|
||||
"packages": [
|
||||
{
|
||||
"name": "beberlei/assert",
|
||||
"version": "v3.3.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/beberlei/assert.git",
|
||||
"reference": "cb70015c04be1baee6f5f5c953703347c0ac1655"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/beberlei/assert/zipball/cb70015c04be1baee6f5f5c953703347c0ac1655",
|
||||
"reference": "cb70015c04be1baee6f5f5c953703347c0ac1655",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-ctype": "*",
|
||||
"ext-json": "*",
|
||||
"ext-mbstring": "*",
|
||||
"ext-simplexml": "*",
|
||||
"php": "^7.0 || ^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "*",
|
||||
"phpstan/phpstan": "*",
|
||||
"phpunit/phpunit": ">=6.0.0",
|
||||
"yoast/phpunit-polyfills": "^0.1.0"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-intl": "Needed to allow Assertion::count(), Assertion::isCountable(), Assertion::minCount(), and Assertion::maxCount() to operate on ResourceBundles"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"lib/Assert/functions.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Assert\\": "lib/Assert"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"BSD-2-Clause"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Benjamin Eberlei",
|
||||
"email": "kontakt@beberlei.de",
|
||||
"role": "Lead Developer"
|
||||
},
|
||||
{
|
||||
"name": "Richard Quadling",
|
||||
"email": "rquadling@gmail.com",
|
||||
"role": "Collaborator"
|
||||
}
|
||||
],
|
||||
"description": "Thin assertion library for input validation in business models.",
|
||||
"keywords": [
|
||||
"assert",
|
||||
"assertion",
|
||||
"validation"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/beberlei/assert/issues",
|
||||
"source": "https://github.com/beberlei/assert/tree/v3.3.2"
|
||||
},
|
||||
"time": "2021-12-16T21:41:27+00:00"
|
||||
},
|
||||
{
|
||||
"name": "php-school/cli-menu",
|
||||
"version": "4.3.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-school/cli-menu.git",
|
||||
"reference": "bad5e0177f2b3ada6dc14eee4011fee4001b7679"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-school/cli-menu/zipball/bad5e0177f2b3ada6dc14eee4011fee4001b7679",
|
||||
"reference": "bad5e0177f2b3ada6dc14eee4011fee4001b7679",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"beberlei/assert": "^2.4 | ^3",
|
||||
"ext-mbstring": "*",
|
||||
"ext-posix": "*",
|
||||
"php": ">=7.1",
|
||||
"php-school/terminal": "^0.2.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan/phpstan": "^0.12",
|
||||
"phpunit/phpunit": "^8.0 | ^9.0",
|
||||
"squizlabs/php_codesniffer": "^3.2"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/Util/ArrayUtils.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"PhpSchool\\CliMenu\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Michael Woodward",
|
||||
"email": "mikeymike.mw@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Aydin Hassan",
|
||||
"email": "aydin@hotmail.com"
|
||||
}
|
||||
],
|
||||
"description": "A command line menu helper in PHP",
|
||||
"keywords": [
|
||||
"cli",
|
||||
"console",
|
||||
"menu",
|
||||
"php-school",
|
||||
"phpschool",
|
||||
"terminal"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/php-school/cli-menu/issues",
|
||||
"source": "https://github.com/php-school/cli-menu/tree/4.3.0"
|
||||
},
|
||||
"time": "2021-12-16T09:40:06+00:00"
|
||||
},
|
||||
{
|
||||
"name": "php-school/terminal",
|
||||
"version": "0.2.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-school/terminal.git",
|
||||
"reference": "725f86c7db996a4cf65648022f17e22391e97320"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-school/terminal/zipball/725f86c7db996a4cf65648022f17e22391e97320",
|
||||
"reference": "725f86c7db996a4cf65648022f17e22391e97320",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-posix": "*",
|
||||
"php": ">=7.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan/phpstan": "^0.9.2",
|
||||
"phpunit/phpunit": "^7.1",
|
||||
"squizlabs/php_codesniffer": "^3.2"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"PhpSchool\\Terminal\\": "src"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Michael Woodward",
|
||||
"email": "mikeymike.mw@gmail.com"
|
||||
},
|
||||
{
|
||||
"name": "Aydin Hassan",
|
||||
"email": "aydin@hotmail.com"
|
||||
}
|
||||
],
|
||||
"description": "A command line terminal utility in PHP",
|
||||
"keywords": [
|
||||
"cli",
|
||||
"console",
|
||||
"php-school",
|
||||
"phpschool",
|
||||
"terminal"
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/php-school/terminal/issues",
|
||||
"source": "https://github.com/php-school/terminal/tree/0.2.1"
|
||||
},
|
||||
"time": "2019-12-17T21:56:06+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": [],
|
||||
"prefer-stable": false,
|
||||
"prefer-lowest": false,
|
||||
"platform": [],
|
||||
"platform-dev": [],
|
||||
"plugin-api-version": "2.2.0"
|
||||
}
|
16
update.php
16
update.php
@ -1,9 +1,21 @@
|
||||
#!/usr/bin/keyhelp-php81 -d apc.enable_cli=1
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
use App\UpdateController;
|
||||
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
|
||||
$update = new UpdateController();
|
||||
|
||||
$options = $update->parseOpts();
|
||||
|
||||
// Help option
|
||||
if (array_key_exists(key: 'h', array: $options) || array_key_exists(key: 'help', array: $options)) {
|
||||
$update->printHelp();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if (array_key_exists(key: 'd', array: $options) || array_key_exists(key: 'dry-run', array: $options)) {
|
||||
$update->setDryRun();
|
||||
}
|
||||
|
||||
$update->handleUpdate();
|
||||
|
Reference in New Issue
Block a user