This commit is contained in:
parent
450dda6997
commit
ff56e0fb09
1 changed files with 12 additions and 12 deletions
|
@ -307,15 +307,14 @@ function removePhpFpmConfig($user)
|
|||
unlink($phpConfFile);
|
||||
exec('service ' . $_SERVER['phpservice'] . ' reload', $output);
|
||||
}
|
||||
function saveSql($srcDir, $destDir)
|
||||
function saveSql($wikiDir, $backuptDir)
|
||||
{
|
||||
$output = '== Save mysql database ==========='. "\n";
|
||||
$user = posix_getpwuid(fileowner($destDir . '/wakka.config.php'))['name'];
|
||||
$user = posix_getpwuid(fileowner($wikiDir . '/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');
|
||||
|
||||
include_once($wikiDir.'/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 > ' . $backupDir.'/database.sql');
|
||||
return '== Mysql database saved in '.$backupDir.'/database.sql ==========='. "\n";
|
||||
}
|
||||
|
||||
function upgradeWiki($srcDir, $destDir)
|
||||
|
@ -334,24 +333,25 @@ function upgradeWiki($srcDir, $destDir)
|
|||
exit($output);
|
||||
return;
|
||||
} else {
|
||||
exec($sudo . 'mkdir -p ' . $tmpbackupDir);
|
||||
exec('mkdir -p ' . $tmpbackupDir);
|
||||
}
|
||||
$output .= '==== Move files to temporary backup dir ' . $tmpbackupDir . ' ' . $bars;
|
||||
foreach ($filesToMove as $f) {
|
||||
if (file_exists($destDir . '/' . $f)) {
|
||||
exec($sudo . 'mv ' . $destDir . '/' . $f . ' ' . $tmpbackupDir . '/' . $f);
|
||||
exec('mv ' . $destDir . '/' . $f . ' ' . $tmpbackupDir . '/' . $f);
|
||||
} else {
|
||||
$output .= 'File not found "' . $f . '"' . "\n";
|
||||
}
|
||||
}
|
||||
foreach ($filesToCopy as $f) {
|
||||
if (file_exists($destDir . '/' . $f)) {
|
||||
exec($sudo . 'cp -rf ' . $destDir . '/' . $f . ' ' . $tmpbackupDir . '/' . $f);
|
||||
exec('cp -rf ' . $destDir . '/' . $f . ' ' . $tmpbackupDir . '/' . $f);
|
||||
} else {
|
||||
$output .= 'File not found "' . $f . '"' . "\n";
|
||||
}
|
||||
}
|
||||
$output .= '==== End Move files to temporary backup dir ' . $tmpbackupDir . ' ' . $bars;
|
||||
$output .= saveSql($destDir, $tmpbackupDir);
|
||||
$output .= '==== Update to latest sources ' . $bars;
|
||||
foreach ($filesToMove as $f) {
|
||||
if (file_exists($srcDir . '/' . $f)) {
|
||||
|
@ -360,15 +360,15 @@ function upgradeWiki($srcDir, $destDir)
|
|||
$output .= 'File not found "' . $f . '"' . "\n";
|
||||
}
|
||||
}
|
||||
runMigrations($sudo, $destDir);
|
||||
runUpgrades($sudo, $destDir);
|
||||
$output .= '==== End Update to latest sources ' . $bars;
|
||||
$output .= '== End update wiki in path: ' . $destDir . ' ' . $bars;
|
||||
return $output;
|
||||
}
|
||||
|
||||
function runMigrations($sudo, $destDir)
|
||||
function runUpgrades($sudo, $destDir)
|
||||
{
|
||||
exec('pushd '.$destDir.' && '.$sudo.' ./yeswicli migrate && popd');
|
||||
exec('pushd '.$destDir.' && '.$sudo.' ./yeswicli upgrade && '.$sudo.' ./yeswicli migrate && popd');
|
||||
}
|
||||
|
||||
function copyYesWikiFiles($domain, $user, $dbUser, $herseUser = null, $hersePass = null, $nossl = null)
|
||||
|
|
Loading…
Add table
Reference in a new issue