From 71b4c483c2e8edd0d59bd73b9b36459bf84a4c59 Mon Sep 17 00:00:00 2001 From: fogelito Date: Tue, 8 Aug 2023 15:39:50 +0300 Subject: [PATCH] chown --- src/Appwrite/Platform/Tasks/Restore.php | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Appwrite/Platform/Tasks/Restore.php b/src/Appwrite/Platform/Tasks/Restore.php index 35cb03a8aa..c36ea3f9cc 100644 --- a/src/Appwrite/Platform/Tasks/Restore.php +++ b/src/Appwrite/Platform/Tasks/Restore.php @@ -95,6 +95,7 @@ class Restore extends Action $this->decompress($files); $this->prepare($files); $this->restore($files, $cloud, $datadir); + //$this->chown($datadir); //todo: chown: unknown user/group mysql:mysql $this->log('Restore Finish in ' . (microtime(true) - $start) . ' seconds'); } @@ -234,10 +235,19 @@ class Restore extends Action Console::error('Restore failed'); Console::exit(); } + } - unlink($logfile); - - // todo: Do we need to chown -R mysql:mysql /var/lib/mysql? + public function chown(string $datadir) + { + $stderr = ''; + $stdout = ''; + $cmd = 'chown -R mysql:mysql ' . $datadir; + $this->log($cmd); + Console::execute($cmd, '', $stdout, $stderr); + if (!empty($stderr)) { + Console::error($stderr); + Console::exit(); + } } public function checkEnvVariables(): void