mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-17 15:03:25 +00:00
PHRAS-3360 bloc worker if not exist
This commit is contained in:
105
lib/classes/patch/414_PHRAS_3360.php
Normal file
105
lib/classes/patch/414_PHRAS_3360.php
Normal file
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
|
||||
use Alchemy\Phrasea\Application;
|
||||
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
|
||||
use Alchemy\Phrasea\WorkerManager\Queue\MessagePublisher;
|
||||
|
||||
class patch_414_PHRAS_3360 implements patchInterface
|
||||
{
|
||||
/** @var string */
|
||||
private $release = '4.1.4';
|
||||
|
||||
/** @var array */
|
||||
private $concern = [base::APPLICATION_BOX, base::DATA_BOX];
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function get_release()
|
||||
{
|
||||
return $this->release;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function getDoctrineMigrations()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function require_all_upgrades()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function concern()
|
||||
{
|
||||
return $this->concern;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function apply(base $base, Application $app)
|
||||
{
|
||||
if ($base->get_base_type() === base::DATA_BOX) {
|
||||
$this->patch_databox($base, $app);
|
||||
}
|
||||
elseif ($base->get_base_type() === base::APPLICATION_BOX) {
|
||||
$this->patch_appbox($base, $app);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private function patch_databox(base $databox, Application $app)
|
||||
{
|
||||
}
|
||||
|
||||
private function patch_appbox(base $databox, Application $app)
|
||||
{
|
||||
/** @var PropertyAccess $conf */
|
||||
$conf = $app['conf'];
|
||||
|
||||
$queues = [
|
||||
MessagePublisher::ASSETS_INGEST_TYPE => [],
|
||||
MessagePublisher::CREATE_RECORD_TYPE => [],
|
||||
MessagePublisher::EXPORT_MAIL_TYPE => [],
|
||||
MessagePublisher::FTP_TYPE => [],
|
||||
MessagePublisher::POPULATE_INDEX_TYPE => [],
|
||||
MessagePublisher::PULL_ASSETS_TYPE => [],
|
||||
MessagePublisher::SUBDEF_CREATION_TYPE => [],
|
||||
MessagePublisher::VALIDATION_REMINDER_TYPE => [],
|
||||
MessagePublisher::WEBHOOK_TYPE => [],
|
||||
MessagePublisher::WRITE_METADATAS_TYPE => [],
|
||||
];
|
||||
|
||||
// add bloc worker if not exist
|
||||
if (!$conf->has(['workers'])) {
|
||||
$workers = [
|
||||
'queue' => [
|
||||
'worker-queue' => [
|
||||
'registry' => 'alchemy_worker.queue_registry',
|
||||
'host' => 'rabbitmq',
|
||||
'port' => 5672,
|
||||
'user' => 'alchemy',
|
||||
'password' => 'vdh4dpe5Wy3R',
|
||||
'vhost' => '/'
|
||||
]
|
||||
],
|
||||
'queues' => $queues
|
||||
];
|
||||
|
||||
$conf->set(['workers'], $workers);
|
||||
} elseif (!$conf->has(['workers', 'queues'])) {
|
||||
$conf->set(['workers', 'queues'], $queues);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user