Merge with master

This commit is contained in:
Romain Neutron
2012-02-07 17:47:39 +01:00
8 changed files with 347 additions and 355 deletions

View File

@@ -180,6 +180,12 @@ abstract class base implements cache_cacheableInterface
*/
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));
}

View File

@@ -33,13 +33,11 @@ class cache_databox
$registry = \registry::get_instance();
$cache_appbox = $appbox->get_cache();
$last_update = null;
try
{
$last_update = $cache_appbox->get('memcached_update');
$last_update = $appbox->get_data_from_cache('memcached_update');
}
catch (\Exception $e)
{
@@ -51,7 +49,7 @@ class cache_databox
else
$last_update = new \DateTime('-10 years');
if ($date <= $last_update || !$cache_appbox->ping())
if ($date <= $last_update || !$appbox->get_cache()->ping())
{
return;
}
@@ -97,10 +95,19 @@ class cache_databox
$stmt = $connsbas->prepare($sql);
$stmt->execute($params);
$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;
case 'structure':
$cache_appbox->delete(\appbox::CACHE_LIST_BASES);
$cache_appbox->delete(\appbox::CACHE_SBAS_IDS);
$appbox->delete_data_from_cache(\appbox::CACHE_LIST_BASES);
$appbox->delete_data_from_cache(\appbox::CACHE_SBAS_IDS);
$sql = 'DELETE FROM memcached
WHERE site_id = :site_id AND type="structure" AND value = :value';
@@ -120,7 +127,7 @@ class cache_databox
$date = new \DateTime();
$now = $date->format(DATE_ISO8601);
$cache_appbox->set('memcached_update', $now);
$appbox->set_data_to_cache($now, 'memcached_update');
$conn = \connection::getPDOConnection();

View File

@@ -213,7 +213,7 @@ class eventsmanager_notify_autoregister extends eventsmanager_notifyAbstract
function mail($to, $from, $datas)
{
$subject = sprintf(_('admin::register: Inscription automatique sur %s')
, $this->registry->get('GV_homeTitle'));
, GV_homeTitle);
$body = "<div>" . _('admin::register: un utilisateur s\'est inscrit')
. "</div>\n";

View File

@@ -143,8 +143,6 @@ class mail
public static function mail_confirm_registered($email)
{
$registry = \registry::get_instance();
$subject = _('login::register: sujet email : confirmation de votre adresse email');
$body = "<div>" . _('login::register: merci d\'avoir confirme votre adresse email') . "</div>\n";

View File

@@ -1934,8 +1934,6 @@ class record_adapter implements record_Interface, cache_cacheableInterface
*/
public function get_data_from_cache($option = null)
{
\cache_databox::refresh($this->get_sbas_id());
$databox = $this->get_databox();
return $databox->get_data_from_cache($this->get_cache_key($option));

View File

@@ -86,7 +86,7 @@ class record_preview extends record_adapter
* @param boolean $reload_train
* @return record_preview
*/
public function __construct($env, $pos, $contId, $reload_train, searchEngine_adapter $search_engine =null, $query='')
public function __construct($env, $pos, $contId, $reload_train, searchEngine_adapter $search_engine = null, $query = '')
{
$appbox = appbox::get_instance();
$Core = bootstrap::getCore();
@@ -208,10 +208,9 @@ class record_preview extends record_adapter
return $this;
}
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)
return $this->train;
switch ($this->env)
@@ -271,10 +270,9 @@ class record_preview extends record_adapter
*
* @return String
*/
public function get_title($highlight = '', searchEngine_adapter $search_engine=null)
public function get_title($highlight = '', searchEngine_adapter $search_engine = null)
{
if ($this->title)
return $this->title;
$this->title = collection::getLogo($this->get_base_id()) . ' ';
@@ -331,7 +329,6 @@ class record_preview extends record_adapter
public function get_short_history()
{
if (!is_null($this->short_history))
return $this->short_history;
$tab = array();
@@ -424,7 +421,6 @@ class record_preview extends record_adapter
public function get_view_popularity()
{
if (!is_null($this->view_popularity))
return $this->view_popularity;
$appbox = appbox::get_instance();
$session = $appbox->get_session();
@@ -522,7 +518,6 @@ class record_preview extends record_adapter
public function get_refferer_popularity()
{
if (!is_null($this->refferer_popularity))
return $this->refferer_popularity;
$appbox = appbox::get_instance();
$session = $appbox->get_session();
@@ -609,7 +604,6 @@ class record_preview extends record_adapter
{
if (!is_null($this->download_popularity))
return $this->download_popularity;
$appbox = appbox::get_instance();
$session = $appbox->get_session();

View File

@@ -762,7 +762,6 @@ class set_export extends set_abstract
return false;
}
if (isset($list['complete']) && $list['complete'] === true)
return;
@@ -890,39 +889,30 @@ class set_export extends set_abstract
$buffer = array();
if ($sxe = simplexml_load_string($desc))
foreach ($record->get_caption()->get_fields() as $field)
{
$z = $sxe->xpath('/record/description');
if ($z && is_array($z))
if (($rights || !isset($restrict[$field->get_name()])))
{
foreach ($z[0] as $ki => $vi)
{
if (($rights || !isset($restrict[$ki])))
{
switch ($format)
{
case 'yaml':
case 'yml':
$vi = trim($vi);
$vi = $field->get_value();
if (ctype_digit($vi))
$vi = (int) $vi;
$buffer[trim($ki)] = $vi;
$buffer[$field->get_name()] = $vi;
break;
case 'xml':
default:
$dom_el = $dom->createElement($ki);
$dom_el->appendChild($dom->createTextNode(trim($vi)));
$dom_el = $dom->createElement($field->get_name());
$dom_el->appendChild($dom->createTextNode($field->get_value(true)));
$dom_desc->appendChild($dom_el);
break;
}
}
}
}
}
$buffer = array('record' => array('description' => $buffer));

View File

@@ -112,7 +112,7 @@ if ((!is_null($parm['login']) && !is_null($parm['pwd'])) || $is_guest)
return phrasea::redirect($url);
}
catch (Exception $e)
catch (\Exception $e)
{
return phrasea::redirect("/login/?redirect=" . $parm['redirect'] . "&error=".$e->getMessage().$e->getFile().$e->getLine() );
}
@@ -140,4 +140,3 @@ else
{
return phrasea::redirect("/login/");
}
?>