mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Fix tests
This commit is contained in:
@@ -615,7 +615,7 @@ class API_V1_adapter extends API_V1_Abstract
|
||||
$record = $this->app['phraseanet.appbox']->get_databox($databox_id)->get_record($record_id);
|
||||
$fields = $record->get_caption()->get_fields();
|
||||
|
||||
$ret = array();
|
||||
$ret = array('caption_metadatas' => array());
|
||||
|
||||
foreach ($fields as $field) {
|
||||
$ret['caption_metadatas'][] = array(
|
||||
|
@@ -798,7 +798,7 @@ class databox extends base
|
||||
return $this;
|
||||
}
|
||||
|
||||
protected function feed_meta_fields()
|
||||
public function feed_meta_fields()
|
||||
{
|
||||
$sxe = $this->get_sxml_structure();
|
||||
|
||||
@@ -832,21 +832,20 @@ class databox extends base
|
||||
|
||||
$meta_struct_field = databox_field::create($this->app, $this, $fname, $multi);
|
||||
$meta_struct_field
|
||||
->set_readonly(isset($field['readonly']) ? $field['readonly'] : 0)
|
||||
->set_indexable(isset($field['index']) ? $field['index'] : '1')
|
||||
->set_separator(isset($field['separator']) ? $field['separator'] : '')
|
||||
->set_required((isset($field['required']) && $field['required'] == 1))
|
||||
->set_business((isset($field['business']) && $field['business'] == 1))
|
||||
->set_readonly(isset($field['readonly']) ? (string) $field['readonly'] : 0)
|
||||
->set_indexable(isset($field['index']) ? (string) $field['index'] : '1')
|
||||
->set_separator(isset($field['separator']) ? (string) $field['separator'] : '')
|
||||
->set_required((isset($field['required']) && (string) $field['required'] == 1))
|
||||
->set_business((isset($field['business']) && (string) $field['business'] == 1))
|
||||
->set_type($type)
|
||||
->set_tbranch(isset($field['tbranch']) ? $field['tbranch'] : '')
|
||||
->set_thumbtitle(isset($field['thumbtitle']) ? $field['thumbtitle'] : (isset($field['thumbTitle']) ? $field['thumbTitle'] : '0'))
|
||||
->set_report(isset($field['report']) ? $field['report'] : '1')
|
||||
->set_tbranch(isset($field['tbranch']) ? (string) $field['tbranch'] : '')
|
||||
->set_thumbtitle(isset($field['thumbtitle']) ? (string) $field['thumbtitle'] : (isset($field['thumbTitle']) ? $field['thumbTitle'] : '0'))
|
||||
->set_report(isset($field['report']) ? (string) $field['report'] : '1')
|
||||
->save();
|
||||
|
||||
try {
|
||||
$meta_struct_field->set_tag(\databox_field::loadClassFromTagName($src))->save();
|
||||
} catch (Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -96,8 +96,8 @@ class patch_320c implements patchInterface
|
||||
$xp_struct = $databox->get_xpath_structure();
|
||||
|
||||
foreach ($sxe->description->children() as $fname => $field) {
|
||||
$src = trim(isset($field['src']) ? $field['src'] : '');
|
||||
|
||||
$src = trim(isset($field['src']) ? $field['src'] : '');
|
||||
if (array_key_exists($src, $phrasea_maps)) {
|
||||
$src = $phrasea_maps[$src];
|
||||
}
|
||||
@@ -111,9 +111,7 @@ class patch_320c implements patchInterface
|
||||
}
|
||||
|
||||
$databox->saveStructure($dom_struct);
|
||||
|
||||
$ext_databox = new extended_databox($databox->get_sbas_id());
|
||||
$ext_databox->migrate_fields();
|
||||
$databox->feed_meta_fields();
|
||||
|
||||
$databox->delete_data_from_cache(databox::CACHE_STRUCTURE);
|
||||
$databox->delete_data_from_cache(databox::CACHE_META_STRUCT);
|
||||
@@ -129,19 +127,3 @@ class patch_320c implements patchInterface
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class extended_databox extends databox
|
||||
{
|
||||
|
||||
public function __construct($sbas_id)
|
||||
{
|
||||
parent::__construct($sbas_id);
|
||||
}
|
||||
|
||||
public function migrate_fields()
|
||||
{
|
||||
$this->feed_meta_fields();
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
@@ -174,8 +174,6 @@ class patch_320f implements patchInterface
|
||||
}
|
||||
|
||||
if ( ! ($collection instanceof collection)) {
|
||||
echo "unable to find a collection to protect feeds";
|
||||
|
||||
return false;
|
||||
}
|
||||
$feed->set_collection($collection);
|
||||
|
@@ -19,9 +19,11 @@ class sphinxrt
|
||||
protected static $_instance;
|
||||
protected static $_failure = false;
|
||||
protected $connection;
|
||||
protected $registry;
|
||||
|
||||
protected function __construct(registry $registry)
|
||||
{
|
||||
$this->registry = $registry;
|
||||
try {
|
||||
$dsn = sprintf('mysql:host=%s;port=%s;', $registry->get('GV_sphinx_rt_host'), $registry->get('GV_sphinx_rt_port'));
|
||||
$this->connection = @new PDO($dsn);
|
||||
@@ -64,7 +66,7 @@ class sphinxrt
|
||||
|
||||
$cl = new SphinxClient();
|
||||
|
||||
$cl->SetServer($registry->get('GV_sphinx_host'), (int) $registry->get('GV_sphinx_port'));
|
||||
$cl->SetServer($this->registry->get('GV_sphinx_host'), (int) $this->registry->get('GV_sphinx_port'));
|
||||
$cl->SetConnectTimeout(1);
|
||||
|
||||
foreach ($index_ids as $index_id)
|
||||
@@ -92,7 +94,7 @@ class sphinxrt
|
||||
return $this;
|
||||
}
|
||||
|
||||
$cl->SetServer($registry->get('GV_sphinx_host'), (int) $registry->get('GV_sphinx_port'));
|
||||
$cl->SetServer($this->registry->get('GV_sphinx_host'), (int) $this->registry->get('GV_sphinx_port'));
|
||||
$cl->SetConnectTimeout(1);
|
||||
|
||||
$status = strrev($status);
|
||||
|
Reference in New Issue
Block a user