@@ -35,14 +35,8 @@ public function __construct() {
3535
3636 /**
3737 * Installs admin tools for EasyEngine.
38- *
39- * ## EXAMPLES
40- *
41- * # Install admin tools
42- * $ ee admin-tools install
43- *
4438 */
45- public function install () {
39+ private function install () {
4640
4741 if ( ! $ this ->is_installed () ) {
4842 EE ::log ( 'Installing admin-tools. This may take some time. ' );
@@ -80,8 +74,6 @@ public function install() {
8074 EE ::error ( "No method found to install $ tool. Aborting. " );
8175 }
8276 EE ::success ( "Installed $ tool successfully. " );
83- } else {
84- EE ::log ( "$ tool already installed. " );
8577 }
8678 }
8779 }
@@ -132,11 +124,8 @@ public function enable( $args, $assoc_args ) {
132124 EE ::error ( sprintf ( '%s site-type of %s-command does not support admin-tools. ' , $ this ->site_data ->app_sub_type , $ this ->site_data ->site_type ) );
133125 }
134126
135- if ( ! $ this ->is_installed () ) {
136- EE ::log ( 'It seems admin-tools have not yet been installed. ' );
137- $ this ->install ();
138- chdir ( $ this ->site_data ->site_fs_path );
139- }
127+ $ this ->install ();
128+ chdir ( $ this ->site_data ->site_fs_path );
140129
141130 $ this ->move_config_file ( 'docker-compose-admin.mustache ' , $ this ->site_data ->site_fs_path . '/docker-compose-admin.yml ' );
142131
@@ -256,19 +245,6 @@ private function move_config_file( $template_file, $config_file ) {
256245 $ this ->fs ->dumpFile ( $ config_file , file_get_contents ( ADMIN_TEMPLATE_ROOT . '/ ' . $ template_file ) );
257246 }
258247
259- /**
260- * Function to run install composer dependencies in tools that require it.
261- *
262- * @param string $tool_path Directory of the tool that contains `composer.json` file.
263- */
264- private function composer_install ( $ tool_path ) {
265-
266- chdir ( $ tool_path );
267- EE ::log ( 'Installing dependencies. This may take a little while. ' );
268- $ img_versions = \EE \Utils \get_image_versions ();
269- EE ::exec ( sprintf ( 'docker run --rm -it -e USER_ID=0 -e GROUP_ID=0 --user=root -v $PWD:/var/www/htdocs easyengine/php:%s composer update ' , $ img_versions ['easyengine/php ' ] ) );
270- }
271-
272248 /**
273249 * Function to install index.php file.
274250 *
@@ -306,13 +282,12 @@ private function install_pma( $data, $tool_path ) {
306282
307283 $ temp_dir = EE \Utils \get_temp_dir ();
308284 $ download_path = $ temp_dir . 'pma.zip ' ;
309- $ version = str_replace ( ' . ' , ' _ ' , $ data [ ' version ' ] ) ;
310- $ download_url = str_replace ( ' {version} ' , $ version , $ data ['url ' ] );
311- $ this ->download ( $ download_path , $ download_url );
312- $ this -> extract_zip ( $ download_path , $ temp_dir );
313- $ this ->fs ->rename ( $ temp_dir . 'phpmyadmin-RELEASE_ ' . $ version , $ tool_path );
285+ $ unzip_folder = $ temp_dir . ' /pma ' ;
286+ $ this -> download ( $ download_path , $ data ['url ' ] );
287+ $ this ->extract_zip ( $ download_path , $ unzip_folder );
288+ $ zip_folder_name = scandir ( $ unzip_folder );
289+ $ this ->fs ->rename ( $ unzip_folder . '/ ' . array_pop ( $ zip_folder_name ) , $ tool_path );
314290 $ this ->move_config_file ( 'pma.config.mustache ' , $ tool_path . '/config.inc.php ' );
315- $ this ->composer_install ( $ tool_path );
316291 }
317292
318293 /**
@@ -325,12 +300,19 @@ private function install_pra( $data, $tool_path ) {
325300
326301 $ temp_dir = EE \Utils \get_temp_dir ();
327302 $ download_path = $ temp_dir . 'pra.zip ' ;
303+ $ unzip_folder = $ temp_dir . '/pra ' ;
304+ $ vendor_zip = $ temp_dir . 'vendor.zip ' ;
305+ $ vendor_path = $ unzip_folder . '/vendor ' ;
328306 $ download_url = str_replace ( '{version} ' , $ data ['version ' ], $ data ['url ' ] );
329307 $ this ->download ( $ download_path , $ download_url );
330- $ this ->extract_zip ( $ download_path , $ temp_dir );
331- $ this ->fs ->rename ( $ temp_dir . 'phpRedisAdmin- ' . $ data ['version ' ], $ tool_path );
308+ $ this ->extract_zip ( $ download_path , $ unzip_folder );
309+ $ zip_folder_name = scandir ( $ unzip_folder );
310+ $ vendor_requirement_url = 'https://github.com/nrk/predis/archive/v1.1.1.zip ' ;
311+ $ this ->download ( $ vendor_zip , $ vendor_requirement_url );
312+ $ this ->extract_zip ( $ vendor_zip , $ vendor_path );
313+ $ this ->fs ->rename ( $ unzip_folder . '/ ' . array_pop ( $ zip_folder_name ), $ tool_path );
332314 $ this ->move_config_file ( 'pra.config.mustache ' , $ tool_path . '/includes/config.inc.php ' );
333- $ this -> composer_install ( $ tool_path );
315+
334316 }
335317
336318 /**
0 commit comments