Remove debug, fix build

This commit is contained in:
Romain Neutron
2012-05-22 22:05:46 +02:00
parent e96c2ccda6
commit c2a5767e36
4 changed files with 16 additions and 27 deletions

View File

@@ -1919,8 +1919,6 @@ class API_V1_adapter extends API_V1_Abstract
*/ */
protected function list_databox_metadata_field_properties(databox_field $databox_field) protected function list_databox_metadata_field_properties(databox_field $databox_field)
{ {
echo "listing properties for ".$databox_field->get_id()."\n";
var_dump($databox_field->get_tag());
$ret = array( $ret = array(
'id' => $databox_field->get_id(), 'id' => $databox_field->get_id(),
'namespace' => $databox_field->get_tag()->getGroupName(), 'namespace' => $databox_field->get_tag()->getGroupName(),

View File

@@ -565,15 +565,7 @@ class databox extends base
$stmt->closeCursor(); $stmt->closeCursor();
foreach ($rs as $row) { foreach ($rs as $row) {
$meta_struct->add_element(databox_field::get_instance($this, $row['id']));
try {
$meta = databox_field::get_instance($this, $row['id']);
} catch (Exception $e) {
$meta = databox_fieldUnknown::get_instance($this, $row['id']);
$meta->set_name($row['name']);
unset($e);
}
$meta_struct->add_element($meta);
} }
$this->meta_struct = $meta_struct; $this->meta_struct = $meta_struct;
$this->set_data_to_cache($this->meta_struct, self::CACHE_META_STRUCT); $this->set_data_to_cache($this->meta_struct, self::CACHE_META_STRUCT);

View File

@@ -123,6 +123,7 @@ class databox_field implements cache_cacheableInterface
protected $dces_element; protected $dces_element;
protected $Vocabulary; protected $Vocabulary;
protected $VocabularyRestriction = false; protected $VocabularyRestriction = false;
protected $on_error = false;
const TYPE_TEXT = "text"; const TYPE_TEXT = "text";
const TYPE_DATE = "date"; const TYPE_DATE = "date";
@@ -174,9 +175,11 @@ class databox_field implements cache_cacheableInterface
$this->id = (int) $id; $this->id = (int) $id;
echo "create tag from " . $row['src'] . " for id $id - name is " . $row['name'] . "\n";
$this->tag = self::loadClassFromTagName($row['src']); $this->tag = self::loadClassFromTagName($row['src']);
var_dump($this->tag);
if ($row['src'] != $this->tag->getTagname()) {
$this->on_error = true;
}
$this->name = $row['name']; $this->name = $row['name'];
$this->indexable = ! ! $row['indexable']; $this->indexable = ! ! $row['indexable'];
@@ -242,7 +245,6 @@ class databox_field implements cache_cacheableInterface
*/ */
public static function get_instance(databox &$databox, $id) public static function get_instance(databox &$databox, $id)
{ {
echo "getting instance of databox_field $id for databox " . $databox->get_sbas_id() . "\n";
$cache_key = 'field_' . $id; $cache_key = 'field_' . $id;
$instance_id = $databox->get_sbas_id() . '_' . $id; $instance_id = $databox->get_sbas_id() . '_' . $id;
if ( ! isset(self::$_instance[$instance_id]) || (self::$_instance[$instance_id] instanceof self) === false) { if ( ! isset(self::$_instance[$instance_id]) || (self::$_instance[$instance_id] instanceof self) === false) {
@@ -799,7 +801,7 @@ class databox_field implements cache_cacheableInterface
*/ */
public function is_on_error() public function is_on_error()
{ {
return false; return $this->on_error;
} }
public static function create(databox $databox, $name) public static function create(databox $databox, $name)

View File

@@ -57,7 +57,7 @@ class task_period_upgradetov32 extends task_abstract
printf("taskid %s starting." . PHP_EOL, $this->getID()); printf("taskid %s starting." . PHP_EOL, $this->getID());
$registry = registry::get_instance(); $registry = registry::get_instance();
// $registry->set('GV_cache_server_type', 'nocache', \registry::TYPE_STRING);
$registry->set('GV_sphinx', false, \registry::TYPE_BOOLEAN); $registry->set('GV_sphinx', false, \registry::TYPE_BOOLEAN);
if ( ! $this->sbas_id) { if ( ! $this->sbas_id) {
@@ -76,17 +76,14 @@ class task_period_upgradetov32 extends task_abstract
return; return;
} }
try {
foreach ($databox->get_meta_structure()->get_elements() as $struct_el) { foreach ($databox->get_meta_structure()->get_elements() as $struct_el) {
if ($struct_el instanceof databox_fieldUnknown) { if ($struct_el->is_on_error()) {
throw new Exception('Bad field');
}
}
} catch (Exception $e) {
printf("Please verify all your databox meta fields before migrating, It seems somes are wrong\n");
$this->return_value = self::RETURNSTATUS_STOPPED;
return 'stopped'; printf("Please verify all your databox meta fields before migrating, It seems somes are wrong\n");
$this->return_value = self::STATE_STOPPED;
return self::STATE_STOPPED;
}
} }
$this->running = true; $this->running = true;