/** * @param PURGE_OPTIONS $options * @access private */ protected function _purge($options) { include_once 'projects/obj/release_updater.php'; $purger = new RELEASE_PURGER($this); $purger->apply($options->sub_history_item_publication_state); parent::_purge($options); }
/** * @param PURGE_OPTIONS $options * @access private */ protected function _purge($options) { if ($options->remove_resources) { @unlink($this->full_file_name()); if ($this->is_image) { @unlink($this->thumbnail_file_name()); } } parent::_purge($options); }
/** * @param PURGE_OPTIONS $options * @access private */ protected function _purge($options) { $attachment_query = $this->attachment_query(); $attachments = $attachment_query->objects(); foreach ($attachments as &$attachment) { $attachment->purge($options); } parent::_purge($options); }
/** * @param PURGE_OPTIONS $options * @access private */ protected function _purge($options) { $folder = $this->parent_folder(); $branch_query = $folder->branch_query(); $branches = $branch_query->objects(); $num_branches = sizeof($branches); $this->assert($num_branches > 1, 'The last branch in a project cannot be purged.', '_purge', 'BRANCH'); $entry_query = $this->entry_query(); $new_trunk = null; if ($folder->trunk_id == $this->id) { $idx = 0; while (!isset($new_trunk) && $idx < $num_branches) { if ($branches[$idx]->id != $this->id) { $new_trunk = $branches[$idx]; } $idx += 1; } if (isset($new_trunk)) { $history_item = $folder->new_history_item(); $history_item->publication_state = $options->sub_history_item_publication_state; $folder->trunk_id = $new_trunk->id; $folder->store_if_different($history_item); $trunk = $new_trunk; } } else { $trunk = $folder->trunk(); } /* Update every entry, making sure to create a history item for each one, indicating the change (branch removed, trunk added, main branch changed). */ $entries = $entry_query->objects(); $main_branch_info = new stdClass(); foreach ($entries as $entry) { $history_item = $entry->new_history_item(); $history_item->compare_branches = true; $history_item->publication_state = $options->sub_history_item_publication_state; $branch_infos = $entry->stored_branch_infos(); $main_branch_info = null; /* The check should actually be for equals to 1, but if an entry has no branch information because of corruption, we can clean that up here and re-assign the entry to the trunk. */ if (sizeof($branch_infos) > 0) { foreach ($branch_infos as $branch_info) { if ($branch_info->branch_id != $this->id) { if (!isset($main_branch_info)) { $main_branch_info = $branch_info; } $entry->add_branch_info($branch_info); } } } if (!isset($main_branch_info)) { $branch_info = $entry->new_branch_info($trunk); $entry->add_branch_info($branch_info); $entry->set_main_branch_info($branch_info); } else { if ($entry->main_branch_id == $this->id) { $entry->set_main_branch_info($main_branch_info); } } $entry->store_if_different($history_item); $orig_branch_infos = $entry->stored_branch_infos(); $new_branch_infos = $entry->current_branch_infos(); if (!isset($main_branch_info)) { foreach ($new_branch_infos as $branch_id => $new_branch_info) { $new_branch_info->store(); } } foreach ($orig_branch_infos as $branch_id => $orig_branch_info) { if (!isset($new_branch_infos[$branch_id])) { $orig_branch_info->purge(); } } } parent::_purge($options); }
/** * @param COMPONENT_PURGE_OPTIONS $options * @access private */ protected function _purge($options) { $entry_query = $this->entry_query(); /** @var PROJECT_ENTRY[] $entries */ $entries = $entry_query->objects(); foreach ($entries as $entry) { $history_item = $entry->new_history_item(); $history_item->publication_state = $options->sub_history_item_publication_state; $entry->component_id = $options->replacement_component_id; $entry->store_if_different($history_item); } parent::_purge($options); }