diff --git a/config/configuration.sample.yml b/config/configuration.sample.yml index 050676bca6..77e6bf76ff 100644 --- a/config/configuration.sample.yml +++ b/config/configuration.sample.yml @@ -57,7 +57,6 @@ main: mp4box_binary: null pdftotext_binary: null recess_binary: null - phraseanet_indexer: null ffmpeg_timeout: 3600 ffprobe_timeout: 60 gs_timeout: 60 diff --git a/lib/Alchemy/Phrasea/Command/Setup/Install.php b/lib/Alchemy/Phrasea/Command/Setup/Install.php index 961113eb4e..b2cca64d52 100644 --- a/lib/Alchemy/Phrasea/Command/Setup/Install.php +++ b/lib/Alchemy/Phrasea/Command/Setup/Install.php @@ -316,7 +316,6 @@ class Install extends Command { return [ 'php_binary' => $this->executableFinder->find('php'), - 'phraseanet_indexer' => $this->executableFinder->find('phraseanet_indexer'), 'pdf2swf_binary' => $this->executableFinder->find('pdf2swf'), 'swf_extract_binary' => $this->executableFinder->find('swfextract'), 'swf_render_binary' => $this->executableFinder->find('swfrender'), diff --git a/lib/Alchemy/Phrasea/Controller/Setup.php b/lib/Alchemy/Phrasea/Controller/Setup.php index 63d485dc45..7dc349f001 100644 --- a/lib/Alchemy/Phrasea/Controller/Setup.php +++ b/lib/Alchemy/Phrasea/Controller/Setup.php @@ -204,7 +204,6 @@ class Setup implements ControllerProviderInterface $binaryData = []; foreach ([ 'php_binary' => $request->request->get('binary_php'), - 'phraseanet_indexer' => $request->request->get('binary_phraseanet_indexer'), 'swf_extract_binary' => $request->request->get('binary_swfextract'), 'pdf2swf_binary' => $request->request->get('binary_pdf2swf'), 'swf_render_binary' => $request->request->get('binary_swfrender'), diff --git a/lib/Alchemy/Phrasea/Core/Provider/TasksServiceProvider.php b/lib/Alchemy/Phrasea/Core/Provider/TasksServiceProvider.php index b494781563..b01d9cb755 100644 --- a/lib/Alchemy/Phrasea/Core/Provider/TasksServiceProvider.php +++ b/lib/Alchemy/Phrasea/Core/Provider/TasksServiceProvider.php @@ -16,7 +16,6 @@ use Alchemy\Phrasea\TaskManager\Job\ArchiveJob; use Alchemy\Phrasea\TaskManager\Job\BridgeJob; use Alchemy\Phrasea\TaskManager\Job\FtpPullJob; use Alchemy\Phrasea\TaskManager\Job\IndexerJob; -use Alchemy\Phrasea\TaskManager\Job\PhraseanetIndexerJob; use Alchemy\Phrasea\TaskManager\Job\RecordMoverJob; use Alchemy\Phrasea\TaskManager\Job\SubdefsJob; use Alchemy\Phrasea\TaskManager\Job\WebhookJob; @@ -74,7 +73,6 @@ class TasksServiceProvider implements ServiceProviderInterface new ArchiveJob($app['dispatcher'], $logger, $app['translator']), new BridgeJob($app['dispatcher'], $logger, $app['translator']), new FtpPullJob($app['dispatcher'], $logger, $app['translator']), - new PhraseanetIndexerJob($app['dispatcher'], $logger, $app['translator']), new RecordMoverJob($app['dispatcher'], $logger, $app['translator']), new SubdefsJob($app['dispatcher'], $logger, $app['translator']), new WriteMetadataJob($app['dispatcher'], $logger, $app['translator']), diff --git a/lib/Alchemy/Phrasea/Setup/Installer.php b/lib/Alchemy/Phrasea/Setup/Installer.php index 99d9f34144..afb26efef8 100644 --- a/lib/Alchemy/Phrasea/Setup/Installer.php +++ b/lib/Alchemy/Phrasea/Setup/Installer.php @@ -15,6 +15,7 @@ use Alchemy\Phrasea\Application; use Alchemy\Phrasea\Core\PhraseaEvents; use Alchemy\Phrasea\Core\Event\InstallFinishEvent; use Alchemy\Phrasea\Model\Entities\User; +use Alchemy\Phrasea\TaskManager\Job\JobInterface; use Doctrine\DBAL\Driver\Connection; use Doctrine\DBAL\DBALException; use Doctrine\ORM\Tools\SchemaTool; @@ -82,7 +83,8 @@ class Installer ] ); - foreach (['PhraseanetIndexer', 'Subdefs', 'WriteMetadata'] as $jobName) { + foreach (['Subdefs', 'WriteMetadata'] as $jobName) { + /** @var JobInterface $job */ $job = $this->app['task-manager.job-factory']->create($jobName); $this->app['manipulator.task']->create( $job->getName(), diff --git a/lib/Alchemy/Phrasea/TaskManager/Job/PhraseanetIndexerJob.php b/lib/Alchemy/Phrasea/TaskManager/Job/PhraseanetIndexerJob.php deleted file mode 100644 index 8e08a75cb8..0000000000 --- a/lib/Alchemy/Phrasea/TaskManager/Job/PhraseanetIndexerJob.php +++ /dev/null @@ -1,171 +0,0 @@ -translator->trans("Phrasea indexation task"); - } - - /** - * {@inheritdoc} - */ - public function getJobId() - { - return 'PhraseanetIndexer'; - } - - /** - * {@inheritdoc} - */ - public function getDescription() - { - return $this->translator->trans("This task is used to index records for Phrasea engine."); - } - - /** - * {@inheritdoc} - */ - public function getEditor() - { - return new PhraseanetIndexerEditor($this->translator); - } - - /** - * {@inheritdoc} - */ - protected function doJob(JobData $data) - { - $app = $data->getApplication(); - $task = $data->getTask(); - - $settings = simplexml_load_string($task->getSettings()); - $socketPort = (integer) $settings->socket; - $indexerPath = $this->getPhraseanetIndexerPath($app); - - $builder = new ProcessBuilder($this->getCommandline($indexerPath, $app, $task)); - $builder - ->setWorkingDirectory(dirname($indexerPath)) - ->setTimeout(0); - $process = $builder->getProcess(); - - if (0 < $socketPort) { - $this->addSubscriber(new PhraseanetIndexerStopperSubscriber($socketPort)); - } - - $process->run(); - } - - private function getPhraseanetIndexerPath(Application $app) - { - $binaries = $app['conf']->get(['main', 'binaries']); - - if (isset($binaries['phraseanet_indexer'])) { - $path = $binaries['phraseanet_indexer']; - } else { - if (null === $binary = $app['executable-finder']->find('phraseanet_indexer')) { - // let's be careful, when an executable is not found, an exit code must be returned - // see documentation - throw new RuntimeException('Unable to find phraseanet indexer binary. Either set it up in the configuration, or update the PATH to allow auto detection.'); - } - $path = $binary; - } - - if (!is_executable($path)) { - throw new RuntimeException(sprintf('Phraseanet Indexer path `%s` does not seem to be executable. Please update configuration.', $path)); - } - - return $path; - } - - private function getCommandline($indexerPath, Application $app, Task $task) - { - $cmd = [$indexerPath, '-o']; - - $settings = simplexml_load_string($task->getSettings()); - - $host = trim($settings->host); - $port = (integer) $settings->port; - $base = trim($settings->base); - $user = trim($settings->user); - $password = trim($settings->password); - $socket = (integer) $settings->socket; - $charset = trim($settings->charset); - $stem = trim($settings->stem); - $sortempty = trim($settings->sortempty); - $debugmask = (integer) $settings->debugmask; - $nolog = \p4field::isyes(trim($settings->nolog)); - $winsvc_run = \p4field::isyes(trim($settings->winsvc_run)); - - if ('' !== $host) { - $cmd[] = '--host'; - $cmd[] = $host; - } - if (0 < $port) { - $cmd[] = '--port'; - $cmd[] = $port; - } - if ('' !== $base) { - $cmd[] = '--base'; - $cmd[] = $base; - } - if ('' !== $user) { - $cmd[] = '--user'; - $cmd[] = $user; - } - if ('' !== $password) { - $cmd[] = '--password'; - $cmd[] = $password; - } - if (0 < $socket) { - $cmd[] = '--socket'; - $cmd[] = $socket; - } - - if ('' !== $charset) { - $cmd[] = '--default-character-set'; - $cmd[] = $charset; - } - if ('' !== $stem) { - $cmd[] = '--stem'; - $cmd[] = $stem; - } - if ('' !== $sortempty) { - $cmd[] = '--sort-empty'; - $cmd[] = $sortempty; - } - if (0 < $debugmask) { - $cmd[] = '--debug'; - $cmd[] = $debugmask; - } - if ($nolog) { - $cmd[] = '--nolog'; - } - if ($winsvc_run) { - $cmd[] = '--run'; - } - - return $cmd; - } -} diff --git a/lib/conf.d/configuration.yml b/lib/conf.d/configuration.yml index 4af1bb984f..d77d2ae63b 100644 --- a/lib/conf.d/configuration.yml +++ b/lib/conf.d/configuration.yml @@ -59,7 +59,6 @@ main: mp4box_binary: null pdftotext_binary: null recess_binary: null - phraseanet_indexer: null ffmpeg_timeout: 3600 ffprobe_timeout: 60 gs_timeout: 60 diff --git a/resources/vagrant/config/phraseanet/configuration.yml b/resources/vagrant/config/phraseanet/configuration.yml index 45f848e3e1..12f2f36761 100644 --- a/resources/vagrant/config/phraseanet/configuration.yml +++ b/resources/vagrant/config/phraseanet/configuration.yml @@ -64,7 +64,6 @@ main: mp4box_binary: null pdftotext_binary: null recess_binary: null - phraseanet_indexer: null ffmpeg_timeout: 3600 ffprobe_timeout: 60 gs_timeout: 60 diff --git a/resources/vagrant/vms/phraseanet-php55-nginx/puphpet/files/exec-once/setup b/resources/vagrant/vms/phraseanet-php55-nginx/puphpet/files/exec-once/setup index 3d8e4509d4..9184f6ec0d 100644 --- a/resources/vagrant/vms/phraseanet-php55-nginx/puphpet/files/exec-once/setup +++ b/resources/vagrant/vms/phraseanet-php55-nginx/puphpet/files/exec-once/setup @@ -89,13 +89,9 @@ sudo sh -c 'ln -s ../../mods-available/twig.ini /etc/php5/fpm/conf.d/20-twig.ini # ZMQ php extension # The empty string is important as zmq asks for specific directory -yes '' | pecl install zmq-beta -if [ $? -eq 0 ] -then - sudo sh -c 'echo "extension=zmq.so" > /etc/php5/mods-available/zmq.ini' - sudo sh -c 'ln -s ../../mods-available/zmq.ini /etc/php5/cli/conf.d/20-zmq.ini' - sudo sh -c 'ln -s ../../mods-available/zmq.ini /etc/php5/fpm/conf.d/20-zmq.ini' -fi +sudo sh -c 'echo "extension=zmq.so" > /etc/php5/mods-available/zmq.ini' +sudo sh -c 'ln -s ../../mods-available/zmq.ini /etc/php5/cli/conf.d/20-zmq.ini' +sudo sh -c 'ln -s ../../mods-available/zmq.ini /etc/php5/fpm/conf.d/20-zmq.ini' # swftools cd /tmp diff --git a/templates/web/setup/step2.html.twig b/templates/web/setup/step2.html.twig index a331ae4e09..694272ca04 100644 --- a/templates/web/setup/step2.html.twig +++ b/templates/web/setup/step2.html.twig @@ -385,7 +385,7 @@ {% for key,binary in discovered_binaries %} {% set required = '0' %} - {% if key == 'php' or key == 'phraseanet_indexer' or key == 'convert' or key == 'composite' or key == 'exiftool' %} + {% if key == 'php' or key == 'convert' or key == 'composite' or key == 'exiftool' %} {% set required = '1' %} {% endif %} diff --git a/tests/Alchemy/Tests/Phrasea/Controller/SetupTest.php b/tests/Alchemy/Tests/Phrasea/Controller/SetupTest.php index 7d52ab3bbc..1386aa7a77 100644 --- a/tests/Alchemy/Tests/Phrasea/Controller/SetupTest.php +++ b/tests/Alchemy/Tests/Phrasea/Controller/SetupTest.php @@ -155,7 +155,6 @@ class SetupTest extends \PhraseanetWebTestCase 'db_name' => $dbName, 'db_template' => 'en', 'create_task' => array(), - 'binary_phraseanet_indexer' => '/path/to/phraseanet_indexer', ); $client->request('POST', '/setup/installer/install/', $params); diff --git a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml index 4af1bb984f..d77d2ae63b 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml +++ b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-setup.yml @@ -59,7 +59,6 @@ main: mp4box_binary: null pdftotext_binary: null recess_binary: null - phraseanet_indexer: null ffmpeg_timeout: 3600 ffprobe_timeout: 60 gs_timeout: 60 diff --git a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-with-hosts.yml b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-with-hosts.yml index 75f2378c7d..6a9a13532b 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-with-hosts.yml +++ b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration-with-hosts.yml @@ -74,7 +74,6 @@ main: mp4box_binary: null pdftotext_binary: null recess_binary: null - phraseanet_indexer: null ffmpeg_timeout: 3600 ffprobe_timeout: 60 gs_timeout: 60 diff --git a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml index 4af1bb984f..d77d2ae63b 100644 --- a/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml +++ b/tests/Alchemy/Tests/Phrasea/Core/Configuration/Fixtures/configuration.yml @@ -59,7 +59,6 @@ main: mp4box_binary: null pdftotext_binary: null recess_binary: null - phraseanet_indexer: null ffmpeg_timeout: 3600 ffprobe_timeout: 60 gs_timeout: 60 diff --git a/tests/Alchemy/Tests/Phrasea/TaskManager/Job/PhraseanetIndexerJobTest.php b/tests/Alchemy/Tests/Phrasea/TaskManager/Job/PhraseanetIndexerJobTest.php deleted file mode 100644 index d7814bdc6f..0000000000 --- a/tests/Alchemy/Tests/Phrasea/TaskManager/Job/PhraseanetIndexerJobTest.php +++ /dev/null @@ -1,13 +0,0 @@ -createTranslatorMock()); - } -}