Skip to content

Conversation

@mrrobot47
Copy link
Member

@mrrobot47 mrrobot47 commented Aug 8, 2018

Closes: #1
Closes: EasyEngine/easyengine#1118

Functions implemented so far:

ee admin-tools install
ee admin-tools up
ee admin-tools down
  • PHPMyAdmin
  • phpRedisAdmin
  • phpinfo.php
  • zend Opcache Gui
  • Index for all admin tools

Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
Update move config function
Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
Switch from composer install to update

Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
@mrrobot47 mrrobot47 changed the title [WIP] Add admin-tools Command Add admin-tools Command Aug 21, 2018
Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
.gitignore Outdated
@@ -0,0 +1,11 @@
.DS_Store
wp-cli.local.yml
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can remove this now from all repo. We don't have wp-cli.local.yml. Maybe check if we can have ee-cli.local.yml.


class Admin_Tools_Command extends EE_Command {


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra line?

$this->fs->mkdir( ADMIN_TOOL_DIR );
}

$tools = json_decode( file_get_contents( ADMIN_TOOLS_FILE ), true );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a couple of things here we can take care of.

  1. if we are expecting the ADMIN_TOOLS_FILE file to be .json file we can check the file extension.
  2. check if file_get_contents( ADMIN_TOOLS_FILE ) is not empty if it is do not proceed further just add an error message.
  3. Check if json_decode is done correctly ( it will fail if there is invalid JSON formate data ) After this line you can check if ( json_last_error() != JSON_ERROR_NONE ) and send a error message/exception.
  4. And one last thing if json data is valid but empty {} then you can add a check for $tools if it's empty add a message/exception.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will update according to this 👍

if ( ! $this->is_installed( $tool ) ) {
EE::log( "Installing $tool" );
$tool_path = ADMIN_TOOL_DIR . '/' . $tool;
call_user_func_array( [ $this, "install_$tool" ], [ $data, $tool_path ] );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think here we need to check method_exists since the $tool can come from json file which can be updated from ADMIN_TOOLS_FILE constant.

$this->fs->dumpFile( $config_file, file_get_contents( ADMIN_TEMPLATE_ROOT . '/' . $template_file ) );
}

private function composer_install( $tool_path ) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function doc?

@@ -0,0 +1,70 @@
<?php

function populate_site_info() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add comments in this file where needed. I believe this will be copied paste from mustache template as .php file and it won't have any comment.


function select( $columns = array(), $where = array(), $table_name = 'services', $limit = null ) {

$db_path = '/opt/easyengine/ee.sqlite';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we read this path from env variables?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. EE_CONF_ROOT is a constant defined in EE core. It is not present as an env variable which can be used from index.php of admin-tools.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean we can keep it in Env variable and then use it when needed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay 👍

unset( $services['site_url'] );


$scan = scandir( '/var/www/htdocs/ee-admin' );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't we read this path from env variables?

Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
Signed-off-by: Riddhesh Sanghvi <riddheshsanghvi96@gmail.com>
@rahulsprajapati rahulsprajapati merged commit 7b59881 into EasyEngine:master Aug 21, 2018
@mrrobot47 mrrobot47 mentioned this pull request Aug 22, 2018
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants