Skip to content

Commit 699461e

Browse files
committed
Update installation of pra
Remove composer install function Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
1 parent cefbe84 commit 699461e

1 file changed

Lines changed: 16 additions & 24 deletions

File tree

src/Admin_Tools_Command.php

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,6 @@ private function install() {
7979
EE::error( "No method found to install $tool. Aborting." );
8080
}
8181
EE::success( "Installed $tool successfully." );
82-
} else {
83-
EE::log( "$tool already installed." );
8482
}
8583
}
8684
}
@@ -131,10 +129,8 @@ public function up( $args, $assoc_args ) {
131129
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 ) );
132130
}
133131

134-
if ( ! $this->is_installed() ) {
135-
$this->install();
136-
chdir( $this->site_data->site_fs_path );
137-
}
132+
$this->install();
133+
chdir( $this->site_data->site_fs_path );
138134

139135
$this->move_config_file( 'docker-compose-admin.mustache', $this->site_data->site_fs_path . '/docker-compose-admin.yml' );
140136

@@ -254,19 +250,6 @@ private function move_config_file( $template_file, $config_file ) {
254250
$this->fs->dumpFile( $config_file, file_get_contents( ADMIN_TEMPLATE_ROOT . '/' . $template_file ) );
255251
}
256252

257-
/**
258-
* Function to run install composer dependencies in tools that require it.
259-
*
260-
* @param string $tool_path Directory of the tool that contains `composer.json` file.
261-
*/
262-
private function composer_install( $tool_path ) {
263-
264-
chdir( $tool_path );
265-
EE::log( 'Installing dependencies. This may take a little while.' );
266-
$img_versions = \EE\Utils\get_image_versions();
267-
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'] ) );
268-
}
269-
270253
/**
271254
* Function to install index.php file.
272255
*
@@ -304,9 +287,11 @@ private function install_pma( $data, $tool_path ) {
304287

305288
$temp_dir = EE\Utils\get_temp_dir();
306289
$download_path = $temp_dir . 'pma.zip';
290+
$unzip_folder = $temp_dir . '/pma';
307291
$this->download( $download_path, $data['url'] );
308-
$this->extract_zip( $download_path, $temp_dir );
309-
$this->fs->rename( $temp_dir . 'phpmyadmin-RELEASE_' . $version, $tool_path );
292+
$this->extract_zip( $download_path, $unzip_folder );
293+
$zip_folder_name = scandir( $unzip_folder );
294+
$this->fs->rename( $unzip_folder . '/' . array_pop( $zip_folder_name ), $tool_path );
310295
$this->move_config_file( 'pma.config.mustache', $tool_path . '/config.inc.php' );
311296
}
312297

@@ -320,12 +305,19 @@ private function install_pra( $data, $tool_path ) {
320305

321306
$temp_dir = EE\Utils\get_temp_dir();
322307
$download_path = $temp_dir . 'pra.zip';
308+
$unzip_folder = $temp_dir . '/pra';
309+
$vendor_zip = $temp_dir . 'vendor.zip';
310+
$vendor_path = $unzip_folder . '/vendor';
323311
$download_url = str_replace( '{version}', $data['version'], $data['url'] );
324312
$this->download( $download_path, $download_url );
325-
$this->extract_zip( $download_path, $temp_dir );
326-
$this->fs->rename( $temp_dir . 'phpRedisAdmin-' . $data['version'], $tool_path );
313+
$this->extract_zip( $download_path, $unzip_folder );
314+
$zip_folder_name = scandir( $unzip_folder );
315+
$vendor_requirement_url = 'https://github.com/nrk/predis/archive/v1.1.1.zip';
316+
$this->download( $vendor_zip, $vendor_requirement_url );
317+
$this->extract_zip( $vendor_zip, $vendor_path );
318+
$this->fs->rename( $unzip_folder . '/' . array_pop( $zip_folder_name ), $tool_path );
327319
$this->move_config_file( 'pra.config.mustache', $tool_path . '/includes/config.inc.php' );
328-
$this->composer_install( $tool_path );
320+
329321
}
330322

331323
/**

0 commit comments

Comments
 (0)