diff --git a/utils.inc.php b/utils.inc.php index 7c1c48f..3daf0ad 100644 --- a/utils.inc.php +++ b/utils.inc.php @@ -317,7 +317,7 @@ function saveSql($wikiDir, $backupDir) return '==== Mysql database saved in '.$backupDir.'/database.sql ==========='. "\n"; } -function upgradeWiki($srcDir, $destDir, $backup) +function upgradeWiki($srcDir, $destDir, $nobackup = false) { $filesToMove = ['actions', 'cache', 'docker', 'docs', 'formatters', 'handlers', 'includes', 'javascripts', 'lang', 'private', 'setup', 'styles', 'templates', 'tests', 'themes', 'tools', 'vendor', 'composer.json', 'composer.lock', 'index.php', 'INSTALL.md', 'interwiki.conf', 'LICENSE', 'Makefile', 'package.json', 'README.md', 'SECURITY.md', 'wakka.basic.css', 'wakka.css', 'wakka.php', 'yarn.lock', 'yeswicli']; $defaultExtensions = array_map('basename', array_filter(glob($srcDir.'/tools/*'), 'is_dir')); @@ -329,7 +329,7 @@ function upgradeWiki($srcDir, $destDir, $backup) $sudo = 'sudo -u ' . $user . ' '; $wakkaConfig = []; require $destDir.'/wakka.config.php'; - if ($backup === true) { + if (!$nobackup) { $tmpbackupDir = '/root/yeswiki_backups/'.str_replace(['https://', 'http://', '/?', '/'], ['','','','-'], $wakkaConfig['base_url']); if (is_dir($tmpbackupDir)) { $output .= 'ERROR: found existing backup in "' . $tmpbackupDir . '" aborting' . "\n"; diff --git a/yeswiki-updater.php b/yeswiki-updater.php index c6ee83f..2f0228e 100755 --- a/yeswiki-updater.php +++ b/yeswiki-updater.php @@ -39,11 +39,11 @@ if ($isRoot) { 'description' => 'Update to latest version of stable yeswiki', 'noValue' => true ], - 'backup' => [ - 'prefix' => 'b', - 'longPrefix' => 'backup', - 'description' => 'Save a backup in /root/yeswiki_backups folder before upgrading the yeswiki', - 'defaultValue' => true + 'nobackup' => [ + 'prefix' => 'nobackup', + 'longPrefix' => 'nobackup', + 'description' => 'Do not save a backup in /root/yeswiki_backups folder before upgrading the yeswiki', + 'noValue' => true ], 'depth' => [ 'prefix' => 'd', @@ -66,7 +66,7 @@ if ($isRoot) { try { $update = $climate->arguments->get('update'); $output = $climate->arguments->get('output'); - $backup = $climate->arguments->get('backup'); + $nobackup = $climate->arguments->get('nobackup'); $depth = $climate->arguments->get('depth'); $matches = searchWikis($path, 'wakka.config.php', $depth); if (count($matches) == 0) { @@ -94,7 +94,7 @@ if ($isRoot) { } elseif ($wiki['RELEASE'] == $version) { $climate->info('Skipping up-to-date wiki '.$wiki['URL']); } else { - $climate->info(upgradeWiki($destDir, $wiki['PATH'], $backup)); + $climate->info(upgradeWiki($destDir, $wiki['PATH'], $nobackup)); } } } else { // show yeswiki list info