diff --git a/composer.json b/composer.json
index 887277d..bb030c1 100644
--- a/composer.json
+++ b/composer.json
@@ -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"
}
}
diff --git a/composer.lock b/composer.lock
index eb48b6c..862c976 100644
--- a/composer.lock
+++ b/composer.lock
@@ -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",
diff --git a/yeswiki-installer.php b/yeswiki-installer.php
index 1acd768..321a11d 100755
--- a/yeswiki-installer.php
+++ b/yeswiki-installer.php
@@ -1,12 +1,13 @@
-#!/usr/bin/php
+#!/usr/bin/env php
description('yeswiki-installer, install YesWiki like a professionnal 🌈🦄');
if (0 == posix_getuid()) {
diff --git a/yeswiki-move.php b/yeswiki-move.php
new file mode 100755
index 0000000..76a660b
--- /dev/null
+++ b/yeswiki-move.php
@@ -0,0 +1,61 @@
+#!/usr/bin/env php
+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 '.$from.' to '.$to.', CAREFULL the destination yeswiki will be rreplaced'."\n");
+$input = $climate->confirm('Is it all good ?');
+if ($input->confirmed()) {
+ $climate->shout(
+ 'The yeswiki '.$from.' was successfully moved to '.$to.', congrats ! 🎉'."\n"
+ );
+} else {
+ $climate->info('Ok, let\'s stop here...');
+}
diff --git a/yeswiki-remover.php b/yeswiki-remover.php
index 25586b7..1a6f2a0 100755
--- a/yeswiki-remover.php
+++ b/yeswiki-remover.php
@@ -1,11 +1,13 @@
-#!/usr/bin/php
+#!/usr/bin/env php
description('yeswiki-remover, remove a domain used for YesWiki because death is not the end 💀😈');
if (0 == posix_getuid()) {
@@ -54,7 +56,7 @@ if (0 == posix_getuid()) {
$climate->shout(
'The yeswiki on '.$domain.' was successfully removed, congrats ! 🎉'."\n"
);
- // TODO : send log, send email
+ // TODO : send log, send email
} else {
$climate->info('Ok, let\'s stop here...');
}
diff --git a/yeswiki-updater.php b/yeswiki-updater.php
index 2f79dbf..b4e5e91 100755
--- a/yeswiki-updater.php
+++ b/yeswiki-updater.php
@@ -1,114 +1,116 @@
-#!php
+#!/usr/bin/env php
description('yeswiki-updater, find and update YesWiki like a professionnal 🌈🦄');
$isRoot = (0 == posix_getuid());
if ($isRoot) {
- $absolutePathToEnvFile = __DIR__ . '/.env';
- if (file_exists($absolutePathToEnvFile)) {
- (new DotEnv($absolutePathToEnvFile))->load();
- } else {
- $climate->error('ERROR : No .env file found.');
- exit;
- }
-
- $climate->arguments->add([
- 'path' => [
- 'prefix' => 'p',
- 'longPrefix' => 'path',
- 'description' => 'Path to scan for wikis',
- 'required' => true,
- ],
- 'output' => [
- 'prefix' => 'o',
- 'longPrefix' => 'output',
- 'description' => 'Output results in table format, json or csv',
- 'defaultValue' => 'table'
- ],
- 'update' => [
- 'prefix' => 'u',
- 'longPrefix' => 'update',
- 'description' => 'Update to latest version of stable yeswiki',
- 'noValue' => true
- ],
- 'depth' => [
- 'prefix' => 'd',
- 'longPrefix' => 'depth',
- 'description' => 'Depth to scan folders for wikis',
- 'defaultValue' => 1
- ],
- ]);
- try {
- $climate->arguments->parse();
- } catch (\Throwable $th) {
- if (!$climate->arguments->defined('path')) {
- $climate->error('This command needs a valid path argument for example : -p /var/www/html');
- $climate->usage();
- return;
- }
- }
- $path = $climate->arguments->get('path');
- if (!empty($path) && is_dir($path)) {
- try {
- $update = $climate->arguments->get('update');
- $output = $climate->arguments->get('output');
- $depth = $climate->arguments->get('depth');
- $matches = searchWikis($path, 'wakka.config.php', $depth);
- if (count($matches) == 0) {
- $climate->info('No yeswiki found on path ' . $path . ' with depth ' . $depth);
+ $absolutePathToEnvFile = __DIR__ . '/.env';
+ if (file_exists($absolutePathToEnvFile)) {
+ (new DotEnv($absolutePathToEnvFile))->load();
+ } else {
+ $climate->error('ERROR : No .env file found.');
exit;
- }
- if (count($matches) > 0 && $update) { // update yeswiki list
- $climate->info('Update yeswiki');
- $tmpFile = '/tmp/yeswiki.zip';
- $destDir = '/tmp/yeswiki_for_update';
- exec('rm -rf ' . $destDir . ' && mkdir -p ' . $destDir, $output);
- if (file_exists($tmpFile)) {
- unlink($tmpFile);
- }
- exec('curl --insecure -s -o ' . $tmpFile . ' ' . $_SERVER['source_archive_url']);
- exec('unzip ' . $tmpFile . ' "doryphore/*" -d ' . $destDir);
- exec('mv ' . $destDir . '/doryphore/* ' . $destDir . '/');
- exec('rm -rf ' . $destDir . '/doryphore');
- unlink($tmpFile);
- foreach ($matches as $k => $wiki) {
- $climate->info(upgradeWiki($destDir, $wiki['PATH']));
- }
- } else { // show yeswiki list info
- $climate->info(count($matches) . ' yeswikis found on ' . $path);
- switch ($output) {
-
- case 'table':
- $climate->table($matches);
- break;
-
- case 'json':
- $climate->json($matches);
- break;
-
- case 'csv':
- $fileName = 'yeswiki-list.csv';
- $file = fopen($fileName, "w");
- foreach ($matches as $line) {
- fputcsv($file, $line);
- }
- $climate->info($fileName . ' was created.');
- break;
- }
- }
- } catch (Exception $e) {
- $climate->error('ERROR : ' . $e->getMessage());
}
- } else {
- $climate->usage();
- }
+
+ $climate->arguments->add([
+ 'path' => [
+ 'prefix' => 'p',
+ 'longPrefix' => 'path',
+ 'description' => 'Path to scan for wikis',
+ 'required' => true,
+ ],
+ 'output' => [
+ 'prefix' => 'o',
+ 'longPrefix' => 'output',
+ 'description' => 'Output results in table format, json or csv',
+ 'defaultValue' => 'table'
+ ],
+ 'update' => [
+ 'prefix' => 'u',
+ 'longPrefix' => 'update',
+ 'description' => 'Update to latest version of stable yeswiki',
+ 'noValue' => true
+ ],
+ 'depth' => [
+ 'prefix' => 'd',
+ 'longPrefix' => 'depth',
+ 'description' => 'Depth to scan folders for wikis',
+ 'defaultValue' => 1
+ ],
+ ]);
+ try {
+ $climate->arguments->parse();
+ } catch (\Throwable $th) {
+ if (!$climate->arguments->defined('path')) {
+ $climate->error('This command needs a valid path argument for example : -p /var/www/html');
+ $climate->usage();
+ return;
+ }
+ }
+ $path = $climate->arguments->get('path');
+ if (!empty($path) && is_dir($path)) {
+ try {
+ $update = $climate->arguments->get('update');
+ $output = $climate->arguments->get('output');
+ $depth = $climate->arguments->get('depth');
+ $matches = searchWikis($path, 'wakka.config.php', $depth);
+ if (count($matches) == 0) {
+ $climate->info('No yeswiki found on path ' . $path . ' with depth ' . $depth);
+ exit;
+ }
+ if (count($matches) > 0 && $update) { // update yeswiki list
+ $climate->info('Update yeswiki');
+ $tmpFile = '/tmp/yeswiki.zip';
+ $destDir = '/tmp/yeswiki_for_update';
+ exec('rm -rf ' . $destDir . ' && mkdir -p ' . $destDir, $output);
+ if (file_exists($tmpFile)) {
+ unlink($tmpFile);
+ }
+ exec('curl --insecure -s -o ' . $tmpFile . ' ' . $_SERVER['source_archive_url']);
+ exec('unzip ' . $tmpFile . ' "doryphore/*" -d ' . $destDir);
+ exec('mv ' . $destDir . '/doryphore/* ' . $destDir . '/');
+ exec('rm -rf ' . $destDir . '/doryphore');
+ unlink($tmpFile);
+ foreach ($matches as $k => $wiki) {
+ $climate->info(upgradeWiki($destDir, $wiki['PATH']));
+ }
+ } else { // show yeswiki list info
+ $climate->info(count($matches) . ' yeswikis found on ' . $path);
+ switch ($output) {
+
+ case 'table':
+ $climate->table($matches);
+ break;
+
+ case 'json':
+ $climate->json($matches);
+ break;
+
+ case 'csv':
+ $fileName = 'yeswiki-list.csv';
+ $file = fopen($fileName, "w");
+ foreach ($matches as $line) {
+ fputcsv($file, $line);
+ }
+ $climate->info($fileName . ' was created.');
+ break;
+ }
+ }
+ } catch (Exception $e) {
+ $climate->error('ERROR : ' . $e->getMessage());
+ }
+ } else {
+ $climate->usage();
+ }
} else {
- $climate->error('ERROR : this script needs root privilege to run.');
- exit;
+ $climate->error('ERROR : this script needs root privilege to run.');
+ exit;
}