/** * Get the JSON spec for a package * @param string $package_name The name of the package to get the spec for * @param string $version The version string of the specific version to grab. * Can be HEAD * @param string $format The format to get the spec in */ public function spec($package_name, $version, $format) { #UtilityHelper::tryPageCache(1); $this->load->model('spark'); $this->load->model('contributor'); $this->load->model('download'); $spark = Spark::get($package_name, $version); if (!$spark) { show_404(); } $spark->spark_home = base_url() . 'packages/' . $spark->name . '/show'; $spark->contributor = $spark->getContributor(); # Omit the password hash unset($spark->contributor->password); # Do this? $spark->recordInstall(); Download::recordDownload('spec'); $this->output->set_output(json_encode($spark)); }
/** * The API call to get a spec * @param string $package_name * @param string $version * @param string $format */ public function spec($package_name, $version) { $this->load->model('spark'); $this->load->model('contributor'); $this->load->model('download'); $spark = Spark::get($package_name, $version); if (!$spark) { show_404(); } $spark->spark_home = base_url() . 'packages/' . $spark->name . '/show'; $spark->contributor = $spark->getContributor(); $spark->dependencies = $spark->getDependencies(); # Omit the password hash unset($spark->contributor->password); # Do this? $spark->recordInstall(); Download::recordDownload('spec'); $this->output->set_output(json_encode(array('success' => true, 'spec' => $spark))); }
/** * A call for grabbing the latest copy of the spark system */ function download() { $this->load->model('download'); Download::recordDownload('system'); redirect(config_item('sparks_download_url')); }