diff --git a/bin/add-user-email.sh b/bin/add-user-email.sh deleted file mode 100644 index af33ee95..00000000 --- a/bin/add-user-email.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -USAGE="Usage: $0 EMAIL PASSWORD [BASEDIR]"; - -if [ ! -n "$2" ] -then - echo $USAGE; - exit 1; -fi - -USERNAME=$(echo "$1" | cut -f1 -d@); -DOMAIN=$(echo "$1" | cut -f2 -d@); -ADDRESS=$1; -PASSWD=$2; - -if [ -n "$3" ] -then - if [ ! -d "$3" ] - then - echo $USAGE; - echo "BASEDIR must be a valid directory!"; - echo "I would have tried, $(postconf | grep ^virtual_mailbox_base | cut -f3 -d' ')"; - exit 2; - else - BASEDIR="$3"; - fi -else - BASEDIR="$(postconf | grep ^virtual_mailbox_base | cut -f3 -d' ')"; -fi - -if [ -f /etc/postfix/vmailbox ] -then - echo "Adding Postfix user configuration..." - echo $ADDRESS $DOMAIN/$USERNAME/ >> /etc/postfix/vmailbox - postmap /etc/postfix/vmailbox - - if [ $? -eq 0 ] - then - echo "Adding Dovecot user configuration..." - - echo $ADDRESS::5000:5000::$BASEDIR/$DOMAIN/$ADDRESS - - echo $ADDRESS::5000:5000::$BASEDIR/$DOMAIN/$ADDRESS>> $BASEDIR/$DOMAIN/passwd - echo $ADDRESS":"$(doveadm pw -p $PASSWD) >> $BASEDIR/$DOMAIN/shadow - chown vmail:vmail $BASEDIR/$DOMAIN/passwd && chmod 775 $BASEDIR/$DOMAIN/passwd - chown vmail:vmail $BASEDIR/$DOMAIN/shadow && chmod 775 $BASEDIR/$DOMAIN/shadow - /etc/init.d/postfix reload - fi -fi diff --git a/bin/apache-website-create.sh b/bin/apache-website-create.sh deleted file mode 100644 index 9e2740c6..00000000 --- a/bin/apache-website-create.sh +++ /dev/null @@ -1 +0,0 @@ -ls diff --git a/bin/cron-job-add.sh b/bin/cron-job-add.sh deleted file mode 100644 index e2c1e4bc..00000000 --- a/bin/cron-job-add.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -username=$1 -schedule=$2 -command=$3 - -# Create a temporary file to hold the existing user's crontab -crontab -u $username -l > /tmp/temp_crontab - -# Add a new cron job to the temporary file -echo "$schedule $command" >> /tmp/temp_crontab - -# Install the modified crontab from the temporary file -crontab -u $username /tmp/temp_crontab - -# Remove the temporary file -rm /tmp/temp_crontab - -echo "done!" diff --git a/bin/cron-job-delete.sh b/bin/cron-job-delete.sh deleted file mode 100644 index e10d8ae1..00000000 --- a/bin/cron-job-delete.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -username=$1 -schedule=$2 -command=$3 - -# Get the user's crontab, filter out the specific command and schedule, and install the updated crontab -crontab -u $username -l | grep -v -F "$schedule $command" | crontab -u $username - - -echo "done!" diff --git a/bin/cron-jobs-list.sh b/bin/cron-jobs-list.sh deleted file mode 100644 index a31153c6..00000000 --- a/bin/cron-jobs-list.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -# Replace 'username' with the actual username you want to retrieve cron jobs for -username=$1 - -# Get the user's crontab entries and convert them to JSON -crontab -u $username -l | grep -v -e '^#' -e '^\s*$' | awk '{print "{\"schedule\":\"" $1 " " $2 " " $3 " " $4 " " $5 "\", \"command\":\"" substr($0, index($0,$6)) "\"}"}' | jq -s . diff --git a/bin/mysql-create-db-and-user.sh b/bin/mysql-create-db-and-user.sh deleted file mode 100644 index 21de2cc3..00000000 --- a/bin/mysql-create-db-and-user.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -echo "Creating MySQL user and database" - -PASS=$3 -if [ -z "$3" ]; then -PASS=`openssl rand -base64 8` -fi - -mysql -u root <id(); - $table->string('hosting_account_id'); - $table->string('name'); - $table->string('size'); - $table->string('max_size'); - $table->string('max_user_connections'); - $table->string('max_connections'); - $table->string('max_queries_per_hour'); - $table->string('max_updates_per_hour'); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('backups'); - } -}; diff --git a/web/tests/Unit/HostingSubscriptionCreateTest.php b/web/tests/Unit/HostingSubscriptionCreateTest.php index 65cef022..12358697 100644 --- a/web/tests/Unit/HostingSubscriptionCreateTest.php +++ b/web/tests/Unit/HostingSubscriptionCreateTest.php @@ -4,6 +4,8 @@ use App\Http\Middleware\ApiKeyMiddleware; use App\Installers\Server\Applications\PHPInstaller; +use App\Models\Database; +use App\Models\DatabaseUser; use App\Models\Domain; use App\SupportedApplicationTypes; use Illuminate\Support\Str; @@ -193,6 +195,20 @@ function test_create() $indexPageContent = shell_exec('curl -s http://'.$hostingSubscriptionDomain); $this->assertTrue(Str::contains($indexPageContent,'Phyre Panel - PHP App')); + + + // Check hosting subscription local database creation + $newDatabase = new Database(); + $newDatabase->hosting_subscription_id = $hostingSubscriptionData['id']; + $newDatabase->is_remote_database_server = 0; + $newDatabase->database_name = 'phyre_unit_test_db_'.$randId; + $newDatabase->save(); + + $newDatabaseUser = new DatabaseUser(); + $newDatabaseUser->database_id = $newDatabase->id; + $newDatabaseUser->username = 'phyre_unit_test_user_'.$randId; + $newDatabaseUser->password = 'phyre_unit_test_password_'.$randId; + $newDatabaseUser->save(); } }