mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-11 03:53:13 +00:00
Merge with master
This commit is contained in:
@@ -180,6 +180,12 @@ abstract class base implements cache_cacheableInterface
|
|||||||
*/
|
*/
|
||||||
public function get_data_from_cache($option = null)
|
public function get_data_from_cache($option = null)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if($this->get_base_type() == self::DATA_BOX)
|
||||||
|
{
|
||||||
|
\cache_databox::refresh($this->id);
|
||||||
|
}
|
||||||
|
|
||||||
return $this->get_cache()->get($this->get_cache_key($option));
|
return $this->get_cache()->get($this->get_cache_key($option));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
21
lib/classes/cache/databox.class.php
vendored
21
lib/classes/cache/databox.class.php
vendored
@@ -33,13 +33,11 @@ class cache_databox
|
|||||||
|
|
||||||
$registry = \registry::get_instance();
|
$registry = \registry::get_instance();
|
||||||
|
|
||||||
$cache_appbox = $appbox->get_cache();
|
|
||||||
|
|
||||||
$last_update = null;
|
$last_update = null;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$last_update = $cache_appbox->get('memcached_update');
|
$last_update = $appbox->get_data_from_cache('memcached_update');
|
||||||
}
|
}
|
||||||
catch (\Exception $e)
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
@@ -51,7 +49,7 @@ class cache_databox
|
|||||||
else
|
else
|
||||||
$last_update = new \DateTime('-10 years');
|
$last_update = new \DateTime('-10 years');
|
||||||
|
|
||||||
if ($date <= $last_update || !$cache_appbox->ping())
|
if ($date <= $last_update || !$appbox->get_cache()->ping())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -97,10 +95,19 @@ class cache_databox
|
|||||||
$stmt = $connsbas->prepare($sql);
|
$stmt = $connsbas->prepare($sql);
|
||||||
$stmt->execute($params);
|
$stmt->execute($params);
|
||||||
$stmt->closeCursor();
|
$stmt->closeCursor();
|
||||||
|
|
||||||
|
$record = new \record_adapter($sbas_id, $row['value']);
|
||||||
|
$record->get_caption()->delete_data_from_cache();
|
||||||
|
|
||||||
|
foreach ($record->get_caption()->get_fields() as $field)
|
||||||
|
{
|
||||||
|
$field->delete_data_from_cache();
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'structure':
|
case 'structure':
|
||||||
$cache_appbox->delete(\appbox::CACHE_LIST_BASES);
|
$appbox->delete_data_from_cache(\appbox::CACHE_LIST_BASES);
|
||||||
$cache_appbox->delete(\appbox::CACHE_SBAS_IDS);
|
$appbox->delete_data_from_cache(\appbox::CACHE_SBAS_IDS);
|
||||||
|
|
||||||
$sql = 'DELETE FROM memcached
|
$sql = 'DELETE FROM memcached
|
||||||
WHERE site_id = :site_id AND type="structure" AND value = :value';
|
WHERE site_id = :site_id AND type="structure" AND value = :value';
|
||||||
@@ -120,7 +127,7 @@ class cache_databox
|
|||||||
$date = new \DateTime();
|
$date = new \DateTime();
|
||||||
$now = $date->format(DATE_ISO8601);
|
$now = $date->format(DATE_ISO8601);
|
||||||
|
|
||||||
$cache_appbox->set('memcached_update', $now);
|
$appbox->set_data_to_cache($now, 'memcached_update');
|
||||||
|
|
||||||
$conn = \connection::getPDOConnection();
|
$conn = \connection::getPDOConnection();
|
||||||
|
|
||||||
|
@@ -213,7 +213,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract
|
|||||||
function mail($to, $from, $datas)
|
function mail($to, $from, $datas)
|
||||||
{
|
{
|
||||||
$subject = sprintf(_('admin::register: Inscription automatique sur %s')
|
$subject = sprintf(_('admin::register: Inscription automatique sur %s')
|
||||||
, $this->registry->get('GV_homeTitle'));
|
, GV_homeTitle);
|
||||||
|
|
||||||
$body = "<div>" . _('admin::register: un utilisateur s\'est inscrit')
|
$body = "<div>" . _('admin::register: un utilisateur s\'est inscrit')
|
||||||
. "</div>\n";
|
. "</div>\n";
|
||||||
|
@@ -143,8 +143,6 @@ class mail
|
|||||||
|
|
||||||
public static function mail_confirm_registered($email)
|
public static function mail_confirm_registered($email)
|
||||||
{
|
{
|
||||||
$registry = \registry::get_instance();
|
|
||||||
|
|
||||||
$subject = _('login::register: sujet email : confirmation de votre adresse email');
|
$subject = _('login::register: sujet email : confirmation de votre adresse email');
|
||||||
|
|
||||||
$body = "<div>" . _('login::register: merci d\'avoir confirme votre adresse email') . "</div>\n";
|
$body = "<div>" . _('login::register: merci d\'avoir confirme votre adresse email') . "</div>\n";
|
||||||
|
@@ -1934,8 +1934,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface
|
|||||||
*/
|
*/
|
||||||
public function get_data_from_cache($option = null)
|
public function get_data_from_cache($option = null)
|
||||||
{
|
{
|
||||||
\cache_databox::refresh($this->get_sbas_id());
|
|
||||||
|
|
||||||
$databox = $this->get_databox();
|
$databox = $this->get_databox();
|
||||||
|
|
||||||
return $databox->get_data_from_cache($this->get_cache_key($option));
|
return $databox->get_data_from_cache($this->get_cache_key($option));
|
||||||
|
@@ -211,7 +211,6 @@ class record_preview extends record_adapter
|
|||||||
public function get_train($pos = 0, $query = '', searchEngine_adapter $search_engine = null)
|
public function get_train($pos = 0, $query = '', searchEngine_adapter $search_engine = null)
|
||||||
{
|
{
|
||||||
if ($this->train)
|
if ($this->train)
|
||||||
|
|
||||||
return $this->train;
|
return $this->train;
|
||||||
|
|
||||||
switch ($this->env)
|
switch ($this->env)
|
||||||
@@ -274,7 +273,6 @@ class record_preview extends record_adapter
|
|||||||
public function get_title($highlight = '', searchEngine_adapter $search_engine = null)
|
public function get_title($highlight = '', searchEngine_adapter $search_engine = null)
|
||||||
{
|
{
|
||||||
if ($this->title)
|
if ($this->title)
|
||||||
|
|
||||||
return $this->title;
|
return $this->title;
|
||||||
|
|
||||||
$this->title = collection::getLogo($this->get_base_id()) . ' ';
|
$this->title = collection::getLogo($this->get_base_id()) . ' ';
|
||||||
@@ -331,7 +329,6 @@ class record_preview extends record_adapter
|
|||||||
public function get_short_history()
|
public function get_short_history()
|
||||||
{
|
{
|
||||||
if (!is_null($this->short_history))
|
if (!is_null($this->short_history))
|
||||||
|
|
||||||
return $this->short_history;
|
return $this->short_history;
|
||||||
|
|
||||||
$tab = array();
|
$tab = array();
|
||||||
@@ -424,7 +421,6 @@ class record_preview extends record_adapter
|
|||||||
public function get_view_popularity()
|
public function get_view_popularity()
|
||||||
{
|
{
|
||||||
if (!is_null($this->view_popularity))
|
if (!is_null($this->view_popularity))
|
||||||
|
|
||||||
return $this->view_popularity;
|
return $this->view_popularity;
|
||||||
$appbox = appbox::get_instance();
|
$appbox = appbox::get_instance();
|
||||||
$session = $appbox->get_session();
|
$session = $appbox->get_session();
|
||||||
@@ -522,7 +518,6 @@ class record_preview extends record_adapter
|
|||||||
public function get_refferer_popularity()
|
public function get_refferer_popularity()
|
||||||
{
|
{
|
||||||
if (!is_null($this->refferer_popularity))
|
if (!is_null($this->refferer_popularity))
|
||||||
|
|
||||||
return $this->refferer_popularity;
|
return $this->refferer_popularity;
|
||||||
$appbox = appbox::get_instance();
|
$appbox = appbox::get_instance();
|
||||||
$session = $appbox->get_session();
|
$session = $appbox->get_session();
|
||||||
@@ -609,7 +604,6 @@ class record_preview extends record_adapter
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (!is_null($this->download_popularity))
|
if (!is_null($this->download_popularity))
|
||||||
|
|
||||||
return $this->download_popularity;
|
return $this->download_popularity;
|
||||||
$appbox = appbox::get_instance();
|
$appbox = appbox::get_instance();
|
||||||
$session = $appbox->get_session();
|
$session = $appbox->get_session();
|
||||||
|
@@ -762,7 +762,6 @@ class set_export extends set_abstract
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (isset($list['complete']) && $list['complete'] === true)
|
if (isset($list['complete']) && $list['complete'] === true)
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
@@ -890,39 +889,30 @@ class set_export extends set_abstract
|
|||||||
|
|
||||||
$buffer = array();
|
$buffer = array();
|
||||||
|
|
||||||
if ($sxe = simplexml_load_string($desc))
|
foreach ($record->get_caption()->get_fields() as $field)
|
||||||
{
|
{
|
||||||
$z = $sxe->xpath('/record/description');
|
if (($rights || !isset($restrict[$field->get_name()])))
|
||||||
if ($z && is_array($z))
|
|
||||||
{
|
{
|
||||||
foreach ($z[0] as $ki => $vi)
|
|
||||||
{
|
|
||||||
if (($rights || !isset($restrict[$ki])))
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
switch ($format)
|
switch ($format)
|
||||||
{
|
{
|
||||||
case 'yaml':
|
case 'yaml':
|
||||||
case 'yml':
|
case 'yml':
|
||||||
|
|
||||||
$vi = trim($vi);
|
$vi = $field->get_value();
|
||||||
if (ctype_digit($vi))
|
if (ctype_digit($vi))
|
||||||
$vi = (int) $vi;
|
$vi = (int) $vi;
|
||||||
|
|
||||||
$buffer[trim($ki)] = $vi;
|
$buffer[$field->get_name()] = $vi;
|
||||||
break;
|
break;
|
||||||
case 'xml':
|
case 'xml':
|
||||||
default:
|
default:
|
||||||
$dom_el = $dom->createElement($ki);
|
$dom_el = $dom->createElement($field->get_name());
|
||||||
$dom_el->appendChild($dom->createTextNode(trim($vi)));
|
$dom_el->appendChild($dom->createTextNode($field->get_value(true)));
|
||||||
$dom_desc->appendChild($dom_el);
|
$dom_desc->appendChild($dom_el);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$buffer = array('record' => array('description' => $buffer));
|
$buffer = array('record' => array('description' => $buffer));
|
||||||
|
|
||||||
|
@@ -112,7 +112,7 @@ if ((!is_null($parm['login']) && !is_null($parm['pwd'])) || $is_guest)
|
|||||||
|
|
||||||
return phrasea::redirect($url);
|
return phrasea::redirect($url);
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (\Exception $e)
|
||||||
{
|
{
|
||||||
return phrasea::redirect("/login/?redirect=" . $parm['redirect'] . "&error=".$e->getMessage().$e->getFile().$e->getLine() );
|
return phrasea::redirect("/login/?redirect=" . $parm['redirect'] . "&error=".$e->getMessage().$e->getFile().$e->getLine() );
|
||||||
}
|
}
|
||||||
@@ -140,4 +140,3 @@ else
|
|||||||
{
|
{
|
||||||
return phrasea::redirect("/login/");
|
return phrasea::redirect("/login/");
|
||||||
}
|
}
|
||||||
?>
|
|
||||||
|
Reference in New Issue
Block a user