Remove binary adapters

This commit is contained in:
Romain Neutron
2012-04-25 13:33:15 +02:00
parent 0896b2073a
commit 97b635e6b4

View File

@@ -91,15 +91,12 @@ class databox extends base
protected static $_instances = array();
const BASE_TYPE = self::DATA_BOX;
const CACHE_META_STRUCT = 'meta_struct';
const CACHE_THESAURUS = 'thesaurus';
const CACHE_COLLECTIONS = 'collections';
const CACHE_STRUCTURE = 'structure';
const PIC_PDF = 'logopdf';
protected $cache;
protected $connection;
protected $registry;
@@ -118,7 +115,7 @@ class databox extends base
$connection_params = phrasea::sbas_params();
if (!isset($connection_params[$sbas_id]))
if ( ! isset($connection_params[$sbas_id]))
throw new Exception_DataboxNotFound ();
$this->host = $connection_params[$sbas_id]['host'];
@@ -207,7 +204,7 @@ class databox extends base
{
assert(is_int($sbas_id));
assert($sbas_id > 0);
if (!array_key_exists($sbas_id, self::$_instances))
if ( ! array_key_exists($sbas_id, self::$_instances))
{
self::$_instances[$sbas_id] = new self($sbas_id);
}
@@ -302,7 +299,7 @@ class databox extends base
foreach ($rs as $rowbas)
{
if (!isset($trows[$rowbas[$sortk1]]))
if ( ! isset($trows[$rowbas[$sortk1]]))
$trows[$rowbas[$sortk1]] = array();
$trows[$rowbas[$sortk1]][$rowbas[$sortk2]] = array(
"coll_id" => $rowbas["coll_id"],
@@ -451,7 +448,6 @@ class databox extends base
$stmt->closeCursor();
if ($row)
return self::get_instance((int) $row['sbas_id']);
try
@@ -576,8 +572,9 @@ class databox extends base
public function get_meta_structure()
{
if ($this->meta_struct)
{
return $this->meta_struct;
}
try
{
@@ -625,8 +622,10 @@ class databox extends base
*/
public function get_subdef_structure()
{
if (!$this->subdef_struct)
if ( ! $this->subdef_struct)
{
$this->subdef_struct = new databox_subdefsStructure($this);
}
return $this->subdef_struct;
}
@@ -637,9 +636,9 @@ class databox extends base
* @param <type> $date
* @return <type>
*/
public static function dispatch($repository_path, $date=false)
public static function dispatch($repository_path, $date = false)
{
if (!$date)
if ( ! $date)
$date = date('Y-m-d H:i:s');
$repository_path = p4string::addEndSlash($repository_path);
@@ -649,7 +648,7 @@ class databox extends base
$day = date('d', strtotime($date));
$n = 0;
$comp = $year . '/' . $month . '/' . $day . '/';
$comp = $year . DIRECTORY_SEPARATOR . $month . DIRECTORY_SEPARATOR . $day . DIRECTORY_SEPARATOR;
$condition = true;
@@ -657,10 +656,13 @@ class databox extends base
while (($pathout = $repository_path . $comp . self::addZeros($n)) && is_dir($pathout) && self::more_than_limit_in_dir($pathout))
{
$n++;
$n ++;
}
if (!is_dir($pathout))
if ( ! is_dir($pathout))
{
system_file::mkdir($pathout);
}
return p4string::addEndSlash($pathout);
@@ -693,13 +695,12 @@ class databox extends base
{
if ($file != '.' && $file != '..')
{
$n++;
$n ++;
}
}
}
}
if ($n > $limit)
return true;
return false;
@@ -949,7 +950,7 @@ class databox extends base
$src = trim(isset($field['src']) ? $field['src'] : '');
$meta_id = isset($field['meta_id']) ? $field['meta_id'] : null;
if (!is_null($meta_id))
if ( ! is_null($meta_id))
continue;
@@ -1035,7 +1036,7 @@ class databox extends base
$stmt->execute(array(':coll_id' => $row['coll_id'], ':sbas_id' => $this->get_sbas_id()));
$base_ids[] = $base_id = $conn->lastInsertId();
if (!empty($row['logo']))
if ( ! empty($row['logo']))
{
file_put_contents($registry->get('GV_RootPath') . 'config/minilogos/' . $base_id, $row['logo']);
}
@@ -1216,7 +1217,6 @@ class databox extends base
public function get_structure()
{
if ($this->structure)
return $this->structure;
$this->structure = $this->retrieve_structure();
@@ -1257,7 +1257,6 @@ class databox extends base
public function get_cterms()
{
if ($this->cterms)
return $this->cterms;
$sql = "SELECT value FROM pref WHERE prop='cterms'";
@@ -1395,7 +1394,7 @@ class databox extends base
continue;
}
if (!isset($AvSubdefs[$subdefgroup_name]))
if ( ! isset($AvSubdefs[$subdefgroup_name]))
$AvSubdefs[$subdefgroup_name] = array();
foreach ($subdefs as $sd)
@@ -1407,7 +1406,7 @@ class databox extends base
$errors[] = _('ERREUR : Les name de subdef sont uniques par groupe de subdefs et necessaire');
continue;
}
if (!in_array($sd_class, array('thumbnail', 'preview', 'document')))
if ( ! in_array($sd_class, array('thumbnail', 'preview', 'document')))
{
$errors[] = _('ERREUR : La classe de subdef est necessaire et egal a "thumbnail","preview" ou "document"');
continue;
@@ -1424,7 +1423,6 @@ class databox extends base
public function get_cgus()
{
if ($this->cgus)
return $this->cgus;
$this->load_cgus();
@@ -1461,7 +1459,7 @@ class databox extends base
$avLanguages = User_Adapter::avLanguages();
foreach ($avLanguages as $lang)
foreach ($lang as $k => $v)
if (!isset($TOU[$k]))
if ( ! isset($TOU[$k]))
$missing_locale[] = $k;
$date_obj = new DateTime();