Commit: 4f408771a3a05dfa7ab0e0f7e21b57eeec4ac862

Author: gwoo | Date: 2010-01-26 10:54:30 -0800
adding download to PluginsController
diff --git a/controllers/PluginsController.php b/controllers/PluginsController.php index 45c5c3a..a2cc517 100644 --- a/controllers/PluginsController.php +++ b/controllers/PluginsController.php @@ -28,7 +28,7 @@ class PluginsController extends \lithium\action\Controller { ); $latest = Plugin::all($params); if ($this->request->type == 'json') { - $this->render(array('json' => $latest->to('array'))); + $this->render(array('json' => $latest->data())); } return compact('latest'); } @@ -148,6 +148,15 @@ class PluginsController extends \lithium\action\Controller { $this->set(compact('plugin', 'url')); $this->render('verify'); } + + public function download($name) { + $file = LITHIUM_APP_PATH . "/resources/repos/{$name}.phar.gz"; + if (!file_exists($file)) { + return "it doesnt work"; + } + $this->response->headers('download', "{$name}.phar.gz"); + return file_get_contents($file); + } } ?> \ No newline at end of file