This commit is contained in:
parent
84908174da
commit
450dda6997
1 changed files with 17 additions and 4 deletions
|
@ -307,19 +307,32 @@ function removePhpFpmConfig($user)
|
|||
unlink($phpConfFile);
|
||||
exec('service ' . $_SERVER['phpservice'] . ' reload', $output);
|
||||
}
|
||||
function saveSql($srcDir, $destDir)
|
||||
{
|
||||
$output = '== Save mysql database ==========='. "\n";
|
||||
$user = posix_getpwuid(fileowner($destDir . '/wakka.config.php'))['name'];
|
||||
$sudo = 'sudo -u ' . $user . ' ';
|
||||
$wakkaConfig = [];
|
||||
include_once($destDir.'/wakka.config.php');
|
||||
exec($sudo . 'mysqldump -u'.$wakkaConfig['mysql_user'].' -p'.$wakkaConfig['mysql_password'].' '.$wakkaConfig['mysql_database'].' '.$wakkaConfig['table_prefix'].'acls, '.$wakkaConfig['table_prefix'].'links '.$wakkaConfig['table_prefix'].'nature '.$wakkaConfig['table_prefix'].'pages '.$wakkaConfig['table_prefix'].'referrers '.$wakkaConfig['table_prefix'].'triples '.$wakkaConfig['table_prefix'].'usersname > ' . $destDir.'/database.sql');
|
||||
|
||||
}
|
||||
|
||||
function upgradeWiki($srcDir, $destDir)
|
||||
{
|
||||
$filesToMove = ['actions', 'cache', 'custom', 'docker', 'docs', 'files', 'formatters', 'handlers', 'includes', 'javascripts', 'lang', 'private', 'setup', 'styles', 'templates', 'tests', 'themes', 'tools', 'vendor', 'docker-compose.yml', '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'];
|
||||
$filesToCopy = ['wakka.config.php'];
|
||||
$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'];
|
||||
$filesToCopy = ['files', 'custom', 'wakka.config.php'];
|
||||
$bars = '============' . "\n";
|
||||
$output = '== Update wiki in path: ' . $destDir . ' ' . $bars;
|
||||
$user = posix_getpwuid(fileowner($destDir . '/wakka.config.php'))['name'];
|
||||
$sudo = 'sudo -u ' . $user . ' ';
|
||||
$tmpbackupDir = $destDir . '/tmpbackup';
|
||||
$wakkaConfig = [];
|
||||
include_once($destDir.'/wakka.config.php');
|
||||
$tmpbackupDir = '/root/yeswiki_backups/'.str_replace(['https://', 'http://', '/?', '/'], ['','','','-'], $wakkaConfig['base_url']);
|
||||
if (is_dir($tmpbackupDir)) {
|
||||
$output .= 'ERROR: found existing backup in "' . $tmpbackupDir . '" aborting' . "\n";
|
||||
return $output;
|
||||
exit($output);
|
||||
return;
|
||||
} else {
|
||||
exec($sudo . 'mkdir -p ' . $tmpbackupDir);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue