From 1c4daf084ff87a12c31f444180dbbafd93022dd4 Mon Sep 17 00:00:00 2001 From: thokiller <35527212+thokiller@users.noreply.github.com> Date: Fri, 26 Apr 2019 21:28:11 +0200 Subject: [PATCH 1/4] Added a Helper for the create_website command This helper should help with figure out what the available options are --- install.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/install.sh b/install.sh index 7a2d2cf..b0bbbd9 100644 --- a/install.sh +++ b/install.sh @@ -7,6 +7,17 @@ else . $SCRIPTPATH/config.sample.sh fi +if [ "$1" = "--help" ] || [ "$1" = "-h" ] ; then + echo "The options available for this command: + create_website 1 2 3 4 + 1: The name of the website + 2: Type: community or enterprise + 3: Version: Set the magento version being installed. Example 2.2.8 + 4: options: add options to the composer create project commando" + exit 0 +fi + + NAME=$1 EDITION=$2 VERSION=$3 From e200425c24e45a2a821fe1a634bbbcb6a90fede0 Mon Sep 17 00:00:00 2001 From: thomas_mondeel Date: Wed, 26 Jun 2019 15:35:32 +0200 Subject: [PATCH 2/4] [FEATURE] added a admin user reset function --- .bash_xp | 3 +++ reset_user.sh | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 reset_user.sh diff --git a/.bash_xp b/.bash_xp index 7f9707d..4d9e985 100644 --- a/.bash_xp +++ b/.bash_xp @@ -32,6 +32,9 @@ function update_website() { bash "$XP_TOOLS_DIR/update.sh" $1 } +function reset_admin_user_login() { + bash "$XP_TOOLS_DIR/reset_user.sh" $1 +} function git_import_website() { bash "$XP_TOOLS_DIR/git_import.sh" $1 $2 } diff --git a/reset_user.sh b/reset_user.sh new file mode 100644 index 0000000..b3f6916 --- /dev/null +++ b/reset_user.sh @@ -0,0 +1,41 @@ +SCRIPTPATH="$( cd "$(dirname "$0")" ; pwd -P )" +CONFIGPATH=$SCRIPTPATH/config.sh +if [ -e $CONFIGPATH ] +then + . $CONFIGPATH +else +#error + . $SCRIPTPATH/config.sample.sh +fi + +NAME=$1 + +if [ -z "$NAME" ]; then + echo "enter name. Will be used as $DOMAIN_PREFIX$DOMAIN_SUFFIX" + exit; +fi + +VALET_DOMAIN=$DOMAIN_PREFIX$NAME +DIRECTORY=$DOMAINS_PATH/$VALET_DOMAIN$FOLDER_SUFFIX +DOMAIN=$VALET_DOMAIN$DOMAIN_SUFFIX +MYSQL_DATABASE_NAME=$MYSQL_DATABASE_PREFIX$NAME +MYSQL_DATABASE_NAME="${MYSQL_DATABASE_NAME//./_}" + +## Check if we are installing Magento 1 or 2 +if [ -f "$DIRECTORY/app/etc/env.php" ]; then + VERSION="m2" + MAGERUN_COMMAND=$MAGERUN2_COMMAND +else + VERSION="m1" + MAGERUN_COMMAND=$MAGERUN1_COMMAND +fi + +#error +$MAGERUN_COMMAND --root-dir=$DIRECTORY admin:user:delete $MAGENTO_USERNAME -f + +if [ "$VERSION" = "m2" ]; then + $MAGERUN_COMMAND --root-dir=$DIRECTORY admin:user:create --admin-user $MAGENTO_USERNAME --admin-password $MAGENTO_PASSWORD --admin-email $MAGENTO_USER_EMAIL --admin-firstname $MAGENTO_USERNAME --a$ +else +#error + $MAGERUN_COMMAND --root-dir=$DIRECTORY admin:user:create $MAGENTO_USERNAME $MAGENTO_USER_EMAIL $MAGENTO_PASSWORD $MAGENTO_USERNAME $MAGENTO_USERNAME +fi From 320f81c02c2750b1644d9204cca9a7ea01abd522 Mon Sep 17 00:00:00 2001 From: thomas_mondeel Date: Wed, 26 Jun 2019 15:42:15 +0200 Subject: [PATCH 3/4] [TASK] updated tekst and added a helper --- reset_user.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/reset_user.sh b/reset_user.sh index b3f6916..37c8370 100644 --- a/reset_user.sh +++ b/reset_user.sh @@ -8,10 +8,17 @@ else . $SCRIPTPATH/config.sample.sh fi +if [ "$1" = "--help" ] || [ "$1" = "-h" ] ; then + echo "The reset_admin_user_login allows the reset of the admin password for a domain. + Usage: reset_admin_user_login DOMAIN_TO_RESET_ADMIN" + exit 0 +fi + + NAME=$1 if [ -z "$NAME" ]; then - echo "enter name. Will be used as $DOMAIN_PREFIX$DOMAIN_SUFFIX" + echo "Please enter a Domain where the admin user should be resetted" exit; fi From 41992a1bdd07f15f295e94884f8066917707f089 Mon Sep 17 00:00:00 2001 From: thomas_mondeel Date: Fri, 28 Jun 2019 15:26:50 +0200 Subject: [PATCH 4/4] [TASK] updated readme with new command --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3e73c67..8fbd6ec 100644 --- a/README.md +++ b/README.md @@ -156,9 +156,15 @@ import_website name **This feature also supports update for a Magento 1 Webshop** Requires the following files to be in the destination domain folder: structure.sql, data.sql +``` +import_website name +``` + +### Update/reset admin user +**This feature also supports Magento 1 Webshops** ``` -update_website name +reset_admin_user_login name ``` ### Site Search Command