diff --git a/lib/classes/databox/status.php b/lib/classes/databox/status.php index c69d3806a8..7311249d24 100644 --- a/lib/classes/databox/status.php +++ b/lib/classes/databox/status.php @@ -44,115 +44,8 @@ class databox_status ); } ksort($structures); -file_put_contents("/tmp/phraseanet-log.txt", sprintf("%s (%d) %s\n", __FILE__, __LINE__, var_export($structures, true)), FILE_APPEND); return $structures; - - foreach ($structures as $databox_id => $structure) { - foreach($structure as $bit => $status) { - $key = RecordHelper::normalizeFlagKey($status['labelon']); - - if (isset($stats[$key])) { - $status = $stats[$key]; - } - - $status['sbas'][] = $databox_id; - $status['bit'] = $bit; - - $stats[$key] = $status; - } - } -file_put_contents("/tmp/phraseanet-log.txt", sprintf("%s (%d) %s\n", __FILE__, __LINE__, var_export($stats, true)), FILE_APPEND); - return $stats; - } - - public static function no_getSearchStatus(Application $app) - { - $see_all = $structures = $stats = []; - foreach ($app->getAclForUser($app->getAuthenticatedUser())->get_granted_sbas() as $databox) { - $see_all[$databox->get_sbas_id()] = false; - foreach ($databox->get_collections() as $collection) { - if ($app->getAclForUser($app->getAuthenticatedUser())->has_right_on_base($collection->get_base_id(), 'chgstatus')) { - $see_all[$databox->get_sbas_id()] = true; - break; - } - } - $structures[$databox->get_sbas_id()] = $databox->getStatusStructure(); - } - - // order the result by bit number, ... - $tbits = []; - foreach ($structures as $databox_id => $structure) { - if (false === $see_all[$databox_id]) { - $structure = array_filter($structure->toArray(), function ($status) { - return (bool)$status['searchable']; - }); - } - foreach($structure as $bit => $status) { - if(!array_key_exists($bit, $tbits)) { - $tbits[$bit] = []; - } - $tbits[$bit][$databox_id] = $status; - } - } - ksort($tbits); -// file_put_contents("/tmp/phraseanet-log.txt", sprintf("%s (%d) %s\n", __FILE__, __LINE__, var_export($tbits, true)), FILE_APPEND); - - // ... but group the status with same name - foreach($tbits as $bit=>$tbas) { - foreach($tbas as $sbas_id=>$status) { - // the group-key is the "labelon" - $key = RecordHelper::normalizeFlagKey($status['labelon']); - if(!array_key_exists($key, $stats)) { - $stats[$key] = $status; - $stats[$key]['sbas'] = []; - // $stats[$key]['tbas'] = []; - } - else { - /* - if($stats[$key]['bit'] != $bit) { - // error : in es, 2 sb with same name MUST be at the same position - throw new UnexpectedValueException( - sprintf("statusbit '%s' found at position %d and position %d" - , $key, $stats[$key]['bit'], $bit - ) - ); - } - */ - } - $stats[$key]['sbas'][] = $sbas_id; - // $stats[$key]['tbas'][$sbas_id] = $status; - } - } - file_put_contents("/tmp/phraseanet-log.txt", sprintf("%s (%d) %s\n", __FILE__, __LINE__, var_export($stats, true)), FILE_APPEND); - return $stats; - - - - foreach ($structures as $databox_id => $structure) { - file_put_contents("/tmp/phraseanet-log.txt", sprintf("%s (%d) %s\n%s\n", __FILE__, __LINE__, var_export($databox_id, true), var_export($structure->toArray(), true)), FILE_APPEND); - if (false === $see_all[$databox_id]) { - $structure = array_filter($structure->toArray(), function ($status) { - return (bool) $status['searchable']; - }); - } - - foreach($structure as $bit => $status) { - $key = RecordHelper::normalizeFlagKey($status['labelon']); - file_put_contents("/tmp/phraseanet-log.txt", sprintf("%s (%d) %d:%s\n", __FILE__, __LINE__, $bit, $key), FILE_APPEND); - - if (isset($stats[$key])) { - $status = $stats[$key]; - } - - $status['sbas'][] = $databox_id; - $status['bit'] = $bit; - - $stats[$key] = $status; - } - } - file_put_contents("/tmp/phraseanet-log.txt", sprintf("%s (%d) %s\n", __FILE__, __LINE__, var_export($stats, true)), FILE_APPEND); - return $stats; } public static function deleteIcon(Application $app, $databox_id, $bit, $switch) diff --git a/templates/web/prod/index.html.twig b/templates/web/prod/index.html.twig index dcc86aa680..2b610ab07c 100644 --- a/templates/web/prod/index.html.twig +++ b/templates/web/prod/index.html.twig @@ -5,7 +5,7 @@