/** * Get a list of updates. * * ## Options * * [--<field>=<value>] * : Add additional arguments to Updates query. * * [--fields=<fields>] * : Limit fields returned. * * [--raw] * : Return raw values. IDs instead of human readable names. * * @param $args * @param $assoc_args * * @subcommand list */ public function list_($args, $assoc_args) { $query_args = wp_parse_args($assoc_args, array('items_per_page' => 20, 'page' => 1)); $query_args['order'] = array('update_date' => 'DESC'); $results = itelic_get_updates($query_args); $items = array(); foreach ($results as $item) { $items[] = $this->get_fields_for_object($item, \WP_CLI\Utils\get_flag_value($assoc_args, 'raw', false)); } if (empty($assoc_args['fields'])) { $assoc_args['fields'] = array('ID', 'activation', 'location', 'release', 'update_date', 'previous_version'); } $formatter = $this->get_formatter($assoc_args); $formatter->display_items($items); }
/** * Delete this object. * * @since 1.0 * * @throws DB\Exception */ public function delete() { /** * Fires before an activation record is deleted. * * @since 1.0 * * @param Activation $this */ do_action('itelic_delete_activation', $this); parent::delete(); $updates = itelic_get_updates(array('activation' => $this->get_pk())); foreach ($updates as $update) { $update->delete(); } /** * Fires after an activation record is deleted. * * @since 1.0 * * @param Activation $this */ do_action('itelic_deleted_activation', $this); }
/** * Archive this release. * * @since 1.0 */ public function archive() { $updated = $this->get_total_updated(true); $activations = $this->get_total_active_activations(); $this->update_meta('updated', $updated); $this->update_meta('activations', $activations); $top5 = $this->get_top_5_previous_versions(); $this->update_meta('top5_prev_version', $top5); $first_14_days = $this->get_first_14_days_of_upgrades(); $this->update_meta('first_14_days', $first_14_days); if ($this->status != self::STATUS_ARCHIVED) { $this->status = self::STATUS_ARCHIVED; $this->update('status', self::STATUS_ARCHIVED); } $updates = itelic_get_updates(array('release' => $this->get_ID())); foreach ($updates as $update) { $update->delete(); } /** * Fires when a release is archived. * * @since 1.0 * * @param Release $this */ do_action('itelic_archive_release', $this); }