Compare commits
4 Commits
364ad27157
...
v0.0.2
Author | SHA1 | Date | |
---|---|---|---|
ab55fd9abb | |||
ff93b288c2 | |||
8ea6328f43 | |||
fd1ef5153a |
@ -18,10 +18,7 @@ const SUPPORTED_RELEASE_MINOR = 2;
|
||||
*/
|
||||
class UpdateController
|
||||
{
|
||||
private $pdo;
|
||||
|
||||
|
||||
function handleUpdate()
|
||||
function handleUpdate(): void
|
||||
{
|
||||
define(constant_name: "PHPBB_ROOT_PATH", value: dirname(path: __DIR__, levels: 2));
|
||||
|
||||
@ -58,7 +55,7 @@ class UpdateController
|
||||
/** @var String $dbname */
|
||||
/** @var String $dbuser */
|
||||
/** @var String $dbpasswd */
|
||||
$this->pdo = new PDO(
|
||||
$pdo = new PDO(
|
||||
dsn : "mysql:host=$dbhost;port=$dbport;charset=utf8mb4;dbname=$dbname",
|
||||
username: $dbuser,
|
||||
password: $dbpasswd
|
||||
@ -67,7 +64,7 @@ class UpdateController
|
||||
|
||||
/** @var String $table_prefix */
|
||||
$sql = "SELECT config_value FROM ${table_prefix}config WHERE config_name = 'version'";
|
||||
$statement = $this->pdo->prepare(query: $sql);
|
||||
$statement = $pdo->prepare(query: $sql);
|
||||
$statement->execute();
|
||||
$result = $statement->fetch();
|
||||
|
||||
@ -112,41 +109,49 @@ class UpdateController
|
||||
|
||||
// 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;
|
||||
$filePath = "https://downloads.phpbb.de/pakete/deutsch/$major.$minor/$availableUpdate/$languageFile";
|
||||
$phpBBtbz = file_get_contents(filename: $filePath);
|
||||
file_put_contents(filename: $langDeDuTarget, data: $phpBBtbz);
|
||||
if (file_exists(filename: $filePath)) {
|
||||
$phpBBtbz = file_get_contents(filename: $filePath);
|
||||
file_put_contents(filename: $langDeDuTarget, data: $phpBBtbz);
|
||||
} else {
|
||||
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;
|
||||
$filePath = "https://downloads.phpbb.de/pakete/deutsch/$major.$minor/$availableUpdate/$languageFile";
|
||||
$phpBBtbz = file_get_contents(filename: $filePath);
|
||||
file_put_contents(filename: $langDeSieTarget, data: $phpBBtbz);
|
||||
if (file_exists(filename: $filePath)) {
|
||||
$phpBBtbz = file_get_contents(filename: $filePath);
|
||||
file_put_contents(filename: $langDeSieTarget, data: $phpBBtbz);
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
|
||||
@ -158,10 +163,10 @@ class UpdateController
|
||||
$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);
|
||||
$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;
|
||||
@ -170,8 +175,8 @@ class UpdateController
|
||||
}
|
||||
|
||||
$sql = "UPDATE ${table_prefix}config SET config_value = '1' WHERE config_name = 'board_disable'";
|
||||
$statement = $this->pdo->prepare(query: $sql);
|
||||
if ($result = $statement->execute()) {
|
||||
$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;
|
||||
@ -186,7 +191,7 @@ class UpdateController
|
||||
} else {
|
||||
// check for enabled extensions
|
||||
$sql = "SELECT ext_name FROM ${table_prefix}ext WHERE ext_active = '1'";
|
||||
$statement = $this->pdo->prepare(query: $sql);
|
||||
$statement = $pdo->prepare(query: $sql);
|
||||
if ($statement->execute()) {
|
||||
$result = $statement->fetchAll();
|
||||
|
||||
@ -201,7 +206,7 @@ class UpdateController
|
||||
|
||||
// disable all extensions
|
||||
$sql = "UPDATE ${table_prefix}ext SET ext_active = '0' WHERE ext_active = '1'";
|
||||
$statement = $this->pdo->prepare(query: $sql);
|
||||
$statement = $pdo->prepare(query: $sql);
|
||||
if ($statement->execute()) {
|
||||
echo 'Disabled all extensions';
|
||||
}
|
||||
@ -216,7 +221,7 @@ class UpdateController
|
||||
} else {
|
||||
// check for enabled style
|
||||
$sql = "SELECT style_name FROM ${table_prefix}styles WHERE style_active = '1'";
|
||||
$statement = $this->pdo->prepare(query: $sql);
|
||||
$statement = $pdo->prepare(query: $sql);
|
||||
if ($statement->execute()) {
|
||||
$result = $statement->fetchAll();
|
||||
|
||||
@ -231,7 +236,7 @@ class UpdateController
|
||||
|
||||
// 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);
|
||||
$statement = $pdo->prepare(query: $sql);
|
||||
if ($statement->execute()) {
|
||||
echo 'Disabled all styles except prosilver.' . PHP_EOL;
|
||||
}
|
||||
@ -296,7 +301,6 @@ class UpdateController
|
||||
|
||||
$command = <<<EOC
|
||||
cd ..
|
||||
pwd
|
||||
php install/phpbbcli.php update update-config.yml
|
||||
EOC;
|
||||
|
||||
@ -327,6 +331,7 @@ class UpdateController
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// update langDeSie
|
||||
if ($useLangDeSie) {
|
||||
$data = new PharData(filename: $langDeSieTarget);
|
||||
@ -342,7 +347,7 @@ class UpdateController
|
||||
|
||||
|
||||
$sql = "UPDATE ${table_prefix}config SET config_value = '0' WHERE config_name = 'board_disable'";
|
||||
$statement = $this->pdo->prepare(query: $sql);
|
||||
$statement = $pdo->prepare(query: $sql);
|
||||
$statement->execute();
|
||||
|
||||
echo "Board reenabled …", PHP_EOL;
|
||||
@ -357,7 +362,7 @@ 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);
|
||||
$statement = $pdo->prepare(query: $sql);
|
||||
$statement->execute();
|
||||
echo '.';
|
||||
}
|
||||
@ -375,7 +380,7 @@ 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);
|
||||
$statement = $pdo->prepare(query: $sql);
|
||||
$statement->execute();
|
||||
echo '.';
|
||||
}
|
||||
@ -470,7 +475,7 @@ class UpdateController
|
||||
$skip = true;
|
||||
}
|
||||
}
|
||||
if ($skip == false) {
|
||||
if (!$skip) {
|
||||
rmdir(directory: $dir);
|
||||
}
|
||||
}
|
||||
|
32
README.md
32
README.md
@ -1,3 +1,33 @@
|
||||
# phpbb_updates
|
||||
|
||||
Shell Script to update phpBB to current version.
|
||||
Shell Script to update phpBB to current version.
|
||||
|
||||
|
||||
Usage:
|
||||
|
||||
Switch into you 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`
|
||||
|
||||
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"
|
||||
}
|
Reference in New Issue
Block a user