mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-08 10:34:34 +00:00
Cleanup namepaces, variables uses
This commit is contained in:
@@ -22,13 +22,12 @@ class module_client
|
||||
|
||||
public function getLanguage(Application $app, $lng)
|
||||
{
|
||||
$registry = $app['phraseanet.registry'];
|
||||
$out = array();
|
||||
$out['createWinInvite'] = _('paniers:: Quel nom souhaitez vous donner a votre panier ?');
|
||||
$out['chuNameEmpty'] = _('paniers:: Quel nom souhaitez vous donner a votre panier ?');
|
||||
$out['noDLok'] = _('export:: aucun document n\'est disponible au telechargement');
|
||||
$out['confirmRedirectAuth'] = _('invite:: Redirection vers la zone d\'authentification, cliquez sur OK pour continuer ou annulez');
|
||||
$out['serverName'] = $registry->get('GV_ServerName');
|
||||
$out['serverName'] = $app['phraseanet.registry']->get('GV_ServerName');
|
||||
$out['serverError'] = _('phraseanet::erreur: Une erreur est survenue, si ce probleme persiste, contactez le support technique');
|
||||
$out['serverTimeout'] = _('phraseanet::erreur: La connection au serveur Phraseanet semble etre indisponible');
|
||||
$out['serverDisconnected'] = _('phraseanet::erreur: Votre session est fermee, veuillez vous re-authentifier');
|
||||
|
@@ -49,10 +49,6 @@ class module_console_checkExtension extends Command
|
||||
return 1;
|
||||
}
|
||||
|
||||
$appbox = $this->getService('phraseanet.appbox');
|
||||
|
||||
$registry = $this->container['phraseanet.registry'];
|
||||
|
||||
$usrId = $input->getArgument('usr_id');
|
||||
|
||||
try {
|
||||
@@ -175,7 +171,7 @@ class module_console_checkExtension extends Command
|
||||
, $base["sbas_id"]
|
||||
, $base["searchcoll"]
|
||||
, $base["arrayq"]
|
||||
, $registry->get('GV_sit')
|
||||
, $this->container['phraseanet.registry']->get('GV_sit')
|
||||
, $usrId
|
||||
, false
|
||||
, PHRASEA_MULTIDOC_DOCONLY
|
||||
|
@@ -42,9 +42,8 @@ class module_console_fieldsDelete extends Command
|
||||
|
||||
protected function doExecute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$appbox = $this->getService('phraseanet.appbox');
|
||||
try {
|
||||
$databox = $appbox->get_databox((int) $input->getArgument('sbas_id'));
|
||||
$databox = $this->getService('phraseanet.appbox')->get_databox((int) $input->getArgument('sbas_id'));
|
||||
} catch (\Exception $e) {
|
||||
$output->writeln("<error>Invalid databox id </error>");
|
||||
|
||||
|
@@ -38,9 +38,7 @@ class module_console_fieldsList extends Command
|
||||
|
||||
protected function doExecute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$appbox = $this->getService('phraseanet.appbox');
|
||||
|
||||
foreach ($appbox->get_databoxes() as $databox) {
|
||||
foreach ($this->getService('phraseanet.appbox')->get_databoxes() as $databox) {
|
||||
/* @var $databox \databox */
|
||||
$output->writeln(
|
||||
sprintf(
|
||||
|
@@ -54,10 +54,8 @@ class module_console_fieldsMerge extends Command
|
||||
{
|
||||
$output->writeln("");
|
||||
|
||||
$appbox = $this->getService('phraseanet.appbox');
|
||||
|
||||
try {
|
||||
$databox = $appbox->get_databox((int) $input->getArgument('sbas_id'));
|
||||
$databox = $this->getService('phraseanet.appbox')->get_databox((int) $input->getArgument('sbas_id'));
|
||||
} catch (\Exception $e) {
|
||||
$output->writeln("<error>Invalid databox id </error>");
|
||||
|
||||
|
@@ -45,9 +45,8 @@ class module_console_fieldsRename extends Command
|
||||
{
|
||||
$new_name = $input->getArgument('name');
|
||||
|
||||
$appbox = $this->getService('phraseanet.appbox');
|
||||
try {
|
||||
$databox = $appbox->get_databox((int) $input->getArgument('sbas_id'));
|
||||
$databox = $this->getService('phraseanet.appbox')->get_databox((int) $input->getArgument('sbas_id'));
|
||||
} catch (\Exception $e) {
|
||||
$output->writeln("<error>Invalid databox id </error>");
|
||||
|
||||
|
@@ -41,9 +41,6 @@ class module_console_sphinxGenerateSuggestion extends Command
|
||||
define('FREQ_THRESHOLD', 10);
|
||||
define('SUGGEST_DEBUG', 0);
|
||||
|
||||
$appbox = $this->getService('phraseanet.appbox');
|
||||
$registry = $this->container['phraseanet.registry'];
|
||||
|
||||
$params = phrasea::sbas_params($this->container);
|
||||
|
||||
foreach ($params as $sbas_id => $p) {
|
||||
@@ -55,9 +52,9 @@ class module_console_sphinxGenerateSuggestion extends Command
|
||||
)
|
||||
);
|
||||
|
||||
$tmp_file = $registry->get('GV_RootPath') . 'tmp/dict' . $index . '.txt';
|
||||
$tmp_file = $this->container['phraseanet.registry']->get('GV_RootPath') . 'tmp/dict' . $index . '.txt';
|
||||
|
||||
$databox = $appbox->get_databox($sbas_id);
|
||||
$databox = $this->getService('phraseanet.appbox')->get_databox($sbas_id);
|
||||
|
||||
$output->writeln("process Databox " . $databox->get_viewname() . " / $index\n");
|
||||
|
||||
|
@@ -47,11 +47,9 @@ class module_console_systemBackupDB extends Command
|
||||
{
|
||||
$output->write('Phraseanet is going to be backup...', true);
|
||||
|
||||
$appbox = $this->getService('phraseanet.appbox');
|
||||
$ok = $this->dump_base($this->getService('phraseanet.appbox'), $input, $output) && $ok;
|
||||
|
||||
$ok = $this->dump_base($appbox, $input, $output) && $ok;
|
||||
|
||||
foreach ($appbox->get_databoxes() as $databox) {
|
||||
foreach ($this->getService('phraseanet.appbox')->get_databoxes() as $databox) {
|
||||
$ok = $this->dump_base($databox, $input, $output) && $ok;
|
||||
}
|
||||
|
||||
|
@@ -52,7 +52,7 @@ class module_console_systemConfigCheck extends Command
|
||||
$registry = $this->container['phraseanet.registry'];
|
||||
|
||||
$output->writeln(_('*** CHECK BINARY CONFIGURATION ***'));
|
||||
$ok = $this->processConstraints(setup::check_binaries($registry), $output) && $ok;
|
||||
$ok = $this->processConstraints(setup::check_binaries($this->container['phraseanet.registry']), $output) && $ok;
|
||||
$output->writeln("");
|
||||
} else {
|
||||
$registry = new Setup_Registry();
|
||||
|
@@ -128,13 +128,11 @@ class module_console_systemExport extends Command
|
||||
$output->writeln("Export datas from selected base_ids");
|
||||
}
|
||||
|
||||
$appbox = $this->getService('phraseanet.appbox');
|
||||
|
||||
$total = $errors = 0;
|
||||
|
||||
$unicode = new \unicode();
|
||||
|
||||
foreach ($appbox->get_databoxes() as $databox) {
|
||||
foreach ($this->getService('phraseanet.appbox')->get_databoxes() as $databox) {
|
||||
$output->writeln(sprintf("Processing <info>%s</info>", $databox->get_viewname()));
|
||||
|
||||
if (count($restrictSbasIds) > 0 && ! in_array($databox->get_sbas_id(), $restrictSbasIds)) {
|
||||
|
@@ -44,16 +44,14 @@ class module_console_systemMailCheck extends Command
|
||||
|
||||
protected function doExecute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
$appbox = $this->getService('phraseanet.appbox');
|
||||
|
||||
$output->writeln("Processing...");
|
||||
|
||||
$bad_users = User_Adapter::get_wrong_email_users($this->container);
|
||||
|
||||
foreach ($bad_users as $email => $users) {
|
||||
if ($input->getOption('list')) {
|
||||
$this->write_infos($email, $users, $output, $appbox);
|
||||
} elseif ($this->manage_group($email, $users, $output, $appbox) === false) {
|
||||
$this->write_infos($email, $users, $output, $this->getService('phraseanet.appbox'));
|
||||
} elseif ($this->manage_group($email, $users, $output, $this->getService('phraseanet.appbox')) === false) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@@ -98,15 +98,14 @@ class module_console_systemUpgrade extends Command
|
||||
if ($continue == 'y') {
|
||||
try {
|
||||
$output->write('<info>Upgrading...</info>', true);
|
||||
$appbox = $this->getService('phraseanet.appbox');
|
||||
|
||||
if (count(User_Adapter::get_wrong_email_users($this->container)) > 0) {
|
||||
return $output->writeln(sprintf('<error>You have to fix your database before upgrade with the system:mailCheck command </error>'));
|
||||
}
|
||||
|
||||
$upgrader = new Setup_Upgrade($appbox, $input->getOption('force'));
|
||||
$upgrader = new Setup_Upgrade($this->getService('phraseanet.appbox'), $input->getOption('force'));
|
||||
|
||||
$appbox->forceUpgrade($upgrader);
|
||||
$this->getService('phraseanet.appbox')->forceUpgrade($upgrader);
|
||||
|
||||
foreach ($upgrader->getRecommendations() as $recommendation) {
|
||||
list($message, $command) = $recommendation;
|
||||
|
@@ -46,7 +46,6 @@ class module_console_tasklist extends Command
|
||||
}
|
||||
|
||||
try {
|
||||
$appbox = $this->getService('phraseanet.appbox');
|
||||
$task_manager = new task_manager($this->container);
|
||||
$tasks = $task_manager->getTasks();
|
||||
|
||||
|
@@ -81,7 +81,6 @@ class module_console_taskrun extends Command
|
||||
throw new \RuntimeException('Argument must be an Id.');
|
||||
}
|
||||
|
||||
$appbox = $this->getService('phraseanet.appbox');
|
||||
$task_manager = new task_manager($this->container);
|
||||
|
||||
if ($input->getOption('runner') === task_abstract::RUNNER_MANUAL) {
|
||||
|
@@ -629,13 +629,12 @@ class module_report
|
||||
*/
|
||||
protected function setReport()
|
||||
{
|
||||
$registry = $this->app['phraseanet.registry'];
|
||||
$this->report['dbid'] = $this->sbas_id;
|
||||
$this->report['periode'] = $this->periode;
|
||||
$this->report['dbname'] = $this->dbname;
|
||||
$this->report['dmin'] = $this->dmin;
|
||||
$this->report['dmax'] = $this->dmax;
|
||||
$this->report['server'] = $registry->get('GV_ServerName');
|
||||
$this->report['server'] = $this->app['phraseanet.registry']->get('GV_ServerName');
|
||||
$this->report['filter'] = $this->tab_filter;
|
||||
$this->report['posting_filter'] = $this->posting_filter;
|
||||
$this->report['active_column'] = $this->active_column;
|
||||
@@ -861,8 +860,7 @@ class module_report
|
||||
{
|
||||
$tab = array();
|
||||
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$databox = $appbox->get_databox((int) $sbasid);
|
||||
$databox = $app['phraseanet.appbox']->get_databox((int) $sbasid);
|
||||
|
||||
foreach ($databox->get_meta_structure() as $databox_field) {
|
||||
/* @var $databox_field \databox_field */
|
||||
|
@@ -292,8 +292,7 @@ class module_report_activity extends module_report
|
||||
$filter = $s->getFilters();
|
||||
$conn = $s->getConnBas();
|
||||
|
||||
$appbox = $this->app['phraseanet.appbox'];
|
||||
$databox = $appbox->get_databox($this->sbas_id);
|
||||
$databox = $this->app['phraseanet.appbox']->get_databox($this->sbas_id);
|
||||
|
||||
$params = array();
|
||||
$date_filter = $filter->getDateFilter();
|
||||
@@ -363,7 +362,6 @@ class module_report_activity extends module_report
|
||||
{
|
||||
$this->title = _('report:: telechargements par jour');
|
||||
|
||||
$registry = $this->app['phraseanet.registry'];
|
||||
|
||||
$s = new module_report_sql($this->app, $this);
|
||||
$filter = $s->getFilters();
|
||||
@@ -756,14 +754,13 @@ class module_report_activity extends module_report
|
||||
public static function topTenUser(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
|
||||
{
|
||||
$conn = connection::getPDOConnection($app, $sbas_id);
|
||||
$registry = $app['phraseanet.registry'];
|
||||
$result = array();
|
||||
$result['top_ten_doc'] = array();
|
||||
$result['top_ten_prev'] = array();
|
||||
$result['top_ten_poiddoc'] = array();
|
||||
$result['top_ten_poidprev'] = array();
|
||||
|
||||
$params = array(':site_id' => $registry->get('GV_sit'));
|
||||
$params = array(':site_id' => $app['phraseanet.registry']->get('GV_sit'));
|
||||
|
||||
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
|
||||
$params = array_merge($params, $datefilter['params']);
|
||||
@@ -837,14 +834,13 @@ class module_report_activity extends module_report
|
||||
public static function activity(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
|
||||
{
|
||||
$conn = connection::getPDOConnection($app, $sbas_id);
|
||||
$registry = $app['phraseanet.registry'];
|
||||
$res = array();
|
||||
$datefilter =
|
||||
module_report_sqlfilter::constructDateFilter($dmin, $dmax);
|
||||
$collfilter =
|
||||
module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
|
||||
|
||||
$params = array(':site_id' => $registry->get('GV_sit'));
|
||||
$params = array(':site_id' => $app['phraseanet.registry']->get('GV_sit'));
|
||||
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
|
||||
|
||||
$sql = "
|
||||
@@ -877,7 +873,6 @@ class module_report_activity extends module_report
|
||||
public static function activityDay(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
|
||||
{
|
||||
$conn = connection::getPDOConnection($app, $sbas_id);
|
||||
$registry = $app['phraseanet.registry'];
|
||||
$result = array();
|
||||
$res = array();
|
||||
$datefilter =
|
||||
@@ -885,7 +880,7 @@ class module_report_activity extends module_report
|
||||
$collfilter =
|
||||
module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
|
||||
|
||||
$params = array(':site_id' => $registry->get('GV_sit'));
|
||||
$params = array(':site_id' => $app['phraseanet.registry']->get('GV_sit'));
|
||||
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
|
||||
|
||||
$sql = "
|
||||
@@ -919,14 +914,13 @@ class module_report_activity extends module_report
|
||||
public static function activityQuestion(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
|
||||
{
|
||||
$conn = connection::getPDOConnection($app, $sbas_id);
|
||||
$registry = $app['phraseanet.registry'];
|
||||
$result = array();
|
||||
$datefilter =
|
||||
module_report_sqlfilter::constructDateFilter($dmin, $dmax);
|
||||
$collfilter =
|
||||
module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
|
||||
|
||||
$params = array(':site_id' => $registry->get('GV_sit'));
|
||||
$params = array(':site_id' => $app['phraseanet.registry']->get('GV_sit'));
|
||||
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
|
||||
|
||||
$sql = "
|
||||
@@ -957,14 +951,13 @@ class module_report_activity extends module_report
|
||||
public static function activiteTopQuestion(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
|
||||
{
|
||||
$conn = connection::getPDOConnection($app, $sbas_id);
|
||||
$registry = $app['phraseanet.registry'];
|
||||
$result = array();
|
||||
$datefilter =
|
||||
module_report_sqlfilter::constructDateFilter($dmin, $dmax);
|
||||
$collfilter =
|
||||
module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
|
||||
|
||||
$params = array(':site_id' => $registry->get('GV_sit'));
|
||||
$params = array(':site_id' => $app['phraseanet.registry']->get('GV_sit'));
|
||||
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
|
||||
|
||||
$sql = "
|
||||
|
@@ -151,12 +151,11 @@ class module_report_connexion extends module_report
|
||||
public static function getNbConn(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
|
||||
{
|
||||
$conn = connection::getPDOConnection($app, $sbas_id);
|
||||
$registry = $app['phraseanet.registry'];
|
||||
|
||||
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
|
||||
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
|
||||
|
||||
$params = array(':site_id' => $registry->get('GV_sit'));
|
||||
$params = array(':site_id' => $app['phraseanet.registry']->get('GV_sit'));
|
||||
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
|
||||
|
||||
$finalfilter = $datefilter['sql'] . ' AND ';
|
||||
|
@@ -74,18 +74,17 @@ class module_report_dashboard_feed implements module_report_dashboard_componentI
|
||||
*/
|
||||
public static function getInstance(Application $app, $sbasid, $sbas_coll, $dmin, $dmax)
|
||||
{
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$cache_id = 'feed_' . md5($sbasid . '_' . $sbas_coll . '_' . $dmin . '_' . $dmax);
|
||||
|
||||
try {
|
||||
return $appbox->get_data_from_cache($cache_id);
|
||||
return $app['phraseanet.appbox']->get_data_from_cache($cache_id);
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
|
||||
$tmp = new self($app, $sbasid, $sbas_coll, $dmin, $dmax);
|
||||
|
||||
$appbox->set_data_to_cache($tmp, $cache_id);
|
||||
$app['phraseanet.appbox']->set_data_to_cache($tmp, $cache_id);
|
||||
|
||||
return $tmp;
|
||||
}
|
||||
@@ -144,8 +143,7 @@ class module_report_dashboard_feed implements module_report_dashboard_componentI
|
||||
$this->report['nb_conn'] = module_report_connexion::getNbConn(
|
||||
$this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection
|
||||
);
|
||||
$registry = $this->app['phraseanet.registry'];
|
||||
if ($registry->get('GV_anonymousReport') == false) {
|
||||
if ($this->app['phraseanet.registry']->get('GV_anonymousReport') == false) {
|
||||
/**
|
||||
* get Top ten user of
|
||||
* number of dl doc, prev
|
||||
@@ -180,7 +178,7 @@ class module_report_dashboard_feed implements module_report_dashboard_componentI
|
||||
$this->report['top_dl_preview'] = $topdl['preview'];
|
||||
$this->report['top_dl_document'] = $topdl['document'];
|
||||
|
||||
if ($registry->get('GV_anonymousReport') == false) {
|
||||
if ($this->app['phraseanet.registry']->get('GV_anonymousReport') == false) {
|
||||
// get users that ask the most questions
|
||||
$this->report['ask'] = module_report_activity::activityQuestion(
|
||||
$this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection
|
||||
@@ -204,7 +202,7 @@ class module_report_dashboard_feed implements module_report_dashboard_componentI
|
||||
$this->report['activity_edited'] = module_report_activity::activiteEditedDocument(
|
||||
$this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection
|
||||
);
|
||||
if ($registry->get('GV_anonymousReport') == false) {
|
||||
if ($this->app['phraseanet.registry']->get('GV_anonymousReport') == false) {
|
||||
//get users that add the most documents
|
||||
$this->report['top_ten_added'] = module_report_activity::activiteAddedTopTenUser(
|
||||
$this->app, $this->dminsql, $this->dmaxsql, $this->sbasid, $this->collection
|
||||
|
@@ -174,9 +174,8 @@ class module_report_download extends module_report
|
||||
public static function getNbDl(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
|
||||
{
|
||||
$conn = connection::getPDOConnection($app, $sbas_id);
|
||||
$registry = $app['phraseanet.registry'];
|
||||
|
||||
$params = array(':site_id' => $registry->get('GV_sit'));
|
||||
$params = array(':site_id' => $app['phraseanet.registry']->get('GV_sit'));
|
||||
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
|
||||
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
|
||||
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
|
||||
@@ -210,13 +209,10 @@ class module_report_download extends module_report
|
||||
|
||||
public static function getTopDl(Application $app, $dmin, $dmax, $sbas_id, $list_coll_id)
|
||||
{
|
||||
$appbox = $app['phraseanet.appbox'];
|
||||
$databox = $appbox->get_databox((int) $sbas_id);
|
||||
$databox = $app['phraseanet.appbox']->get_databox((int) $sbas_id);
|
||||
$conn = $databox->get_connection();
|
||||
|
||||
$registry = $app['phraseanet.registry'];
|
||||
|
||||
$params = array(':site_id' => $registry->get('GV_sit'));
|
||||
$params = array(':site_id' => $app['phraseanet.registry']->get('GV_sit'));
|
||||
$datefilter = module_report_sqlfilter::constructDateFilter($dmin, $dmax);
|
||||
$collfilter = module_report_sqlfilter::constructCollectionFilter($app, $list_coll_id);
|
||||
$params = array_merge($params, $datefilter['params'], $collfilter['params']);
|
||||
|
@@ -63,9 +63,8 @@ class module_report_sqlfilter
|
||||
public function getReportFilter()
|
||||
{
|
||||
$finalfilter = '';
|
||||
$registry = $this->app['phraseanet.registry'];
|
||||
|
||||
$params = array(':log_site' => $registry->get('GV_sit'));
|
||||
$params = array(':log_site' => $this->app['phraseanet.registry']->get('GV_sit'));
|
||||
|
||||
if ($this->filter['date']) {
|
||||
$finalfilter .= $this->filter['date']['sql'] . ' AND ';
|
||||
@@ -86,13 +85,12 @@ class module_report_sqlfilter
|
||||
|
||||
public function getGvSitFilter()
|
||||
{
|
||||
$registry = $this->app['phraseanet.registry'];
|
||||
$params = array();
|
||||
$sql = '';
|
||||
|
||||
if ($registry->is_set('GV_sit')) {
|
||||
if ($this->app['phraseanet.registry']->is_set('GV_sit')) {
|
||||
$sql = 'log.site = :log_site_gv_filter';
|
||||
$params[':log_site_gv_filter'] = $registry->get('GV_sit');
|
||||
$params[':log_site_gv_filter'] = $this->app['phraseanet.registry']->get('GV_sit');
|
||||
}
|
||||
|
||||
return array('sql' => $sql, 'params' => $params);
|
||||
|
Reference in New Issue
Block a user