mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-15 14:03:27 +00:00
[SearchEngine] Update commands
This commit is contained in:
@@ -15,10 +15,12 @@
|
|||||||
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
* @license http://opensource.org/licenses/gpl-3.0 GPLv3
|
||||||
* @link www.phraseanet.com
|
* @link www.phraseanet.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
use Alchemy\Phrasea\Command\Command;
|
||||||
|
use Alchemy\Phrasea\SearchEngine\PhraseaEngineQueryParser;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Alchemy\Phrasea\Command\Command;
|
|
||||||
|
|
||||||
class module_console_checkExtension extends Command
|
class module_console_checkExtension extends Command
|
||||||
{
|
{
|
||||||
@@ -147,7 +149,7 @@ class module_console_checkExtension extends Command
|
|||||||
$tbases[$kbase]["searchcoll"] = $tcoll;
|
$tbases[$kbase]["searchcoll"] = $tcoll;
|
||||||
$tbases[$kbase]["mask_xor"] = $tbases[$kbase]["mask_and"] = 0;
|
$tbases[$kbase]["mask_xor"] = $tbases[$kbase]["mask_and"] = 0;
|
||||||
|
|
||||||
$qp = new searchEngine_adapter_phrasea_queryParser($this->container);
|
$qp = new PhraseaEngineQueryParser();
|
||||||
$treeq = $qp->parsequery($input->getOption('query'));
|
$treeq = $qp->parsequery($input->getOption('query'));
|
||||||
$arrayq = $qp->makequery($treeq);
|
$arrayq = $qp->makequery($treeq);
|
||||||
|
|
||||||
|
@@ -201,6 +201,9 @@ class module_console_fieldsMerge extends Command
|
|||||||
'value' => $data,
|
'value' => $data,
|
||||||
)), true);
|
)), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->getService('phraseanet.SE')->updateRecord($record);
|
||||||
|
|
||||||
unset($record);
|
unset($record);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -38,6 +38,7 @@ class module_console_fileEnsureProductionSetting extends Command
|
|||||||
, 'checkDatabaseScope'
|
, 'checkDatabaseScope'
|
||||||
, 'checkTeamplateEngineService'
|
, 'checkTeamplateEngineService'
|
||||||
, 'checkOrmService'
|
, 'checkOrmService'
|
||||||
|
, 'checkSearchEngineService'
|
||||||
, 'checkCacheService'
|
, 'checkCacheService'
|
||||||
, 'checkOpcodeCacheService'
|
, 'checkOpcodeCacheService'
|
||||||
, 'checkBorderService'
|
, 'checkBorderService'
|
||||||
@@ -98,6 +99,9 @@ class module_console_fileEnsureProductionSetting extends Command
|
|||||||
case 'checkOrmService' :
|
case 'checkOrmService' :
|
||||||
$display = "ORM";
|
$display = "ORM";
|
||||||
break;
|
break;
|
||||||
|
case 'checkSearchEngineService':
|
||||||
|
$display = 'Search Engine';
|
||||||
|
break;
|
||||||
case 'checkCacheService' :
|
case 'checkCacheService' :
|
||||||
$display = "Cache";
|
$display = "Cache";
|
||||||
break;
|
break;
|
||||||
@@ -510,6 +514,22 @@ class module_console_fileEnsureProductionSetting extends Command
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function checkSearchEngineService(OutputInterface $output)
|
||||||
|
{
|
||||||
|
$SEName = $this->configuration->getSearchEngine();
|
||||||
|
$configuration = $this->configuration->getService($SEName);
|
||||||
|
|
||||||
|
try {
|
||||||
|
$service = Core\Service\Builder::create(\bootstrap::getCore(), $configuration);
|
||||||
|
$work_message = '<info>Works !</info>';
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
$work_message = sprintf('<error>Failed : %s !</error>', $e->getMessage());
|
||||||
|
$this->errors ++;
|
||||||
|
}
|
||||||
|
|
||||||
|
$output->writeln(sprintf("\t--> Verify ORM engine <info>%s</info> : %s", $SEName, $work_message));
|
||||||
|
}
|
||||||
|
|
||||||
private function checkOrmService(OutputInterface $output)
|
private function checkOrmService(OutputInterface $output)
|
||||||
{
|
{
|
||||||
$ormName = $this->configuration->getOrm();
|
$ormName = $this->configuration->getOrm();
|
||||||
|
@@ -509,6 +509,7 @@ class task_period_RecordMover extends task_appboxAbstract
|
|||||||
if (array_key_exists('coll', $row)) {
|
if (array_key_exists('coll', $row)) {
|
||||||
$coll = collection::get_from_coll_id($this->dependencyContainer, $databox, $row['coll']);
|
$coll = collection::get_from_coll_id($this->dependencyContainer, $databox, $row['coll']);
|
||||||
$rec->move_to_collection($coll, $this->dependencyContainer['phraseanet.appbox']);
|
$rec->move_to_collection($coll, $this->dependencyContainer['phraseanet.appbox']);
|
||||||
|
$this['phraseanet.SE']->updateRecord($rec);
|
||||||
if ($logsql) {
|
if ($logsql) {
|
||||||
$this->log(sprintf("on sbas %s move rid %s to coll %s \n", $row['sbas_id'], $row['record_id'], $coll->get_coll_id()));
|
$this->log(sprintf("on sbas %s move rid %s to coll %s \n", $row['sbas_id'], $row['record_id'], $coll->get_coll_id()));
|
||||||
}
|
}
|
||||||
@@ -524,6 +525,7 @@ class task_period_RecordMover extends task_appboxAbstract
|
|||||||
}
|
}
|
||||||
$status = implode('', $status);
|
$status = implode('', $status);
|
||||||
$rec->set_binary_status($status);
|
$rec->set_binary_status($status);
|
||||||
|
$this['SearchEngine']->updateRecord($rec);
|
||||||
if ($logsql) {
|
if ($logsql) {
|
||||||
$this->log(sprintf("on sbas %s set rid %s status to %s \n", $row['sbas_id'], $row['record_id'], $status));
|
$this->log(sprintf("on sbas %s set rid %s status to %s \n", $row['sbas_id'], $row['record_id'], $status));
|
||||||
}
|
}
|
||||||
@@ -534,12 +536,14 @@ class task_period_RecordMover extends task_appboxAbstract
|
|||||||
if ($row['deletechildren'] && $rec->is_grouping()) {
|
if ($row['deletechildren'] && $rec->is_grouping()) {
|
||||||
foreach ($rec->get_children() as $child) {
|
foreach ($rec->get_children() as $child) {
|
||||||
$child->delete();
|
$child->delete();
|
||||||
|
$this['SearchEngine']->removeRecord($child);
|
||||||
if ($logsql) {
|
if ($logsql) {
|
||||||
$this->log(sprintf("on sbas %s delete (grp child) rid %s \n", $row['sbas_id'], $child->get_record_id()));
|
$this->log(sprintf("on sbas %s delete (grp child) rid %s \n", $row['sbas_id'], $child->get_record_id()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$rec->delete();
|
$rec->delete();
|
||||||
|
$this['SearchEngine']->removeRecord($rec);
|
||||||
if ($logsql) {
|
if ($logsql) {
|
||||||
$this->log(sprintf("on sbas %s delete rid %s \n", $row['sbas_id'], $rec->get_record_id()));
|
$this->log(sprintf("on sbas %s delete rid %s \n", $row['sbas_id'], $rec->get_record_id()));
|
||||||
}
|
}
|
||||||
|
@@ -1632,7 +1632,8 @@ class task_period_archive extends task_abstract
|
|||||||
|
|
||||||
$story->set_binary_status(databox_status::operation_or($this->dependencyContainer, $stat0, $stat1));
|
$story->set_binary_status(databox_status::operation_or($this->dependencyContainer, $stat0, $stat1));
|
||||||
$story->rebuild_subdefs();
|
$story->rebuild_subdefs();
|
||||||
$story->reindex();
|
|
||||||
|
$this['phraseanet.SE']->addStory($story);
|
||||||
|
|
||||||
$media = $databox = null;
|
$media = $databox = null;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user