From 1106e286030e83a3e135527aa110545b312a1350 Mon Sep 17 00:00:00 2001 From: Jean-Yves Gaulier Date: Thu, 2 Apr 2020 14:57:05 +0200 Subject: [PATCH 01/10] PHRAS-3008_multiple-definitions-warnings_4.1 - fix : removed composer.phar after plugin add. --- lib/Alchemy/Phrasea/Plugin/Management/ComposerInstaller.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/Alchemy/Phrasea/Plugin/Management/ComposerInstaller.php b/lib/Alchemy/Phrasea/Plugin/Management/ComposerInstaller.php index 738e357fdc..17aba29f79 100644 --- a/lib/Alchemy/Phrasea/Plugin/Management/ComposerInstaller.php +++ b/lib/Alchemy/Phrasea/Plugin/Management/ComposerInstaller.php @@ -33,6 +33,11 @@ class ComposerInstaller $this->composer = $pluginsDirectory . DIRECTORY_SEPARATOR . 'composer.phar'; } + public function __destruct() + { + @unlink($this->composer); + } + public function install($directory) { $process = $this->createProcessBuilder() From d8d7c7de51db26886c609a66107206359d5212f3 Mon Sep 17 00:00:00 2001 From: aynsix Date: Wed, 8 Apr 2020 11:03:46 +0300 Subject: [PATCH 02/10] add more options during install --- config/configuration.sample.yml | 2 +- lib/Alchemy/Phrasea/Command/Setup/Install.php | 53 +++++++++++++++++++ .../Controller/Prod/UploadController.php | 4 +- lib/Alchemy/Phrasea/Media/SubdefGenerator.php | 2 +- lib/Alchemy/Phrasea/Setup/Installer.php | 3 -- lib/conf.d/configuration.yml | 2 +- 6 files changed, 58 insertions(+), 8 deletions(-) diff --git a/config/configuration.sample.yml b/config/configuration.sample.yml index 9bbea0d4bc..a912e61876 100644 --- a/config/configuration.sample.yml +++ b/config/configuration.sample.yml @@ -111,7 +111,7 @@ main: download: null lazaret: null caption: null - tmp_files: null + worker_tmp_files: null border-manager: enabled: true extension-mapping: diff --git a/lib/Alchemy/Phrasea/Command/Setup/Install.php b/lib/Alchemy/Phrasea/Command/Setup/Install.php index 8e211a9284..24eb8b64a2 100644 --- a/lib/Alchemy/Phrasea/Command/Setup/Install.php +++ b/lib/Alchemy/Phrasea/Command/Setup/Install.php @@ -55,6 +55,11 @@ class Install extends Command ->addOption('es-host', null, InputOption::VALUE_OPTIONAL, 'ElasticSearch server HTTP host', 'localhost') ->addOption('es-port', null, InputOption::VALUE_OPTIONAL, 'ElasticSearch server HTTP port', 9200) ->addOption('es-index', null, InputOption::VALUE_OPTIONAL, 'ElasticSearch index name', null) + ->addOption('download-path', null, InputOption::VALUE_OPTIONAL, 'Path to download repository', '/var/alchemy/Phraseanet/tmp/download') + ->addOption('lazaret-path', null, InputOption::VALUE_OPTIONAL, 'Path to lazaret repository', '/var/alchemy/Phraseanet/tmp/lazaret') + ->addOption('caption-path', null, InputOption::VALUE_OPTIONAL, 'Path to caption repository', '/var/alchemy/Phraseanet/tmp/caption') + ->addOption('scheduler-locks-path', null, InputOption::VALUE_OPTIONAL, 'Path to scheduler-locks repository', '/var/alchemy/Phraseanet/tmp/locks') + ->addOption('worker-tmp-files', null, InputOption::VALUE_OPTIONAL, 'Path to worker-tmp-files repository', '/var/alchemy/Phraseanet/tmp') ->addOption('yes', 'y', InputOption::VALUE_NONE, 'Answer yes to all questions'); return $this; @@ -151,6 +156,7 @@ class Install extends Command $this->container['phraseanet.installer']->install($email, $password, $abConn, $serverName, $dataPath, $dbConn, $templateName, $this->detectBinaries()); $this->container['conf']->set(['main', 'search-engine', 'options'], $esOptions->toArray()); + $this->defineStorageTmpPath($input); if (null !== $this->getApplication()) { $command = $this->getApplication()->find('crossdomain:generate'); @@ -387,6 +393,53 @@ class Install extends Command return $index; } + private function defineStorageTmpPath(InputInterface $input) + { + $downloadPath = $input->getOption('download-path'); + + if (!is_dir($downloadPath)) { + mkdir($downloadPath, 0755, true); + } + + $lazaretPath = $input->getOption('lazaret-path'); + + if (!is_dir($lazaretPath)) { + mkdir($lazaretPath, 0755, true); + } + + $captionPath = $input->getOption('caption-path'); + + if (!is_dir($captionPath)) { + mkdir($captionPath, 0755, true); + } + + $workerTmpFiles = $input->getOption('worker-tmp-files'); + + if (!is_dir($workerTmpFiles)) { + mkdir($workerTmpFiles, 0755, true); + } + + + $schedulerLocksPath = $input->getOption('scheduler-locks-path'); + + if (!is_dir($schedulerLocksPath)) { + mkdir($schedulerLocksPath, 0755, true); + } + + if (($schedulerLocksPath = realpath($schedulerLocksPath)) === FALSE) { + throw new \InvalidArgumentException(sprintf('Path %s does not exist.', $schedulerLocksPath)); + } + + $config = $this->container['configuration.store']->initialize()->getConfig(); + + $config['main']['storage']['download'] = realpath($downloadPath); + $config['main']['storage']['lazaret'] = realpath($lazaretPath); + $config['main']['storage']['caption'] = realpath($captionPath); + $config['main']['storage']['worker_tmp_files'] = realpath($workerTmpFiles); + + $this->container['configuration.store']->setConfig($config); + } + private function detectBinaries() { return [ diff --git a/lib/Alchemy/Phrasea/Controller/Prod/UploadController.php b/lib/Alchemy/Phrasea/Controller/Prod/UploadController.php index 27d18d5473..15cadafa52 100644 --- a/lib/Alchemy/Phrasea/Controller/Prod/UploadController.php +++ b/lib/Alchemy/Phrasea/Controller/Prod/UploadController.php @@ -181,8 +181,8 @@ class UploadController extends Controller $uploadedFilename = $file->getRealPath(); $renamedFilename = null; - if(!empty($this->app['conf']->get(['main', 'storage', 'tmp_files']))) { - $tmpStorage = \p4string::addEndSlash($this->app['conf']->get(['main', 'storage', 'tmp_files'])).'upload/'; + if(!empty($this->app['conf']->get(['main', 'storage', 'worker_tmp_files']))) { + $tmpStorage = \p4string::addEndSlash($this->app['conf']->get(['main', 'storage', 'worker_tmp_files'])).'upload/'; if(!is_dir($tmpStorage)){ $this->getFilesystem()->mkdir($tmpStorage); diff --git a/lib/Alchemy/Phrasea/Media/SubdefGenerator.php b/lib/Alchemy/Phrasea/Media/SubdefGenerator.php index 9612e3bc19..b6ebba31f3 100644 --- a/lib/Alchemy/Phrasea/Media/SubdefGenerator.php +++ b/lib/Alchemy/Phrasea/Media/SubdefGenerator.php @@ -57,7 +57,7 @@ class SubdefGenerator $this->filesystem = $filesystem; $this->logger = $logger; $this->mediavorus = $mediavorus; - $this->tmpDirectory = $this->app['conf']->get(['main', 'storage', 'tmp_files']);; + $this->tmpDirectory = $this->app['conf']->get(['main', 'storage', 'worker_tmp_files']);; } public function generateSubdefs(\record_adapter $record, array $wanted_subdefs = null) diff --git a/lib/Alchemy/Phrasea/Setup/Installer.php b/lib/Alchemy/Phrasea/Setup/Installer.php index 9c750d6cc7..d9e6fd404a 100644 --- a/lib/Alchemy/Phrasea/Setup/Installer.php +++ b/lib/Alchemy/Phrasea/Setup/Installer.php @@ -211,9 +211,6 @@ class Installer $config['main']['storage']['cache'] = realpath(__DIR__ . '/../../../../cache'); $config['main']['storage']['log'] = realpath(__DIR__ . '/../../../../logs'); - $config['main']['storage']['download'] = realpath(__DIR__ . '/../../../../tmp/download'); - $config['main']['storage']['lazaret'] = realpath(__DIR__ . '/../../../../tmp/lazaret'); - $config['main']['storage']['caption'] = realpath(__DIR__ . '/../../../../tmp/caption'); $config['registry'] = $this->app['registry.manipulator']->getRegistryData(); diff --git a/lib/conf.d/configuration.yml b/lib/conf.d/configuration.yml index f237b8318f..bcb496eb31 100644 --- a/lib/conf.d/configuration.yml +++ b/lib/conf.d/configuration.yml @@ -111,7 +111,7 @@ main: download: null lazaret: null caption: null - tmp_files: null + worker_tmp_files: null trusted-proxies: [] debugger: From d34c28703969c30611dfa346ba62d6672d604420 Mon Sep 17 00:00:00 2001 From: aynsix Date: Wed, 8 Apr 2020 12:05:27 +0300 Subject: [PATCH 03/10] use default relatif path --- lib/Alchemy/Phrasea/Command/Setup/Install.php | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/lib/Alchemy/Phrasea/Command/Setup/Install.php b/lib/Alchemy/Phrasea/Command/Setup/Install.php index 24eb8b64a2..858aabd35c 100644 --- a/lib/Alchemy/Phrasea/Command/Setup/Install.php +++ b/lib/Alchemy/Phrasea/Command/Setup/Install.php @@ -55,11 +55,11 @@ class Install extends Command ->addOption('es-host', null, InputOption::VALUE_OPTIONAL, 'ElasticSearch server HTTP host', 'localhost') ->addOption('es-port', null, InputOption::VALUE_OPTIONAL, 'ElasticSearch server HTTP port', 9200) ->addOption('es-index', null, InputOption::VALUE_OPTIONAL, 'ElasticSearch index name', null) - ->addOption('download-path', null, InputOption::VALUE_OPTIONAL, 'Path to download repository', '/var/alchemy/Phraseanet/tmp/download') - ->addOption('lazaret-path', null, InputOption::VALUE_OPTIONAL, 'Path to lazaret repository', '/var/alchemy/Phraseanet/tmp/lazaret') - ->addOption('caption-path', null, InputOption::VALUE_OPTIONAL, 'Path to caption repository', '/var/alchemy/Phraseanet/tmp/caption') - ->addOption('scheduler-locks-path', null, InputOption::VALUE_OPTIONAL, 'Path to scheduler-locks repository', '/var/alchemy/Phraseanet/tmp/locks') - ->addOption('worker-tmp-files', null, InputOption::VALUE_OPTIONAL, 'Path to worker-tmp-files repository', '/var/alchemy/Phraseanet/tmp') + ->addOption('download-path', null, InputOption::VALUE_OPTIONAL, 'Path to download repository', __DIR__ . '/../../../../../tmp/download') + ->addOption('lazaret-path', null, InputOption::VALUE_OPTIONAL, 'Path to lazaret repository', __DIR__ . '/../../../../../tmp/lazaret') + ->addOption('caption-path', null, InputOption::VALUE_OPTIONAL, 'Path to caption repository', __DIR__ . '/../../../../../tmp/caption') + ->addOption('scheduler-locks-path', null, InputOption::VALUE_OPTIONAL, 'Path to scheduler-locks repository', __DIR__ . '/../../../../../tmp/locks') + ->addOption('worker-tmp-files', null, InputOption::VALUE_OPTIONAL, 'Path to worker-tmp-files repository', __DIR__ . '/../../../../../tmp') ->addOption('yes', 'y', InputOption::VALUE_NONE, 'Answer yes to all questions'); return $this; @@ -430,14 +430,10 @@ class Install extends Command throw new \InvalidArgumentException(sprintf('Path %s does not exist.', $schedulerLocksPath)); } - $config = $this->container['configuration.store']->initialize()->getConfig(); - - $config['main']['storage']['download'] = realpath($downloadPath); - $config['main']['storage']['lazaret'] = realpath($lazaretPath); - $config['main']['storage']['caption'] = realpath($captionPath); - $config['main']['storage']['worker_tmp_files'] = realpath($workerTmpFiles); - - $this->container['configuration.store']->setConfig($config); + $this->container['conf']->set(['main', 'storage', 'download'], realpath($downloadPath)); + $this->container['conf']->set(['main', 'storage', 'lazaret'], realpath($lazaretPath)); + $this->container['conf']->set(['main', 'storage', 'caption'], realpath($captionPath)); + $this->container['conf']->set(['main', 'storage', 'worker_tmp_files'], realpath($workerTmpFiles)); } private function detectBinaries() From c261a28c348dd8ceff03ad4f4b992744a39a21fd Mon Sep 17 00:00:00 2001 From: aynsix Date: Wed, 8 Apr 2020 12:18:34 +0300 Subject: [PATCH 04/10] add Install.php --- lib/Alchemy/Phrasea/Command/Setup/Install.php | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/lib/Alchemy/Phrasea/Command/Setup/Install.php b/lib/Alchemy/Phrasea/Command/Setup/Install.php index 4682eda55a..8648190cae 100644 --- a/lib/Alchemy/Phrasea/Command/Setup/Install.php +++ b/lib/Alchemy/Phrasea/Command/Setup/Install.php @@ -55,6 +55,11 @@ class Install extends Command ->addOption('es-host', null, InputOption::VALUE_OPTIONAL, 'ElasticSearch server HTTP host', 'localhost') ->addOption('es-port', null, InputOption::VALUE_OPTIONAL, 'ElasticSearch server HTTP port', 9200) ->addOption('es-index', null, InputOption::VALUE_OPTIONAL, 'ElasticSearch index name', null) + ->addOption('download-path', null, InputOption::VALUE_OPTIONAL, 'Path to download repository', __DIR__ . '/../../../../../tmp/download') + ->addOption('lazaret-path', null, InputOption::VALUE_OPTIONAL, 'Path to lazaret repository', __DIR__ . '/../../../../../tmp/lazaret') + ->addOption('caption-path', null, InputOption::VALUE_OPTIONAL, 'Path to caption repository', __DIR__ . '/../../../../../tmp/caption') + ->addOption('scheduler-locks-path', null, InputOption::VALUE_OPTIONAL, 'Path to scheduler-locks repository', __DIR__ . '/../../../../../tmp/locks') + ->addOption('worker-tmp-files', null, InputOption::VALUE_OPTIONAL, 'Path to worker-tmp-files repository', __DIR__ . '/../../../../../tmp') ->addOption('yes', 'y', InputOption::VALUE_NONE, 'Answer yes to all questions') ->setHelp("Phraseanet can only be installed on 64 bits PHP."); ; @@ -161,6 +166,7 @@ class Install extends Command $this->container['phraseanet.installer']->install($email, $password, $abConn, $serverName, $dataPath, $dbConn, $templateName, $this->detectBinaries()); $this->container['conf']->set(['main', 'search-engine', 'options'], $esOptions->toArray()); + $this->defineStorageTmpPath($input); if (null !== $this->getApplication()) { $command = $this->getApplication()->find('crossdomain:generate'); @@ -397,6 +403,49 @@ class Install extends Command return $index; } + private function defineStorageTmpPath(InputInterface $input) + { + $downloadPath = $input->getOption('download-path'); + + if (!is_dir($downloadPath)) { + mkdir($downloadPath, 0755, true); + } + + $lazaretPath = $input->getOption('lazaret-path'); + + if (!is_dir($lazaretPath)) { + mkdir($lazaretPath, 0755, true); + } + + $captionPath = $input->getOption('caption-path'); + + if (!is_dir($captionPath)) { + mkdir($captionPath, 0755, true); + } + + $workerTmpFiles = $input->getOption('worker-tmp-files'); + + if (!is_dir($workerTmpFiles)) { + mkdir($workerTmpFiles, 0755, true); + } + + + $schedulerLocksPath = $input->getOption('scheduler-locks-path'); + + if (!is_dir($schedulerLocksPath)) { + mkdir($schedulerLocksPath, 0755, true); + } + + if (($schedulerLocksPath = realpath($schedulerLocksPath)) === FALSE) { + throw new \InvalidArgumentException(sprintf('Path %s does not exist.', $schedulerLocksPath)); + } + + $this->container['conf']->set(['main', 'storage', 'download'], realpath($downloadPath)); + $this->container['conf']->set(['main', 'storage', 'lazaret'], realpath($lazaretPath)); + $this->container['conf']->set(['main', 'storage', 'caption'], realpath($captionPath)); + $this->container['conf']->set(['main', 'storage', 'worker_tmp_files'], realpath($workerTmpFiles)); + } + private function detectBinaries() { return [ From 67381fa19832fe233e3b1cfe3aec5185e1dd155a Mon Sep 17 00:00:00 2001 From: aynsix Date: Wed, 8 Apr 2020 13:15:16 +0300 Subject: [PATCH 05/10] fix test --- tests/Alchemy/Tests/Phrasea/Command/Setup/InstallTest.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/Alchemy/Tests/Phrasea/Command/Setup/InstallTest.php b/tests/Alchemy/Tests/Phrasea/Command/Setup/InstallTest.php index f8e0a8b5a1..b79b50c591 100644 --- a/tests/Alchemy/Tests/Phrasea/Command/Setup/InstallTest.php +++ b/tests/Alchemy/Tests/Phrasea/Command/Setup/InstallTest.php @@ -72,6 +72,11 @@ class InstallTest extends \PhraseanetTestCase case 'password': return $password; break; + case 'download-path': + case 'lazaret-path': + case 'caption-path': + case 'scheduler-locks-path': + case 'worker-tmp-files': case 'data-path': return $dataPath; break; From 7accf0f99501df9b90f77ee96e1be3517af64576 Mon Sep 17 00:00:00 2001 From: aynsix Date: Wed, 8 Apr 2020 17:29:28 +0300 Subject: [PATCH 06/10] fix config storage --- lib/Alchemy/Phrasea/Command/Setup/Install.php | 42 +++++-------------- .../Phrasea/Controller/SetupController.php | 6 ++- lib/Alchemy/Phrasea/Setup/Installer.php | 32 ++++++++++---- .../Tests/Phrasea/Setup/InstallerTest.php | 2 +- 4 files changed, 39 insertions(+), 43 deletions(-) diff --git a/lib/Alchemy/Phrasea/Command/Setup/Install.php b/lib/Alchemy/Phrasea/Command/Setup/Install.php index 8648190cae..c4c34b870d 100644 --- a/lib/Alchemy/Phrasea/Command/Setup/Install.php +++ b/lib/Alchemy/Phrasea/Command/Setup/Install.php @@ -164,7 +164,9 @@ class Install extends Command } } - $this->container['phraseanet.installer']->install($email, $password, $abConn, $serverName, $dataPath, $dbConn, $templateName, $this->detectBinaries()); + $storagePaths = $this->getStoragePaths($input, $dataPath); + + $this->container['phraseanet.installer']->install($email, $password, $abConn, $serverName, $storagePaths, $dbConn, $templateName, $this->detectBinaries()); $this->container['conf']->set(['main', 'search-engine', 'options'], $esOptions->toArray()); $this->defineStorageTmpPath($input); @@ -403,33 +405,8 @@ class Install extends Command return $index; } - private function defineStorageTmpPath(InputInterface $input) + private function getStoragePaths(InputInterface $input, $dataPath) { - $downloadPath = $input->getOption('download-path'); - - if (!is_dir($downloadPath)) { - mkdir($downloadPath, 0755, true); - } - - $lazaretPath = $input->getOption('lazaret-path'); - - if (!is_dir($lazaretPath)) { - mkdir($lazaretPath, 0755, true); - } - - $captionPath = $input->getOption('caption-path'); - - if (!is_dir($captionPath)) { - mkdir($captionPath, 0755, true); - } - - $workerTmpFiles = $input->getOption('worker-tmp-files'); - - if (!is_dir($workerTmpFiles)) { - mkdir($workerTmpFiles, 0755, true); - } - - $schedulerLocksPath = $input->getOption('scheduler-locks-path'); if (!is_dir($schedulerLocksPath)) { @@ -440,10 +417,13 @@ class Install extends Command throw new \InvalidArgumentException(sprintf('Path %s does not exist.', $schedulerLocksPath)); } - $this->container['conf']->set(['main', 'storage', 'download'], realpath($downloadPath)); - $this->container['conf']->set(['main', 'storage', 'lazaret'], realpath($lazaretPath)); - $this->container['conf']->set(['main', 'storage', 'caption'], realpath($captionPath)); - $this->container['conf']->set(['main', 'storage', 'worker_tmp_files'], realpath($workerTmpFiles)); + return [ + 'subdefs' => $dataPath, + 'download' => $input->getOption('download-path'), + 'lazaret' => $input->getOption('lazaret-path'), + 'caption' => $input->getOption('caption-path'), + 'worker_tmp_files' => $input->getOption('worker-tmp-files') + ]; } private function detectBinaries() diff --git a/lib/Alchemy/Phrasea/Controller/SetupController.php b/lib/Alchemy/Phrasea/Controller/SetupController.php index 8e3b588326..af6cff5029 100644 --- a/lib/Alchemy/Phrasea/Controller/SetupController.php +++ b/lib/Alchemy/Phrasea/Controller/SetupController.php @@ -174,7 +174,9 @@ class SetupController extends Controller $email = $request->request->get('email'); $password = $request->request->get('password'); $template = $request->request->get('db_template'); - $dataPath = $request->request->get('datapath_noweb'); + $storagePath = [ + 'subdefs' => $request->request->get('datapath_noweb') + ]; try { $installer = $this->app['phraseanet.installer']; @@ -193,7 +195,7 @@ class SetupController extends Controller $binaryData[$key] = $path; } - $user = $installer->install($email, $password, $abConn, $servername, $dataPath, $dbConn, $template, $binaryData); + $user = $installer->install($email, $password, $abConn, $servername, $storagePath, $dbConn, $template, $binaryData); $this->app->getAuthenticator()->openAccount($user); diff --git a/lib/Alchemy/Phrasea/Setup/Installer.php b/lib/Alchemy/Phrasea/Setup/Installer.php index d9e6fd404a..670e6958bc 100644 --- a/lib/Alchemy/Phrasea/Setup/Installer.php +++ b/lib/Alchemy/Phrasea/Setup/Installer.php @@ -30,11 +30,11 @@ class Installer $this->app = $app; } - public function install($email, $password, Connection $abConn, $serverName, $dataPath, Connection $dbConn = null, $templateName = null, array $binaryData = []) + public function install($email, $password, Connection $abConn, $serverName, array $storagePaths, Connection $dbConn = null, $templateName = null, array $binaryData = []) { $this->rollbackInstall($abConn, $dbConn); - $this->createConfigFile($abConn, $serverName, $binaryData, $dataPath); + $this->createConfigFile($abConn, $serverName, $binaryData, $storagePaths); try { $this->createAB($abConn); $user = $this->createUser($email, $password); @@ -185,7 +185,7 @@ class Installer $this->app->getApplicationBox()->insert_datas($this->app); } - private function createConfigFile(Connection $abConn, $serverName, $binaryData, $dataPath) + private function createConfigFile(Connection $abConn, $serverName, $binaryData, array $storagePaths) { $config = $this->app['configuration.store']->initialize()->getConfig(); @@ -203,14 +203,28 @@ class Installer $config['servername'] = $serverName; $config['main']['key'] = $this->app['random.medium']->generateString(16); - if (null === $dataPath = realpath($dataPath)) { - throw new \InvalidArgumentException(sprintf('Path %s does not exist.', $dataPath)); + // define storage config + $defaultStoragePaths = [ + 'subdefs' => __DIR__ . '/../../../../datas', + 'cache' => __DIR__ . '/../../../../cache', + 'log' => __DIR__ . '/../../../../logs', + 'download' => __DIR__ . '/../../../../tmp/download', + 'lazaret' => __DIR__ . '/../../../../tmp/lazaret', + 'caption' => __DIR__ . '/../../../../tmp/caption', + 'worker_tmp_files' => __DIR__ . '/../../../../tmp/worker_tmp_files' + ]; + + $storagePaths = array_merge($defaultStoragePaths, $storagePaths); + + foreach ($storagePaths as $key => $path) { + if (!is_dir($path)) { + mkdir($path, 0755, true); + } + + $storagePaths[$key] = realpath($path); } - $config['main']['storage']['subdefs'] = $dataPath; - - $config['main']['storage']['cache'] = realpath(__DIR__ . '/../../../../cache'); - $config['main']['storage']['log'] = realpath(__DIR__ . '/../../../../logs'); + $config['main']['storage'] = $storagePaths; $config['registry'] = $this->app['registry.manipulator']->getRegistryData(); diff --git a/tests/Alchemy/Tests/Phrasea/Setup/InstallerTest.php b/tests/Alchemy/Tests/Phrasea/Setup/InstallerTest.php index c3a364c869..ea6d4890cc 100644 --- a/tests/Alchemy/Tests/Phrasea/Setup/InstallerTest.php +++ b/tests/Alchemy/Tests/Phrasea/Setup/InstallerTest.php @@ -75,7 +75,7 @@ class InstallerTest extends \PhraseanetTestCase $dataPath = __DIR__ . '/../../../../../datas/'; $installer = new Installer($app); - $installer->install(uniqid('admin') . '@example.com', 'sdfsdsd', $abConn, 'http://local.phrasea.test.installer/', $dataPath, $dbConn, 'en-simple'); + $installer->install(uniqid('admin') . '@example.com', 'sdfsdsd', $abConn, 'http://local.phrasea.test.installer/', ['subdefs' => $dataPath], $dbConn, 'en-simple'); $this->assertTrue($app['configuration.store']->isSetup()); $this->assertTrue($app['phraseanet.configuration-tester']->isUpToDate()); From 411b980000f528571812cd17eb84613ac7fa978b Mon Sep 17 00:00:00 2001 From: aynsix Date: Wed, 8 Apr 2020 17:36:07 +0300 Subject: [PATCH 07/10] fix default worker_tmp_files --- lib/Alchemy/Phrasea/Setup/Installer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Alchemy/Phrasea/Setup/Installer.php b/lib/Alchemy/Phrasea/Setup/Installer.php index 670e6958bc..74cb131e9b 100644 --- a/lib/Alchemy/Phrasea/Setup/Installer.php +++ b/lib/Alchemy/Phrasea/Setup/Installer.php @@ -211,7 +211,7 @@ class Installer 'download' => __DIR__ . '/../../../../tmp/download', 'lazaret' => __DIR__ . '/../../../../tmp/lazaret', 'caption' => __DIR__ . '/../../../../tmp/caption', - 'worker_tmp_files' => __DIR__ . '/../../../../tmp/worker_tmp_files' + 'worker_tmp_files' => __DIR__ . '/../../../../tmp' ]; $storagePaths = array_merge($defaultStoragePaths, $storagePaths); From 690a7998e69d84fb2979dd6c22319538f8dff3bc Mon Sep 17 00:00:00 2001 From: aynsix Date: Wed, 8 Apr 2020 17:40:58 +0300 Subject: [PATCH 08/10] fix --- lib/Alchemy/Phrasea/Command/Setup/Install.php | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/Alchemy/Phrasea/Command/Setup/Install.php b/lib/Alchemy/Phrasea/Command/Setup/Install.php index c4c34b870d..4f83162584 100644 --- a/lib/Alchemy/Phrasea/Command/Setup/Install.php +++ b/lib/Alchemy/Phrasea/Command/Setup/Install.php @@ -168,7 +168,6 @@ class Install extends Command $this->container['phraseanet.installer']->install($email, $password, $abConn, $serverName, $storagePaths, $dbConn, $templateName, $this->detectBinaries()); $this->container['conf']->set(['main', 'search-engine', 'options'], $esOptions->toArray()); - $this->defineStorageTmpPath($input); if (null !== $this->getApplication()) { $command = $this->getApplication()->find('crossdomain:generate'); From 7e242f81af8e3478bd6646e553fde73e6194bbaf Mon Sep 17 00:00:00 2001 From: aynsix Date: Wed, 8 Apr 2020 17:57:57 +0300 Subject: [PATCH 09/10] fix test --- tests/Alchemy/Tests/Phrasea/Command/Setup/InstallTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Alchemy/Tests/Phrasea/Command/Setup/InstallTest.php b/tests/Alchemy/Tests/Phrasea/Command/Setup/InstallTest.php index b79b50c591..5f94dbdb87 100644 --- a/tests/Alchemy/Tests/Phrasea/Command/Setup/InstallTest.php +++ b/tests/Alchemy/Tests/Phrasea/Command/Setup/InstallTest.php @@ -115,7 +115,7 @@ class InstallTest extends \PhraseanetTestCase self::$DI['cli']['phraseanet.installer']->expects($this->once()) ->method('install') - ->with($email, $password, $this->isInstanceOf('Doctrine\DBAL\Driver\Connection'), $serverName, $dataPath, $this->isInstanceOf('Doctrine\DBAL\Driver\Connection'), $template, $this->anything()); + ->with($email, $password, $this->isInstanceOf('Doctrine\DBAL\Driver\Connection'), $serverName, ['subdefs' => $dataPath], $this->isInstanceOf('Doctrine\DBAL\Driver\Connection'), $template, $this->anything()); $structureTemplate = self::$DI['cli']['phraseanet.structure-template']; From 6024d881e68bb02589e3e7b8b920b53e44f68d66 Mon Sep 17 00:00:00 2001 From: aynsix Date: Wed, 8 Apr 2020 19:36:11 +0300 Subject: [PATCH 10/10] fix test --- .../Alchemy/Tests/Phrasea/Command/Setup/InstallTest.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tests/Alchemy/Tests/Phrasea/Command/Setup/InstallTest.php b/tests/Alchemy/Tests/Phrasea/Command/Setup/InstallTest.php index 5f94dbdb87..e1b20fe3fb 100644 --- a/tests/Alchemy/Tests/Phrasea/Command/Setup/InstallTest.php +++ b/tests/Alchemy/Tests/Phrasea/Command/Setup/InstallTest.php @@ -36,6 +36,13 @@ class InstallTest extends \PhraseanetTestCase $password = 'sup4ssw0rd'; $serverName = 'http://phrasea.io'; $dataPath = '/tmp'; + $storagePaths = [ + 'subdefs' => $dataPath, + 'download' => $dataPath, + 'lazaret' => $dataPath, + 'caption' => $dataPath, + 'worker_tmp_files' => $dataPath + ]; $template = 'fr-simple'; $infoDb = Yaml::parse(file_get_contents(__DIR__ . '/../../../../../../resources/hudson/InstallDBs.yml')); @@ -115,7 +122,7 @@ class InstallTest extends \PhraseanetTestCase self::$DI['cli']['phraseanet.installer']->expects($this->once()) ->method('install') - ->with($email, $password, $this->isInstanceOf('Doctrine\DBAL\Driver\Connection'), $serverName, ['subdefs' => $dataPath], $this->isInstanceOf('Doctrine\DBAL\Driver\Connection'), $template, $this->anything()); + ->with($email, $password, $this->isInstanceOf('Doctrine\DBAL\Driver\Connection'), $serverName, $storagePaths, $this->isInstanceOf('Doctrine\DBAL\Driver\Connection'), $template, $this->anything()); $structureTemplate = self::$DI['cli']['phraseanet.structure-template'];