diff --git a/lib/classes/API/V1/adapter.class.php b/lib/classes/API/V1/adapter.class.php index 1ce2d38917..f5ba1cf4f8 100644 --- a/lib/classes/API/V1/adapter.class.php +++ b/lib/classes/API/V1/adapter.class.php @@ -1919,8 +1919,6 @@ class API_V1_adapter extends API_V1_Abstract */ 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( 'id' => $databox_field->get_id(), 'namespace' => $databox_field->get_tag()->getGroupName(), diff --git a/lib/classes/databox.class.php b/lib/classes/databox.class.php index 54f0d22b60..49663bab48 100644 --- a/lib/classes/databox.class.php +++ b/lib/classes/databox.class.php @@ -565,15 +565,7 @@ class databox extends base $stmt->closeCursor(); foreach ($rs as $row) { - - 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); + $meta_struct->add_element(databox_field::get_instance($this, $row['id'])); } $this->meta_struct = $meta_struct; $this->set_data_to_cache($this->meta_struct, self::CACHE_META_STRUCT); diff --git a/lib/classes/databox/field.class.php b/lib/classes/databox/field.class.php index 5278bb2ce9..6bc3721cf0 100644 --- a/lib/classes/databox/field.class.php +++ b/lib/classes/databox/field.class.php @@ -123,6 +123,7 @@ class databox_field implements cache_cacheableInterface protected $dces_element; protected $Vocabulary; protected $VocabularyRestriction = false; + protected $on_error = false; const TYPE_TEXT = "text"; const TYPE_DATE = "date"; @@ -174,10 +175,12 @@ class databox_field implements cache_cacheableInterface $this->id = (int) $id; - echo "create tag from " . $row['src'] . " for id $id - name is " . $row['name'] . "\n"; $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->indexable = ! ! $row['indexable']; $this->readonly = ! ! $row['readonly']; @@ -242,7 +245,6 @@ class databox_field implements cache_cacheableInterface */ 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; $instance_id = $databox->get_sbas_id() . '_' . $id; 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() { - return false; + return $this->on_error; } public static function create(databox $databox, $name) diff --git a/lib/classes/task/period/upgradetov32.class.php b/lib/classes/task/period/upgradetov32.class.php index e418efa662..35ab4dab16 100644 --- a/lib/classes/task/period/upgradetov32.class.php +++ b/lib/classes/task/period/upgradetov32.class.php @@ -57,7 +57,7 @@ class task_period_upgradetov32 extends task_abstract printf("taskid %s starting." . PHP_EOL, $this->getID()); $registry = registry::get_instance(); -// $registry->set('GV_cache_server_type', 'nocache', \registry::TYPE_STRING); + $registry->set('GV_sphinx', false, \registry::TYPE_BOOLEAN); if ( ! $this->sbas_id) { @@ -76,17 +76,14 @@ class task_period_upgradetov32 extends task_abstract return; } - try { - foreach ($databox->get_meta_structure()->get_elements() as $struct_el) { - if ($struct_el instanceof databox_fieldUnknown) { - 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; + foreach ($databox->get_meta_structure()->get_elements() as $struct_el) { + if ($struct_el->is_on_error()) { - 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;