Пример #1
0
 /**
  * Final submission step.
  *
  * @return null
  */
 protected function submit()
 {
     $this->revision->revision_submitted = true;
     $this->revision->allow_author_repack = false;
     $this->revision->validation_date = 0;
     // Automatically approve the revision and contrib if the queue is not being used
     if (!$this->use_queue) {
         $this->revision->validation_date = time();
         $this->revision->revision_status = TITANIA_REVISION_APPROVED;
         if ($this->contrib->contrib_status != TITANIA_CONTRIB_APPROVED) {
             $this->contrib->change_status(TITANIA_CONTRIB_APPROVED);
         }
         repository::trigger_cron($this->config);
     }
     $this->revision->submit();
     $this->uploader->get_operator()->submit();
     // After revision is set to submitted we must update the queue
     $this->revision->update_queue($this->get_repack_exclusions());
 }
Пример #2
0
    /**
     * Delete this contribution
     */
    public function delete()
    {
        // Delete Revisions
        $revision = new titania_revision($this);
        $sql = 'SELECT * FROM ' . TITANIA_REVISIONS_TABLE . '
			WHERE contrib_id = ' . $this->contrib_id;
        $result = phpbb::$db->sql_query($sql);
        while ($row = phpbb::$db->sql_fetchrow($result)) {
            $revision->__set_array($row);
            $revision->delete();
        }
        phpbb::$db->sql_freeresult($result);
        // Delete Support/Discussion/Queue Discussion Topics
        $topic = new titania_topic();
        $sql = 'SELECT * FROM ' . TITANIA_TOPICS_TABLE . '
			WHERE ' . phpbb::$db->sql_in_set('topic_type', array(TITANIA_SUPPORT, TITANIA_QUEUE_DISCUSSION)) . '
				AND parent_id = ' . $this->contrib_id;
        $result = phpbb::$db->sql_query($sql);
        while ($row = phpbb::$db->sql_fetchrow($result)) {
            $topic->__set_array($row);
            $topic->delete();
        }
        phpbb::$db->sql_freeresult($result);
        // Change the status to new (handles resetting counts)
        $this->change_status(TITANIA_CONTRIB_NEW);
        // Remove any attention items
        $sql = 'DELETE FROM ' . TITANIA_ATTENTION_TABLE . '
			WHERE attention_object_type = ' . TITANIA_CONTRIB . '
				AND attention_object_id = ' . $this->contrib_id;
        phpbb::$db->sql_query($sql);
        // Delete the release topic
        if ($this->contrib_release_topic_id) {
            phpbb::_include('functions_admin', 'delete_topics');
            delete_topics('topic_id', $this->contrib_release_topic_id);
        }
        // Delete from categories
        $this->update_category_count('-');
        $sql = ' DELETE FROM ' . TITANIA_CONTRIB_IN_CATEGORIES_TABLE . '
			WHERE contrib_id = ' . $this->contrib_id;
        phpbb::$db->sql_query($sql);
        repository::trigger_cron($this->config);
        // Self delete
        parent::delete();
    }
Пример #3
0
 /**
  * Dump include file.
  *
  * @param string $type		Contrib type name
  * @param int $group		Group id
  * @param array $packages	Packages
  */
 protected function dump_include($type, $group, array $packages)
 {
     $type_name = $this->types->get($type)->name;
     $this->repo->dump_include("packages-{$type_name}-{$group}.json", $packages);
 }
Пример #4
0
 public function delete()
 {
     // Hooks
     titania::$hook->call_hook_ref(array(__CLASS__, __FUNCTION__), $this);
     // Delete the queue item
     $queue = $this->get_queue();
     if ($queue !== false) {
         $queue->delete();
     }
     // Delete the attachment
     $operator = phpbb::$container->get('phpbb.titania.attachment.operator');
     $operator->configure(TITANIA_CONTRIB, $this->contrib_id)->load(array($this->attachment_id))->delete(array($this->attachment_id));
     repository::trigger_cron($this->config);
     // Delete translations
     // $translations = new titania_attachment(TITANIA_TRANSLATION, $this->revision_id);
     // $attachment->delete_all();
     // Self-destruct
     parent::delete();
 }