add yeswiki-move, fix shebangs, chore deps
Some checks are pending
/ test (push) Waiting to run

This commit is contained in:
Florian Schmitt 2024-12-05 21:49:11 +03:00
parent cc25c7f947
commit 5de62d801c
6 changed files with 252 additions and 185 deletions

View file

@ -1,9 +1,9 @@
{
"require": {
"league/climate": "^3.8",
"devcoder-xyz/php-dotenv": "^1.1",
"league/plates": "^3.4",
"amphp/parallel": "^2.2",
"amphp/http-client": "^5.0"
"amphp/http-client": "^5.0",
"phpdevcommunity/php-dotenv": "^3.0"
}
}

151
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "f4d486f76bc0e2d76db29133b0909637",
"content-hash": "e3d3e7ac1605e6943e9c35a1317d6e7e",
"packages": [
{
"name": "amphp/amp",
@ -391,16 +391,16 @@
},
{
"name": "amphp/http",
"version": "v2.1.1",
"version": "v2.1.2",
"source": {
"type": "git",
"url": "https://github.com/amphp/http.git",
"reference": "fe6b4dd50c1e70caf823092398074b5082e1d6da"
"reference": "3680d80bd38b5d6f3c2cef2214ca6dd6cef26588"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/amphp/http/zipball/fe6b4dd50c1e70caf823092398074b5082e1d6da",
"reference": "fe6b4dd50c1e70caf823092398074b5082e1d6da",
"url": "https://api.github.com/repos/amphp/http/zipball/3680d80bd38b5d6f3c2cef2214ca6dd6cef26588",
"reference": "3680d80bd38b5d6f3c2cef2214ca6dd6cef26588",
"shasum": ""
},
"require": {
@ -414,7 +414,7 @@
"amphp/php-cs-fixer-config": "^2",
"league/uri": "^6.8 | ^7.1",
"phpunit/phpunit": "^9",
"psalm/phar": "^5.4"
"psalm/phar": "^5.26.1"
},
"type": "library",
"autoload": {
@ -443,7 +443,7 @@
"description": "Basic HTTP primitives which can be shared by servers and clients.",
"support": {
"issues": "https://github.com/amphp/http/issues",
"source": "https://github.com/amphp/http/tree/v2.1.1"
"source": "https://github.com/amphp/http/tree/v2.1.2"
},
"funding": [
{
@ -451,7 +451,7 @@
"type": "github"
}
],
"time": "2024-04-03T18:00:53+00:00"
"time": "2024-11-23T14:57:26+00:00"
},
{
"name": "amphp/http-client",
@ -550,16 +550,16 @@
},
{
"name": "amphp/parallel",
"version": "v2.2.9",
"version": "v2.3.0",
"source": {
"type": "git",
"url": "https://github.com/amphp/parallel.git",
"reference": "73d293f1fc4df1bebc3c4fce1432e82dd7032238"
"reference": "9777db1460d1535bc2a843840684fb1205225b87"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/amphp/parallel/zipball/73d293f1fc4df1bebc3c4fce1432e82dd7032238",
"reference": "73d293f1fc4df1bebc3c4fce1432e82dd7032238",
"url": "https://api.github.com/repos/amphp/parallel/zipball/9777db1460d1535bc2a843840684fb1205225b87",
"reference": "9777db1460d1535bc2a843840684fb1205225b87",
"shasum": ""
},
"require": {
@ -622,7 +622,7 @@
],
"support": {
"issues": "https://github.com/amphp/parallel/issues",
"source": "https://github.com/amphp/parallel/tree/v2.2.9"
"source": "https://github.com/amphp/parallel/tree/v2.3.0"
},
"funding": [
{
@ -630,7 +630,7 @@
"type": "github"
}
],
"time": "2024-03-24T18:27:44+00:00"
"time": "2024-09-14T19:16:14+00:00"
},
{
"name": "amphp/parser",
@ -1142,50 +1142,6 @@
},
"time": "2024-04-12T12:12:48+00:00"
},
{
"name": "devcoder-xyz/php-dotenv",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/devcoder-xyz/php-dotenv.git",
"reference": "1f478184b7fd199f5ffb0f89c1547f61c8172042"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/devcoder-xyz/php-dotenv/zipball/1f478184b7fd199f5ffb0f89c1547f61c8172042",
"reference": "1f478184b7fd199f5ffb0f89c1547f61c8172042",
"shasum": ""
},
"require": {
"php": ">=7.3"
},
"require-dev": {
"phpunit/phpunit": "^9.4"
},
"type": "library",
"autoload": {
"psr-4": {
"DevCoder\\": "src",
"Test\\DevCoder\\": "tests"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Fad M.R",
"email": "fadymichel@devcoder.xyz"
}
],
"description": "Parses .env files",
"support": {
"issues": "https://github.com/devcoder-xyz/php-dotenv/issues",
"source": "https://github.com/devcoder-xyz/php-dotenv/tree/1.1.1"
},
"time": "2021-07-17T21:19:15+00:00"
},
{
"name": "kelunik/certificate",
"version": "v1.1.3",
@ -1246,16 +1202,16 @@
},
{
"name": "league/climate",
"version": "3.8.2",
"version": "3.10.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/climate.git",
"reference": "a785a3ac8f584eed4abd45e4e16fe64c46659a28"
"reference": "237f70e1032b16d32ff3f65dcda68706911e1c74"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/climate/zipball/a785a3ac8f584eed4abd45e4e16fe64c46659a28",
"reference": "a785a3ac8f584eed4abd45e4e16fe64c46659a28",
"url": "https://api.github.com/repos/thephpleague/climate/zipball/237f70e1032b16d32ff3f65dcda68706911e1c74",
"reference": "237f70e1032b16d32ff3f65dcda68706911e1c74",
"shasum": ""
},
"require": {
@ -1264,9 +1220,10 @@
"seld/cli-prompt": "^1.0"
},
"require-dev": {
"mikey179/vfsstream": "^1.6.10",
"mockery/mockery": "^1.4.2",
"phpunit/phpunit": "^9.5.10"
"mikey179/vfsstream": "^1.6.12",
"mockery/mockery": "^1.6.12",
"phpunit/phpunit": "^9.5.10",
"squizlabs/php_codesniffer": "^3.10"
},
"suggest": {
"ext-mbstring": "If ext-mbstring is not available you MUST install symfony/polyfill-mbstring"
@ -1305,30 +1262,30 @@
],
"support": {
"issues": "https://github.com/thephpleague/climate/issues",
"source": "https://github.com/thephpleague/climate/tree/3.8.2"
"source": "https://github.com/thephpleague/climate/tree/3.10.0"
},
"time": "2022-06-18T14:42:08+00:00"
"time": "2024-11-18T09:09:55+00:00"
},
{
"name": "league/plates",
"version": "v3.5.0",
"version": "v3.6.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/plates.git",
"reference": "a6a3238e46c6e19af7318fdc36bfbe49b0620231"
"reference": "12ee65166adbc6fb5916fb80b0c0758e49a2d996"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/plates/zipball/a6a3238e46c6e19af7318fdc36bfbe49b0620231",
"reference": "a6a3238e46c6e19af7318fdc36bfbe49b0620231",
"url": "https://api.github.com/repos/thephpleague/plates/zipball/12ee65166adbc6fb5916fb80b0c0758e49a2d996",
"reference": "12ee65166adbc6fb5916fb80b0c0758e49a2d996",
"shasum": ""
},
"require": {
"php": "^7.0|^8.0"
"php": "^8.0"
},
"require-dev": {
"mikey179/vfsstream": "^1.6",
"phpunit/phpunit": "^9.5",
"phpunit/phpunit": "^11.4",
"squizlabs/php_codesniffer": "^3.5"
},
"type": "library",
@ -1369,9 +1326,9 @@
],
"support": {
"issues": "https://github.com/thephpleague/plates/issues",
"source": "https://github.com/thephpleague/plates/tree/v3.5.0"
"source": "https://github.com/thephpleague/plates/tree/v3.6.0"
},
"time": "2023-01-16T20:25:45+00:00"
"time": "2024-11-02T15:03:35+00:00"
},
{
"name": "league/uri",
@ -1629,6 +1586,50 @@
],
"time": "2024-03-23T07:42:40+00:00"
},
{
"name": "phpdevcommunity/php-dotenv",
"version": "3.0.0",
"source": {
"type": "git",
"url": "https://github.com/phpdevcommunity/php-dotenv.git",
"reference": "cf8a190daca8fa504be1d85c0eb18d55001d4060"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpdevcommunity/php-dotenv/zipball/cf8a190daca8fa504be1d85c0eb18d55001d4060",
"reference": "cf8a190daca8fa504be1d85c0eb18d55001d4060",
"shasum": ""
},
"require": {
"php": ">=7.4"
},
"require-dev": {
"phpdevcommunity/unitester": "^0.1.0@alpha"
},
"type": "library",
"autoload": {
"psr-4": {
"PhpDevCommunity\\": "src",
"Test\\PhpDevCommunity\\": "tests"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "F. Michel",
"homepage": "https://www.phpdevcommunity.com"
}
],
"description": "PHP-DotEnv is a lightweight PHP library designed to simplify the management of environment variables in your PHP applications.",
"support": {
"issues": "https://github.com/phpdevcommunity/php-dotenv/issues",
"source": "https://github.com/phpdevcommunity/php-dotenv/tree/3.0.0"
},
"time": "2024-10-07T08:33:46+00:00"
},
{
"name": "psr/http-factory",
"version": "1.1.0",

View file

@ -1,12 +1,13 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
require_once('vendor/autoload.php');
require_once('utils.inc.php');
use DevCoder\DotEnv;
use PhpDevCommunity\DotEnv;
use League\CLImate\CLImate;
$climate = new League\CLImate\CLImate();
$climate = new CLImate();
$climate->description('yeswiki-installer, install YesWiki like a professionnal 🌈🦄');
if (0 == posix_getuid()) {

61
yeswiki-move.php Executable file
View file

@ -0,0 +1,61 @@
#!/usr/bin/env php
<?php
require_once('vendor/autoload.php');
require_once('utils.inc.php');
use PhpDevCommunity\DotEnv;
use League\CLImate\CLImate;
$climate = new CLImate();
$climate->description('yeswiki-move, move YesWiki like a professionnal 🌈🦄');
if (posix_getuid() != 0) {
$climate->error('ERROR : this script needs root privilege to run.');
exit;
}
$absolutePathToEnvFile = __DIR__ . '/.env';
if (file_exists($absolutePathToEnvFile)) {
(new DotEnv($absolutePathToEnvFile))->load();
} else {
$climate->error('ERROR : No .env file found.');
exit;
}
$climate->arguments->add([
'from' => [
'prefix' => 'f',
'longPrefix' => 'from',
'description' => 'Url of source wiki',
'required' => true,
'defaultValue' => 'https://example.com'
],
'to' => [
'prefix' => 't',
'longPrefix' => 'to',
'description' => 'Url of destination wiki',
'required' => true,
'defaultValue' => 'https://destination.com'
],
]);
$climate->arguments->parse();
$from = $climate->arguments->get('from');
$to = $climate->arguments->get('to');
if (empty($from) || $from == 'https://example.com' || empty($to) || $to == 'https://destination.com') {
$climate->error('ERROR : you need a --from (the source url) and a --to (the destination url).'."\n");
$climate->usage();
exit;
}
$climate->bold()->underline()->out('Move a YesWiki');
$climate->out('This will move yeswiki on <bold>'.$from.'</bold> to <bold>'.$to.'</bold>, CAREFULL the destination yeswiki will be rreplaced'."\n");
$input = $climate->confirm('Is it all good ?');
if ($input->confirmed()) {
$climate->shout(
'The yeswiki <bold>'.$from.'</bold> was successfully moved to <bold>'.$to.'</bold>, congrats ! 🎉'."\n"
);
} else {
$climate->info('Ok, let\'s stop here...');
}

View file

@ -1,11 +1,13 @@
#!/usr/bin/php
#!/usr/bin/env php
<?php
require_once('vendor/autoload.php');
require_once('utils.inc.php');
use DevCoder\DotEnv;
use PhpDevCommunity\DotEnv;
use League\CLImate\CLImate;
$climate = new League\CLImate\CLImate();
$climate = new CLImate();
$climate->description('yeswiki-remover, remove a domain used for YesWiki because death is not the end 💀😈');
if (0 == posix_getuid()) {

View file

@ -1,11 +1,13 @@
#!php
#!/usr/bin/env php
<?php
require_once('vendor/autoload.php');
require_once('utils.inc.php');
use DevCoder\DotEnv;
use PhpDevCommunity\DotEnv;
use League\CLImate\CLImate;
$climate = new League\CLImate\CLImate();
$climate = new CLImate();
$climate->description('yeswiki-updater, find and update YesWiki like a professionnal 🌈🦄');
$isRoot = (0 == posix_getuid());