feat(upgrader): handler hibernating wikis
Some checks are pending
/ test (push) Waiting to run

This commit is contained in:
Florian Schmitt 2025-04-01 13:53:33 +03:00
parent 2c0d9712eb
commit a3116f7670

View file

@ -369,7 +369,18 @@ function upgradeWiki($srcDir, $destDir, $nobackup = false)
$output .= 'File not found "' . $f . '"' . "\n"; $output .= 'File not found "' . $f . '"' . "\n";
} }
} }
exec("cat $destDir/wakka.config.php | grep hibernate", $outputHibernate);
$outputHibernate = implode('', $outputHibernate);
$isHibernating = str_contains($outputHibernate, 'hibernate');
if ($isHibernating) {
$output .= '==== Get YesWiki out of hibernation';
$output .= cli("sed -r -i -e \"s/(['\\\"]wiki_status['\\\"].*)/'wiki_status' => 'running',/\" $destDir/wakka.config.php");
}
$output .= runUpgrades($sudo, $destDir, array_diff($installedExtensions, $defaultExtensions)); $output .= runUpgrades($sudo, $destDir, array_diff($installedExtensions, $defaultExtensions));
if ($isHibernating) {
$output .= '==== Get YesWiki back in hibernation';
$output .= cli("sed -r -i -e \"s/(['\\\"]wiki_status['\\\"].*)/'wiki_status' => 'hibernate',/\" $destDir/wakka.config.php");
}
$version = trim(cli("cat $destDir/includes/constants.php | grep YESWIKI_RELEASE | sed -r -e \"s/.*([0-9]+\\.[0-9]+\\.[0-9]+).*/\\1/\"")); $version = trim(cli("cat $destDir/includes/constants.php | grep YESWIKI_RELEASE | sed -r -e \"s/.*([0-9]+\\.[0-9]+\\.[0-9]+).*/\\1/\""));
$output .= '==== Change YesWiki version to '.$version.' '. $bars; $output .= '==== Change YesWiki version to '.$version.' '. $bars;
$output .= cli("sed -r -i -e \"s/(['\\\"]yeswiki_release['\\\"].*)/'yeswiki_release' => '$version',/\" $destDir/wakka.config.php"); $output .= cli("sed -r -i -e \"s/(['\\\"]yeswiki_release['\\\"].*)/'yeswiki_release' => '$version',/\" $destDir/wakka.config.php");