From b5ef96c1a0ea630bd5415c31dd3455e257e44e51 Mon Sep 17 00:00:00 2001 From: Dan Cryer Date: Mon, 12 May 2014 18:26:44 +0100 Subject: [PATCH] Removing PHPCI's attempt to install plugins via composer automatically, as it usually doesn't work. See #395 --- PHPCI/Controller/PluginController.php | 36 ++------------------------- PHPCI/View/Plugin/index.phtml | 10 +------- 2 files changed, 3 insertions(+), 43 deletions(-) diff --git a/PHPCI/Controller/PluginController.php b/PHPCI/Controller/PluginController.php index 3d94536c..46cba7b5 100644 --- a/PHPCI/Controller/PluginController.php +++ b/PHPCI/Controller/PluginController.php @@ -37,20 +37,6 @@ class PluginController extends \PHPCI\Controller protected $canInstall; protected $composerPath; - public function init() - { - parent::init(); - $this->canInstall = function_exists('shell_exec'); - - if ($this->canInstall) { - $this->composerPath = $this->findBinary(array('composer', 'composer.phar')); - - if (!$this->composerPath) { - $this->canInstall = false; - } - } - } - public function index() { if (!$_SESSION['user']->getIsAdmin()) { @@ -58,7 +44,6 @@ class PluginController extends \PHPCI\Controller } $this->view->canWrite = is_writable(APPLICATION_PATH . 'composer.json'); - $this->view->canInstall = $this->canInstall; $this->view->required = $this->required; $json = $this->getComposerJson(); @@ -93,13 +78,6 @@ class PluginController extends \PHPCI\Controller unset($json['require'][$package]); $this->setComposerJson($json); - if ($this->canInstall) { - $home = 'COMPOSER_HOME='.APPLICATION_PATH . ' '; - $action = ' update --working-dir=' . APPLICATION_PATH; - $toLog = APPLICATION_PATH . '/phpci_composer_remove.log 2>&1 &'; - shell_exec($home . $this->composerPath . $action . ' > /' . $toLog); - } - header('Location: ' . PHPCI_URL . 'plugin?r=' . $package); die; } @@ -121,16 +99,6 @@ class PluginController extends \PHPCI\Controller $json['require'][$package] = $version; $this->setComposerJson($json); - if ($this->canInstall) { - $home = 'COMPOSER_HOME='.APPLICATION_PATH . ' '; - $action = ' update --working-dir=' . APPLICATION_PATH; - $toLog = ' > /' . APPLICATION_PATH . '/phpci_composer_install.log 2>&1 &'; - shell_exec($home . $this->composerPath . $action . $toLog); - - header('Location: ' . PHPCI_URL . 'plugin?i=' . $package); - die; - } - header('Location: ' . PHPCI_URL . 'plugin?w=' . $package); die; } @@ -179,7 +147,7 @@ class PluginController extends \PHPCI\Controller { $searchQuery = $this->getParam('q', ''); $http = new \b8\HttpClient(); - $http->setHeaders(array('User-Agent: PHPCI/1.0 (+http://www.phptesting.org)')); + $http->setHeaders(array('User-Agent: PHPCI/1.0 (+https://www.phptesting.org)')); $res = $http->get('https://packagist.org/search.json', array('q' => $searchQuery)); die(json_encode($res['body'])); @@ -189,7 +157,7 @@ class PluginController extends \PHPCI\Controller { $name = $this->getParam('p', ''); $http = new \b8\HttpClient(); - $http->setHeaders(array('User-Agent: PHPCI/1.0 (+http://www.phptesting.org)')); + $http->setHeaders(array('User-Agent: PHPCI/1.0 (+https://www.phptesting.org)')); $res = $http->get('https://packagist.org/packages/'.$name.'.json'); die(json_encode($res['body'])); diff --git a/PHPCI/View/Plugin/index.phtml b/PHPCI/View/Plugin/index.phtml index 3cfac153..a28799c7 100644 --- a/PHPCI/View/Plugin/index.phtml +++ b/PHPCI/View/Plugin/index.phtml @@ -1,8 +1,4 @@

Packages and Provided Plugins

- -

PHPCI cannot automatically install/remove plugins for you, as either the shell_exec() - function is disabled or PHPCI could not find Composer. PHPCI will update composer.json for you, but you will need to run Composer manually to make the changes.

-

PHPCI cannot update composer.json for you as it is not writable.

@@ -12,12 +8,8 @@

has been removed.

- -

has been installed.

- - -

has been added to composer.json and will be installed next time you run composer update.

+

has been added to composer.json for you and will be installed next time you run composer update.