Remove references to Phrasea Indexer.

This commit is contained in:
Benoît Burnichon
2015-03-23 18:13:58 +01:00
parent ba73c38b3c
commit ef68007132
15 changed files with 7 additions and 204 deletions

View File

@@ -57,7 +57,6 @@ main:
mp4box_binary: null mp4box_binary: null
pdftotext_binary: null pdftotext_binary: null
recess_binary: null recess_binary: null
phraseanet_indexer: null
ffmpeg_timeout: 3600 ffmpeg_timeout: 3600
ffprobe_timeout: 60 ffprobe_timeout: 60
gs_timeout: 60 gs_timeout: 60

View File

@@ -316,7 +316,6 @@ class Install extends Command
{ {
return [ return [
'php_binary' => $this->executableFinder->find('php'), 'php_binary' => $this->executableFinder->find('php'),
'phraseanet_indexer' => $this->executableFinder->find('phraseanet_indexer'),
'pdf2swf_binary' => $this->executableFinder->find('pdf2swf'), 'pdf2swf_binary' => $this->executableFinder->find('pdf2swf'),
'swf_extract_binary' => $this->executableFinder->find('swfextract'), 'swf_extract_binary' => $this->executableFinder->find('swfextract'),
'swf_render_binary' => $this->executableFinder->find('swfrender'), 'swf_render_binary' => $this->executableFinder->find('swfrender'),

View File

@@ -204,7 +204,6 @@ class Setup implements ControllerProviderInterface
$binaryData = []; $binaryData = [];
foreach ([ foreach ([
'php_binary' => $request->request->get('binary_php'), 'php_binary' => $request->request->get('binary_php'),
'phraseanet_indexer' => $request->request->get('binary_phraseanet_indexer'),
'swf_extract_binary' => $request->request->get('binary_swfextract'), 'swf_extract_binary' => $request->request->get('binary_swfextract'),
'pdf2swf_binary' => $request->request->get('binary_pdf2swf'), 'pdf2swf_binary' => $request->request->get('binary_pdf2swf'),
'swf_render_binary' => $request->request->get('binary_swfrender'), 'swf_render_binary' => $request->request->get('binary_swfrender'),

View File

@@ -16,7 +16,6 @@ use Alchemy\Phrasea\TaskManager\Job\ArchiveJob;
use Alchemy\Phrasea\TaskManager\Job\BridgeJob; use Alchemy\Phrasea\TaskManager\Job\BridgeJob;
use Alchemy\Phrasea\TaskManager\Job\FtpPullJob; use Alchemy\Phrasea\TaskManager\Job\FtpPullJob;
use Alchemy\Phrasea\TaskManager\Job\IndexerJob; use Alchemy\Phrasea\TaskManager\Job\IndexerJob;
use Alchemy\Phrasea\TaskManager\Job\PhraseanetIndexerJob;
use Alchemy\Phrasea\TaskManager\Job\RecordMoverJob; use Alchemy\Phrasea\TaskManager\Job\RecordMoverJob;
use Alchemy\Phrasea\TaskManager\Job\SubdefsJob; use Alchemy\Phrasea\TaskManager\Job\SubdefsJob;
use Alchemy\Phrasea\TaskManager\Job\WebhookJob; use Alchemy\Phrasea\TaskManager\Job\WebhookJob;
@@ -74,7 +73,6 @@ class TasksServiceProvider implements ServiceProviderInterface
new ArchiveJob($app['dispatcher'], $logger, $app['translator']), new ArchiveJob($app['dispatcher'], $logger, $app['translator']),
new BridgeJob($app['dispatcher'], $logger, $app['translator']), new BridgeJob($app['dispatcher'], $logger, $app['translator']),
new FtpPullJob($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 RecordMoverJob($app['dispatcher'], $logger, $app['translator']),
new SubdefsJob($app['dispatcher'], $logger, $app['translator']), new SubdefsJob($app['dispatcher'], $logger, $app['translator']),
new WriteMetadataJob($app['dispatcher'], $logger, $app['translator']), new WriteMetadataJob($app['dispatcher'], $logger, $app['translator']),

View File

@@ -15,6 +15,7 @@ use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\PhraseaEvents; use Alchemy\Phrasea\Core\PhraseaEvents;
use Alchemy\Phrasea\Core\Event\InstallFinishEvent; use Alchemy\Phrasea\Core\Event\InstallFinishEvent;
use Alchemy\Phrasea\Model\Entities\User; use Alchemy\Phrasea\Model\Entities\User;
use Alchemy\Phrasea\TaskManager\Job\JobInterface;
use Doctrine\DBAL\Driver\Connection; use Doctrine\DBAL\Driver\Connection;
use Doctrine\DBAL\DBALException; use Doctrine\DBAL\DBALException;
use Doctrine\ORM\Tools\SchemaTool; 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); $job = $this->app['task-manager.job-factory']->create($jobName);
$this->app['manipulator.task']->create( $this->app['manipulator.task']->create(
$job->getName(), $job->getName(),

View File

@@ -1,171 +0,0 @@
<?php
/*
* This file is part of Phraseanet
*
* (c) 2005-2014 Alchemy
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Alchemy\Phrasea\TaskManager\Job;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Exception\RuntimeException;
use Alchemy\Phrasea\TaskManager\Editor\PhraseanetIndexerEditor;
use Alchemy\Phrasea\TaskManager\Event\PhraseanetIndexerStopperSubscriber;
use Alchemy\Phrasea\Model\Entities\Task;
use Symfony\Component\Process\ProcessBuilder;
class PhraseanetIndexerJob extends AbstractJob
{
/**
* {@inheritdoc}
*/
public function getName()
{
return $this->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;
}
}

View File

@@ -59,7 +59,6 @@ main:
mp4box_binary: null mp4box_binary: null
pdftotext_binary: null pdftotext_binary: null
recess_binary: null recess_binary: null
phraseanet_indexer: null
ffmpeg_timeout: 3600 ffmpeg_timeout: 3600
ffprobe_timeout: 60 ffprobe_timeout: 60
gs_timeout: 60 gs_timeout: 60

View File

@@ -64,7 +64,6 @@ main:
mp4box_binary: null mp4box_binary: null
pdftotext_binary: null pdftotext_binary: null
recess_binary: null recess_binary: null
phraseanet_indexer: null
ffmpeg_timeout: 3600 ffmpeg_timeout: 3600
ffprobe_timeout: 60 ffprobe_timeout: 60
gs_timeout: 60 gs_timeout: 60

View File

@@ -89,13 +89,9 @@ sudo sh -c 'ln -s ../../mods-available/twig.ini /etc/php5/fpm/conf.d/20-twig.ini
# ZMQ php extension # ZMQ php extension
# The empty string is important as zmq asks for specific directory # 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 '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/cli/conf.d/20-zmq.ini'
sudo sh -c 'ln -s ../../mods-available/zmq.ini /etc/php5/fpm/conf.d/20-zmq.ini' sudo sh -c 'ln -s ../../mods-available/zmq.ini /etc/php5/fpm/conf.d/20-zmq.ini'
fi
# swftools # swftools
cd /tmp cd /tmp

View File

@@ -385,7 +385,7 @@
<table class="main_content_table"> <table class="main_content_table">
{% for key,binary in discovered_binaries %} {% for key,binary in discovered_binaries %}
{% set required = '0' %} {% 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' %} {% set required = '1' %}
{% endif %} {% endif %}
<tr> <tr>

View File

@@ -155,7 +155,6 @@ class SetupTest extends \PhraseanetWebTestCase
'db_name' => $dbName, 'db_name' => $dbName,
'db_template' => 'en', 'db_template' => 'en',
'create_task' => array(), 'create_task' => array(),
'binary_phraseanet_indexer' => '/path/to/phraseanet_indexer',
); );
$client->request('POST', '/setup/installer/install/', $params); $client->request('POST', '/setup/installer/install/', $params);

View File

@@ -59,7 +59,6 @@ main:
mp4box_binary: null mp4box_binary: null
pdftotext_binary: null pdftotext_binary: null
recess_binary: null recess_binary: null
phraseanet_indexer: null
ffmpeg_timeout: 3600 ffmpeg_timeout: 3600
ffprobe_timeout: 60 ffprobe_timeout: 60
gs_timeout: 60 gs_timeout: 60

View File

@@ -74,7 +74,6 @@ main:
mp4box_binary: null mp4box_binary: null
pdftotext_binary: null pdftotext_binary: null
recess_binary: null recess_binary: null
phraseanet_indexer: null
ffmpeg_timeout: 3600 ffmpeg_timeout: 3600
ffprobe_timeout: 60 ffprobe_timeout: 60
gs_timeout: 60 gs_timeout: 60

View File

@@ -59,7 +59,6 @@ main:
mp4box_binary: null mp4box_binary: null
pdftotext_binary: null pdftotext_binary: null
recess_binary: null recess_binary: null
phraseanet_indexer: null
ffmpeg_timeout: 3600 ffmpeg_timeout: 3600
ffprobe_timeout: 60 ffprobe_timeout: 60
gs_timeout: 60 gs_timeout: 60

View File

@@ -1,13 +0,0 @@
<?php
namespace Alchemy\Tests\Phrasea\TaskManager\Job;
use Alchemy\Phrasea\TaskManager\Job\PhraseanetIndexerJob;
class PhraseanetIndexerJobTest extends JobTestCase
{
protected function getJob()
{
return new PhraseanetIndexerJob(null, null, $this->createTranslatorMock());
}
}