Example #1
0
 /**
  * @param PURGE_OPTIONS $options
  * @access private
  */
 protected function _purge($options)
 {
     $tables = $this->app->table_names;
     $branch_query = $this->branch_query();
     $branches = $branch_query->objects();
     foreach ($branches as $branch) {
         $branch_ids[] = $branch->id;
     }
     if (sizeof($branch_ids)) {
         $branch_ids = implode(',', $branch_ids);
         // remove associated branches and releases
         $this->db->logged_query("DELETE FROM {$tables->branches} WHERE id IN ({$branch_ids})");
         $this->db->logged_query("DELETE FROM {$tables->releases} WHERE branch_id IN ({$branch_ids})");
         // Remove entry to branch mappings
         $this->db->logged_query("DELETE FROM {$tables->entries_to_branches} WHERE branch_id IN ({$branch_ids})");
     }
     // Remove associated options, if there are any.
     if ($this->defines_options()) {
         $options = $this->options();
         $options->delete();
     }
     /* Remove change-specific map information */
     $this->_purge_foreign_key($tables->entries_to_branches, 'id', $tables->changes_to_branches, 'entry_to_branch_id');
     /* Remove job-specific map information */
     $this->_purge_foreign_key($tables->entries_to_branches, 'id', $tables->jobs_to_branches, 'entry_to_branch_id');
     /* remove associated changes */
     $this->_purge_foreign_key($tables->entries, 'id', $tables->changes, 'entry_id');
     /* remove associated jobs */
     $this->_purge_foreign_key($tables->entries, 'id', $tables->jobs, 'entry_id');
     /* remove special history items */
     $this->db->logged_query("DELETE LOW_PRIORITY FROM {$this->app->table_names->history_items} WHERE access_id = {$this->id} AND (object_type IN ('branch', 'release'))");
     parent::_purge($options);
 }
Example #2
0
 /**
  * @param PURGE_OPTIONS $options
  * @access private
  */
 protected function _purge($options)
 {
     $tables = $this->app->table_names;
     /* remove associated pictures */
     $this->_purge_foreign_key($tables->entries, 'id', $tables->pictures, 'entry_id');
     /* remove associated journals */
     $this->_purge_foreign_key($tables->entries, 'id', $tables->journals, 'entry_id');
     parent::_purge($options);
 }