Disable ZMQNotifier in setup_mode

This commit is contained in:
Benoît Burnichon
2015-03-24 16:06:27 +01:00
parent 3cc78d769a
commit e5f48a2f09
5 changed files with 11 additions and 27 deletions

View File

@@ -75,4 +75,6 @@ $app->command(new CheckEnvironment('check:system'));
$app->command(new Install('system:install'));
$app->command(new CrossDomainGenerator());
$app['phraseanet.setup_mode'] = true;
exit(is_int($app->run()) ? : 1);

View File

@@ -12,13 +12,13 @@
namespace Alchemy\Phrasea\Command\Setup;
use Alchemy\Phrasea\Command\Command;
use Symfony\Component\Console\Input\ArrayInput;
use Doctrine\DBAL\Driver\Connection;
use Symfony\Component\Console\Helper\DialogHelper;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Process\ExecutableFinder;
use Symfony\Component\Console\Helper\DialogHelper;
class Install extends Command
{
@@ -41,7 +41,6 @@ class Install extends Command
->addOption('db-template', null, InputOption::VALUE_OPTIONAL, 'Metadata structure language template (available are fr (french) and en (english))', null)
->addOption('databox', null, InputOption::VALUE_OPTIONAL, 'Database name for the DataBox', null)
->addOption('appbox', null, InputOption::VALUE_OPTIONAL, 'Database name for the ApplicationBox', null)
->addOption('indexer', null, InputOption::VALUE_OPTIONAL, 'Path to Phraseanet Indexer', 'auto')
->addOption('data-path', null, InputOption::VALUE_OPTIONAL, 'Path to data repository', realpath(__DIR__ . '/../../../../../datas'))
->addOption('server-name', null, InputOption::VALUE_OPTIONAL, 'Server name')
->addOption('indexer', null, InputOption::VALUE_OPTIONAL, 'Path to Phraseanet Indexer', 'auto')
@@ -98,7 +97,6 @@ class Install extends Command
list($email, $password) = $this->getCredentials($input, $output, $dialog);
$dataPath = $this->getDataPath($input, $output, $dialog);
$serverName = $this->getServerName($input, $output, $dialog);
$indexer = $this->getindexer($input, $output);
if (!$input->getOption('yes')) {
$continue = $dialog->askConfirmation($output, "<question>Phraseanet is going to be installed, continue ? (N/y)</question>", false);
@@ -110,7 +108,6 @@ class Install extends Command
}
}
$this->container['phraseanet.installer']->setPhraseaIndexerPath($indexer);
$this->container['phraseanet.installer']->install($email, $password, $abConn, $serverName, $dataPath, $dbConn, $template, $this->detectBinaries());
if (null !== $this->getApplication()) {
@@ -301,17 +298,6 @@ class Install extends Command
return $serverName;
}
private function getindexer(InputInterface $input, OutputInterface $output)
{
if ($input->getOption('indexer') == 'auto') {
$indexer = $this->executableFinder->find('phraseanet_indexer');
} else {
$indexer = $input->getOption('indexer');
}
return $indexer;
}
private function detectBinaries()
{
return [

View File

@@ -22,6 +22,7 @@ use Alchemy\Phrasea\TaskManager\Job\WebhookJob;
use Alchemy\Phrasea\TaskManager\Job\WriteMetadataJob;
use Alchemy\Phrasea\TaskManager\Job\Factory as JobFactory;
use Alchemy\Phrasea\TaskManager\LiveInformation;
use Alchemy\Phrasea\TaskManager\NullNotifier;
use Alchemy\Phrasea\TaskManager\TaskManagerStatus;
use Alchemy\Phrasea\TaskManager\Log\LogFileFactory;
use Alchemy\Phrasea\TaskManager\Notifier;
@@ -33,6 +34,10 @@ class TasksServiceProvider implements ServiceProviderInterface
public function register(Application $app)
{
$app['task-manager.notifier'] = $app->share(function (Application $app) {
if (isset($app['phraseanet.setup_mode']) && $app['phraseanet.setup_mode']) {
return new NullNotifier();
}
return Notifier::create($app['monolog'], $app['task-manager.options']);
});

View File

@@ -28,14 +28,14 @@ class TaskManipulator implements ManipulatorInterface
/** @var TranslatorInterface */
private $translator;
public function __construct(ObjectManager $om, TranslatorInterface $translator, NotifierInterface $notifier=null)
public function __construct(ObjectManager $om, TranslatorInterface $translator, NotifierInterface $notifier = null)
{
$this->om = $om;
$this->translator = $translator;
$this->setNotifier($notifier);
}
public function setNotifier(NotifierInterface $notifier=null)
public function setNotifier(NotifierInterface $notifier = null)
{
$this->notifier = $notifier ?: new NullNotifier();
return $this;

View File

@@ -11,16 +11,7 @@
namespace Alchemy\Phrasea\TaskManager\Job;
use Alchemy\Phrasea\Core\PhraseaTokens;
use Alchemy\Phrasea\SearchEngine\Elastic\Indexer\BulkOperation;
use Alchemy\Phrasea\SearchEngine\Elastic\Fetcher\ScheduledIndexationRecordFetcher;
use Alchemy\Phrasea\SearchEngine\Elastic\RecordHelper;
use Alchemy\Phrasea\TaskManager\Editor\IndexerEditor;
use Alchemy\Phrasea\TaskManager\Editor\SubdefsEditor;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Platforms\SQLAnywhere11Platform;
use Doctrine\DBAL\SQLParserUtils;
use MediaAlchemyst\Transmuter\Image2Image;
class IndexerJob extends AbstractJob
{