public function getEntities($filters, $return, $offset) { // override base to add viewLink field $entities = parent::getEntities($filters, $return, $offset); for ($i = 0; $i < count($entities); $i++) { $entities[$i]["viewLink"] = "collection.php?id=" . $entities[$i]["id"]; } return $entities; }
public function getEntities($filters, $return, $offset) { // override base to augment fields $entities = parent::getEntities($filters, $return, $offset); for ($i = 0; $i < count($entities); $i++) { $entities[$i]["viewLink"] = "feature.php?id=" . $entities[$i]["id"]; $entities[$i]["post date"] = Format::formatDateLine($entities[$i]["datePosted"], true); } return $entities; }
public function friendlyName($fieldName) { // override if you want to to have a more human-readble name for one or more fields if ($fieldName == 'categorytypeid') { return 'Category Type'; } elseif ($fieldName == 'seq') { return 'Sequence'; } else { return parent::friendlyName($fieldName); } }
public function getAvailableChildren($fieldname) { if ($fieldname == "pageCollections") { $query = "select id, name from pageCollection where tenantid=" . $this->tenantid; $results = Database::executeQuery($query); if ($results->num_rows == 0) { return array(); } else { $entities = array(); while ($r = mysqli_fetch_assoc($results)) { $entities[] = $r; } return $entities; } return $results->fetch; } else { return parent::getAvailableChildren($fieldname); } }
public function addEntity($data) { Log::debug('Adding new user for tenant ' + $this->tenantid, 5); // before save: salt & hash password and perform user-specific validation // ensure email not already in use $query = "select count(*) from user where email=" . Database::queryString($data->{"email"}) . ";"; $result = Database::executeQuery($query); while ($arr = mysqli_fetch_row($result)) { if ($arr[0] > 0) { throw new Exception("That email address is already in use. Please select another."); } } $pass = Utility::generateHash($data->{"password"}); $data->{"password"} = $pass; $newid = parent::addEntity($data); // by default, a newly created user gets assigned to the current tenant $query = "call addTenantUserRole(" . Database::queryNumber($newid) . "," . Database::queryNumber($this->tenantid) . "," . Database::queryString('standard') . ");"; Database::executeQuery($query); return $newid; }
public static function edit_parameter_item($item_id) { if (is_numeric($item_id)) { $data_entity_id = DataEntity::get_entry_by_item_id($item_id); $parameter_id = Parameter::get_parameter_id_by_data_entity_id($data_entity_id); $parameter = Parameter::get_instance($parameter_id); if ($parameter->is_read_access()) { self::detail($parameter, http_build_query(Retrace::resolve_retrace_string($_GET['retrace'])), false); } } else { throw new ItemIDMissingException(); } }
/** * @see ProjectInterface::get_description() * @return string */ public function get_description() { if ($this->project_id) { $project_item = new ProjectItem($this->project_id); $item_array = $project_item->get_project_items(); if (is_array($item_array) and count($item_array) >= 1) { foreach ($item_array as $item_key => $item_value) { if (DataEntity::is_kind_of("value", $item_value) == true) { $data_entity_id = DataEntity::get_entry_by_item_id($item_value); $value_id = Value::get_value_id_by_data_entity_id($data_entity_id); if (Value::is_entry_type_of($value_id, 2) == true) { $description_id = $value_id; } } } } $value = Value::get_instance($description_id); if ($value->get_type_id() == 2) { return unserialize($value->get_value()); } } else { return null; } }
/** * @see VirtualFolderInterface::delete() * @return bool */ public final function delete() { global $transaction; if ($this->virtual_folder_id and $this->virtual_folder) { $transaction_id = $transaction->begin(); if ($this->unset_children() == false) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } return false; } $virtual_folder_delete_event = new VirtualFolderDeleteEvent($this->virtual_folder_id); $event_handler = new EventHandler($virtual_folder_delete_event); if ($event_handler->get_success() == false) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } return false; } if (parent::delete() == false) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } return false; } if ($this->virtual_folder->delete() == true) { if ($transaction_id != null) { $transaction->commit($transaction_id); } return true; } else { if ($transaction_id != null) { $transaction->rollback($transaction_id); } return false; } } else { return false; } }
/** * @return bool * @throws ParameterDeleteVersionValueFailedException * @throws ParameterDeleteVersionFailedException * @throws ParameterDeleteFailedException * @throws ParameterDeleteIDMissingException */ protected function delete() { global $transaction; if ($this->parameter_id and $this->parameter) { $transaction_id = $transaction->begin(); try { $parameter_version_array = ParameterVersion_Access::list_entries_by_parameter_id($this->parameter_id); if (is_array($parameter_version_array) and count($parameter_version_array) >= 1) { foreach ($parameter_version_array as $key => $value) { if (ParameterFieldValue_Access::delete_by_parameter_version_id($value) == false) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } throw new ParameterDeleteVersionValueFailedException(); } $parameter_version = new ParameterVersion_Access($value); if ($parameter_version->delete() == false) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } throw new ParameterDeleteVersionFailedException(); } } } if ($this->parameter->delete() == false) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } throw new ParameterDeleteFailedException(); } parent::delete(); } catch (BaseException $e) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } throw $e; } if ($transaction_id != null) { $transaction->commit($transaction_id); } return true; } else { throw new ParameterDeleteIDMissingException(); } }
public function deleteEntity($id) { // need special handling for media entities because we must manage the CDN, too $entity = $this->getEntity($id); if (!is_null($entity["url"]) || strlen($entity["url"]) > 0) { $cdn = new Config::$cdn_classname($this->userid, $this->tenantid); try { $result = $cdn->removeContent($entity["url"]); } catch (Exception $ex) { // may want to offer alternate handling in future, but for now if we can't delete from CDN we don't delete // from data store throw new Exception('Unable to delete media: ' . $ex->getMessage()); } } if (!is_null($entity["thumbnailurl"]) || strlen($entity["thumbnailurl"]) > 0) { $cdn = new Config::$cdn_classname($this->userid, $this->tenantid); try { $result = $cdn->removeContent($entity["thumbnailurl"]); } catch (Exception $ex) { // for now: do nothing. Can assume there may not be a thumbnail for all media } } return parent::deleteEntity($id); }
/** * @see SampleInterface::clone_sample() * @param integer $source_sample_id * @param string $name * @param integer $manufacturer_id * @param integer $location_id * @param string $desc * @param integer $language_id * @param string $date_of_expiry * @param integer $expiry_warning * @param array $value_array * @param array $item_array * @return integer * @throws SampleCloneIDMissingException * @throws SampleCloneCreateException * @throws SampleCloneCreateFolderException * @throws SampleCloneCreateSubFolderException * @throws SampleCloneCreateAsItemException * @throws SampleCloneCreateLocationException * @throws SampleCloneCreateFailedException * @throws SampleCloneUserException * @throws SampleCloneOrganisationUnitException * @throws SampleCloneLocationException * @throws SampleCloneValueException * @throws SampleCloneFileException * @throws SampleCloneParentException * @throws SampleCloneItemException */ public function clone_sample($source_sample_id, $name, $manufacturer_id, $location_id, $desc, $language_id, $date_of_expiry, $expiry_warning, $value_array, $item_array) { global $user, $transaction; if (is_numeric($source_sample_id) and $name) { $source_sample = new Sample($source_sample_id); $source_sample_security = new SampleSecurity($source_sample_id); $source_sample_folder_id = SampleFolder::get_folder_by_sample_id($source_sample_id); $transaction_id = $transaction->begin(); try { if (($sample_id = $this->sample->create($name, $user->get_user_id(), $source_sample->get_template_id(), $manufacturer_id, $desc, $language_id, $date_of_expiry, $expiry_warning)) == null) { throw new SampleCloneCreateFailedException(); } if ($desc) { $this->sample->set_comment_text_search_vector($desc, "english"); } $sub_folder_name_array = $this->create_sample_folder($sample_id, $source_sample->get_template_id()); $this->create_sample_item($sample_id); $sample_security = new SampleSecurity($sample_id); $source_sample_user_list = $source_sample_security->list_users(); if (is_array($source_sample_user_list) and count($source_sample_user_list) >= 1) { foreach ($source_sample_user_list as $key => $value) { if ($sample_security->create_user($value, true, true) == null) { throw new SampleCloneUserException(); } } } $source_sample_organisation_list = $source_sample_security->list_organisation_units(); if (is_array($source_sample_organisation_list) and count($source_sample_organisation_list) >= 1) { foreach ($source_sample_organisation_list as $key => $value) { if ($sample_security->create_organisation_unit($value) == null) { throw new SampleCloneOrganisationUnitException(); } } } // Locations $source_sample_location_array = SampleHasLocation_Access::list_entries_by_sample_id($source_sample_id); $end_sample_has_location_access = new SampleHasLocation_Access(end($source_sample_location_array)); if (is_array($source_sample_location_array) and count($source_sample_location_array) >= 1) { if ($location_id != $end_sample_has_location_access->get_location_id()) { $add_new_location = true; } else { $add_new_location = false; } foreach ($source_sample_location_array as $key => $value) { $current_sample_has_location_access = new SampleHasLocation_Access($value); $sample_has_location_access = new SampleHasLocation_Access(null); if ($sample_has_location_access->create($sample_id, $current_sample_has_location_access->get_location_id(), $user->get_user_id()) == null) { throw new SampleCloneLocationException(); } } } else { $add_new_location = true; } if (is_numeric($location_id) and $add_new_location == true and $location_id > 0) { // Create First Location $sample_has_location_access = new SampleHasLocation_Access(null); if ($sample_has_location_access->create($sample_id, $location_id, $user->get_user_id()) == null) { throw new SampleCloneCreateLocationException("Could not create location"); } } if (is_array($value_array) and count($item_array) >= 1) { $value_item_array = array(); $value_data_array = array(); foreach ($value_array as $key => $value) { $key = str_replace("value-", "", $key); $key_array = explode("-", $key, 2); if ($key_array[0] == "item") { $value_item_array[$key_array[1]] = $value; } elseif (is_numeric($key_array[0])) { $value_data_array[$key_array[0]][$key_array[1]] = $value; } } if (is_array($value_item_array) and count($value_item_array) >= 1) { foreach ($value_item_array as $key => $value) { $gid = SampleItem::get_gid_by_item_id_and_sample_id($value, $source_sample_id); $data_entity_id = DataEntity::get_entry_by_item_id($value); $value_id = Value::get_value_id_by_data_entity_id($data_entity_id); if (is_numeric($value_id)) { $value_obj = Value::get_instance($value_id); $parent_folder_id = $value_obj->get_parent_folder_id(); $value_type_id = $value_obj->get_type_id(); if ($parent_folder_id == $source_sample_folder_id) { $new_folder_id = $this->sample_folder_id; } else { $folder_name = Folder::get_name_by_id($parent_folder_id); $new_folder_id = array_search(trim(strtolower($folder_name)), $sub_folder_name_array); } if (is_numeric($new_folder_id) and is_numeric($value_type_id)) { $new_value_obj = Value::get_instance(null); $new_value_obj->create($new_folder_id, $user->get_user_id(), $value_type_id, $value_data_array[$key]); $new_value_item_id = $new_value_obj->get_item_id(); $sample_item = new SampleItem($sample_id); $sample_item->set_gid($gid); if ($sample_item->set_item_id($new_value_item_id) == false) { throw new SampleCloneValueException(); } if ($sample_item->link_item() == false) { throw new SampleCloneValueException(); } } } } } } if (is_array($item_array) and count($item_array) >= 1) { $item_type_array = array(); $item_data_array = array(); foreach ($item_array as $key => $value) { if ($value[1] == "1") { $item_explode_array = explode("-", $value[0], 2); if (!in_array($item_explode_array[0], $item_type_array)) { array_push($item_type_array, $item_explode_array[0]); } if (!is_array($item_data_array[$item_explode_array[0]])) { $item_data_array[$item_explode_array[0]] = array(); } array_push($item_data_array[$item_explode_array[0]], $item_explode_array[1]); } } if (is_array($item_type_array) and count($item_type_array) >= 1) { foreach ($item_type_array as $key => $value) { if ($value == "parent") { foreach ($item_data_array[$value] as $data_key => $data_value) { $parent_item_explode_array = explode("-", $data_value, 2); if ($parent_item_explode_array[0] and $parent_item_explode_array[1]) { $item_add_holder_event = new ItemAddHolderEvent($parent_item_explode_array[1], $parent_item_explode_array[0], $this->item_id); $event_handler = new EventHandler($item_add_holder_event); if ($event_handler->get_success() == false) { throw new SampleCloneParentException(); } } } } elseif ($value == "file") { if (is_array($item_data_array[$value]) and count($item_data_array[$value]) >= 1) { foreach ($item_data_array[$value] as $data_key => $data_value) { $gid = SampleItem::get_gid_by_item_id_and_sample_id($data_value, $source_sample_id); $data_entity_id = DataEntity::get_entry_by_item_id($data_value); $file_id = File::get_file_id_by_data_entity_id($data_entity_id); if ($file_id) { $file_obj = File::get_instance($file_id); $parent_folder_id = $file_obj->get_parent_folder_id(); if ($parent_folder_id == $source_sample_folder_id) { $new_folder_id = $this->sample_folder_id; } else { $folder_name = Folder::get_name_by_id($parent_folder_id); $new_folder_id = array_search(trim(strtolower($folder_name)), $sub_folder_name_array); } if (is_numeric($new_folder_id)) { if ($file_obj->copy($new_folder_id) == false) { throw new SampleCloneFileException(); } $new_file_item_id = $file_obj->get_item_id(); $sample_item = new SampleItem($sample_id); $sample_item->set_gid($gid); if ($sample_item->set_item_id($new_file_item_id) == false) { throw new SampleCloneFileException(); } if ($sample_item->link_item() == false) { throw new SampleCloneFileException(); } } } } } } else { if (is_array($item_data_array[$value]) and count($item_data_array[$value]) >= 1) { $handling_class = Item::get_handling_class_by_type($value); if ($handling_class) { foreach ($item_data_array[$value] as $data_key => $data_value) { $gid = SampleItem::get_gid_by_item_id_and_sample_id($data_value, $source_sample_id); $new_item_id = $handling_class::clone_item($data_value); if ($new_item_id) { $sample_item = new SampleItem($sample_id); $sample_item->set_gid($gid); if ($sample_item->set_item_id($new_item_id) == false) { throw new SampleCloneItemException(); } if ($sample_item->link_item() == false) { throw new SampleCloneItemException(); } } } } } } } } } } catch (BaseException $e) { if (is_object($this->sample_folder_object)) { $this->sample_folder_object->delete(true, true); } if ($transaction_id != null) { $transaction->rollback($transaction_id); } throw $e; } if ($transaction_id != null) { $transaction->commit($transaction_id); } self::__construct($sample_id); return $sample_id; } else { throw new SampleCloneIDMissingException(); } }
/** * @see ValueInterface::delete() * @return bool */ public function delete() { global $transaction; if ($this->value_id != null and $this->value and $this->value_version) { $transaction_id = $transaction->begin(); $value_version_array = ValueVersion_Access::list_entries_by_toid($this->value_id); unset($this->value_version); if (is_array($value_version_array) and count($value_version_array) >= 1) { foreach ($value_version_array as $key => $fe_value) { $value_version = new ValueVersion_Access($fe_value); if ($value_version->delete() == false) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } return false; } } if ($this->value->delete() == true) { if (parent::delete() == true) { if ($transaction_id != null) { $transaction->commit($transaction_id); } return true; } else { if ($transaction_id != null) { $transaction->rollback($transaction_id); } return false; } } else { if ($transaction_id != null) { $transaction->rollback($transaction_id); } return false; } } else { if ($transaction_id != null) { $transaction->rollback($transaction_id); } return false; } } else { return false; } }
protected function getEntityCountQuery($filters) { $query = ''; $name = Utility::getRequestVariable('name', ''); if (strlen($name) > 0) { $query = "call countLocationsBySearchCriteria(" . $this->tenantid . "," . Database::queryString($name) . ")"; } else { $query = parent::getEntityCountQuery($filters); } return $query; }
/** * @see FolderInterface::get_object_id_path() * @return integer */ public function get_object_id_path() { if ($this->folder_id) { $data_entity = DataEntity::get_instance($this->data_entity_id); $return_array = array(); array_push($return_array, $this->folder_id); while (($parent_data_entity_id = $data_entity->get_parent_folder()) != null) { $data_entity = DataEntity::get_instance($parent_data_entity_id); array_push($return_array, Folder_Access::get_entry_by_data_entity_id($parent_data_entity_id)); } return $return_array; } else { return null; } }
/** * @see EventListenerInterface::listen_events() * @param object $event_object * @return bool */ public static function listen_events($event_object) { global $transaction; if ($event_object instanceof ItemAddHolderEvent) { $type = $event_object->get_type(); if ($type == "sample") { $sample_id = $event_object->get_id(); $item_id = $event_object->get_item_id(); $gid = $event_object->get_gid(); $transaction_id = $transaction->begin(); if (self::create($sample_id, $item_id, $gid, null, null) == false) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } return false; } else { if ($transaction_id != null) { $transaction->commit($transaction_id); } } } } if ($event_object instanceof ItemAddEvent) { $get_array = $event_object->get_get_array(); $post_array = $event_object->get_post_array(); $item_holder = $event_object->get_item_holder(); $item_holder_name = $event_object->get_item_holder_name(); if ($get_array['nav'] == "sample" and is_numeric($get_array['sample_id']) and !$get_array['parent'] and !$get_array['parent_key']) { $transaction_id = $transaction->begin(); if ($get_array['parent_sample'] == "1") { $parent = true; } else { $parent = false; } if ($item_holder == true and $item_holder_name) { $item_holder_class = Item::get_holder_handling_class_by_name($item_holder_name); $item_holder_instance = $item_holder_class::get_instance_by_item_id($event_object->get_item_id()); if (self::$sample_instance_array[$get_array['sample_id']]) { $sample = self::$sample_instance_array[$get_array['sample_id']]; } else { $sample = new Sample($get_array['sample_id']); self::$sample_instance_array[$get_array['sample_id']] = $sample; } $required_sub_item_array = $sample->list_required_sub_items($get_array['key']); if (is_array($required_sub_item_array) and count($required_sub_item_array) >= 1) { if ($required_sub_item_array[0] == "all") { $sub_item_array = $item_holder_instance->get_item_holder_items(null); if (is_array($sub_item_array) and count($sub_item_array)) { foreach ($sub_item_array as $sub_item_key => $sub_item_value) { if (self::create($get_array['sample_id'], $sub_item_value, null, null, null, $event_object->get_item_id()) == false) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } return false; } if (DataEntity::is_kind_of("file", $sub_item_value) or DataEntity::is_kind_of("value", $sub_item_value) or DataEntity::is_kind_of("parameter", $sub_item_value)) { $data_entity_id = DataEntity::get_entry_by_item_id($sub_item_value); $folder_id = $sample->get_item_holder_value("folder_id"); $parent_data_entity_id = Folder::get_data_entity_id_by_folder_id($folder_id); $child_data_entity = new DataEntity($data_entity_id); if ($child_data_entity->set_as_child_of($parent_data_entity_id, true, $parent_item_id) == false) { return false; } } } } } else { foreach ($required_sub_item_array as $key => $value) { $sub_item_array = $item_holder_instance->get_item_holder_items($value); if (is_array($sub_item_array) and count($sub_item_array)) { foreach ($sub_item_array as $sub_item_key => $sub_item_value) { if (self::create($get_array['sample_id'], $sub_item_value, null, null, null, $event_object->get_item_id()) == false) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } return false; } if (DataEntity::is_kind_of("file", $sub_item_value) or DataEntity::is_kind_of("value", $sub_item_value) or DataEntity::is_kind_of("parameter", $sub_item_value)) { $data_entity_id = DataEntity::get_entry_by_item_id($sub_item_value); $folder_id = $sample->get_item_holder_value("folder_id"); $parent_data_entity_id = Folder::get_data_entity_id_by_folder_id($folder_id); $child_data_entity = new DataEntity($data_entity_id); if ($child_data_entity->set_as_child_of($parent_data_entity_id, true, $parent_item_id) == false) { return false; } } } } } } } } if (self::create($get_array['sample_id'], $event_object->get_item_id(), $get_array['key'], $post_array['keywords'], $post_array['description'], null, $parent) == false) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } return false; } else { if ($transaction_id != null) { $transaction->commit($transaction_id); } } } if (($get_array['parent'] == "sample" or $get_array['parent'] == "parentsample") and is_numeric($get_array['key']) and is_numeric($get_array['parent_key'])) { $transaction_id = $transaction->begin(); if (is_numeric($get_array['parent_id'])) { if ($get_array['parent'] == "parentsample") { $parent_sample = true; } else { $parent_sample = false; } if (self::create($get_array['parent_id'], $event_object->get_item_id(), $get_array['key'], null, null, null, false, $parent_sample) == false) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } return false; } else { if ($transaction_id != null) { $transaction->commit($transaction_id); } } } elseif ($get_array['nav']) { $handling_class = Item::get_holder_handling_class_by_name($get_array['nav']); if (class_exists($handling_class)) { $item_holder = new $handling_class($get_array[$get_array['nav'] . '_id']); $parent_id_array = $item_holder->get_item_add_information($get_array['parent_key']); if (is_array($parent_id_array['fulfilled']) and count($parent_id_array['fulfilled']) >= 1) { foreach ($parent_id_array['fulfilled'] as $key => $value) { if (self::create($value['id'], $event_object->get_item_id(), $get_array['key']) == false) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } return false; } } if ($transaction_id != null) { $transaction->commit($transaction_id); } } } else { return false; } } } } if ($event_object instanceof ItemHolderAddEvent) { $id_array = $event_object->get_id_array(); $item_id = $event_object->get_item_id(); $parent_item_id = $event_object->get_parent_item_id(); $pos_id = $event_object->get_pos_id(); if (is_array($id_array) and count($id_array) >= 1) { if (is_array($id_array['sample']) and count($id_array['sample']) >= 1) { foreach ($id_array['sample'] as $key => $value) { $sample = new Sample($value['id']); if ($sample->is_sub_item_required($value['pos_id'], $pos_id) == true) { if (self::create($value['id'], $item_id, null, null, null, $parent_item_id, false) == false) { return false; } if (DataEntity::is_kind_of("file", $item_id) or DataEntity::is_kind_of("value", $item_id) or DataEntity::is_kind_of("parameter", $sub_item_value)) { $data_entity_id = DataEntity::get_entry_by_item_id($item_id); $folder_id = $sample->get_item_holder_value("folder_id"); $parent_data_entity_id = Folder::get_data_entity_id_by_folder_id($folder_id); $child_data_entity = new DataEntity($data_entity_id); if ($child_data_entity->set_as_child_of($parent_data_entity_id, true, $parent_item_id) == false) { return false; } } } } } } } return true; }
/** * @see FileInterface::delete() * @return bool */ public function delete() { global $transaction; if ($this->file_id != null and $this->file and $this->file_version) { $transaction_id = $transaction->begin(); $folder_id = $this->get_parent_folder_id(); $folder = Folder::get_instance($folder_id); $file_delete_event = new FileDeleteEvent($this->file_id, $folder_id, 0); $event_handler = new EventHandler($file_delete_event); if ($event_handler->get_success() == false) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } return false; } $file_version_array = FileVersion_Access::list_entries_by_toid($this->file_id); if (is_array($file_version_array) and count($file_version_array) >= 1) { $file_size = 0; $file_path_array = array(); $temp_file_id = $this->file_id; foreach ($file_version_array as $key => $value) { $file_version_access = new FileVersion_Access($value); $file_size = $file_size + $file_version_access->get_size(); $extension_array = explode(".", $file_version_access->get_name()); $extension_array_length = substr_count($file_version_access->get_name(), "."); if ($extension_array_length == 0) { $extension = ""; } else { $extension = "." . $extension_array[$extension_array_length]; } $path = constant("BASE_DIR") . "/" . $folder->get_path() . "/" . $this->data_entity_id . "-" . $file_version_access->get_internal_revision() . "" . $extension . ""; if ($file_version_access->delete()) { array_push($file_path_array, $path); } else { if ($transaction_id != null) { $transaction->rollback($transaction_id); } return false; } } $folder->decrease_filesize($this->get_owner_id(), $file_size); $file_delete = $this->file->delete(); if ($file_delete == true) { // Data Entity Delete if (parent::delete() == true) { if (is_array($file_path_array) and count($file_path_array) >= 1) { foreach ($file_path_array as $key => $value) { if (is_file($value)) { if (is_writable($value)) { $delete_success = unlink($value); if ($delete_success == false) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } $this->file->__consturct($temp_file_id); $this->file->set_flag(-1); // Corrupt return false; } } else { if ($transaction_id != null) { $transaction->rollback($transaction_id); } $this->file->__consturct($temp_file_id); $this->file->set_flag(-1); // Corrupt return false; } } } } if ($transaction_id != null) { $transaction->commit($transaction_id); } return true; } else { if ($transaction_id != null) { $transaction->rollback($transaction_id); } return false; } } else { if ($transaction_id != null) { $transaction->rollback($transaction_id); } return false; } } else { if ($transaction_id != null) { $transaction->rollback($transaction_id); } return false; } } else { return false; } }