Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions pengwin-setup.d/joomla.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ declare SetupDir
declare wHome
JOOMLA_VERSION="5.2.1"
JOOMLA_TAG="5.2.1"
JOOMLA_DB_NAME="joomla_db"

#######################################
# Install Joomla CMS development environment
Expand All @@ -15,6 +16,7 @@ JOOMLA_TAG="5.2.1"
# wHome
# JOOMLA_VERSION
# JOOMLA_TAG
# JOOMLA_DB_NAME
# Arguments:
# None
#######################################
Expand Down Expand Up @@ -78,9 +80,9 @@ function install_joomla() {

echo "Setting up Joomla database"
if ! sudo mysql -u root << EOF
CREATE DATABASE IF NOT EXISTS joomla;
CREATE DATABASE IF NOT EXISTS ${JOOMLA_DB_NAME};
CREATE USER IF NOT EXISTS 'joomla'@'localhost' IDENTIFIED BY 'joomla';
GRANT ALL PRIVILEGES ON joomla.* TO 'joomla'@'localhost';
GRANT ALL PRIVILEGES ON ${JOOMLA_DB_NAME}.* TO 'joomla'@'localhost';
FLUSH PRIVILEGES;
EOF
then
Expand All @@ -89,14 +91,16 @@ EOF

echo ""
echo "Joomla ${JOOMLA_VERSION} installation complete!"
echo "Database: joomla"
echo "Database: ${JOOMLA_DB_NAME}"
echo "Database User: joomla"
echo "Database Password: joomla"
echo ""
echo "Opening Joomla installer in browser..."

wslview "http://localhost/joomla_root/index.php" 2>/dev/null || echo "Please open http://localhost/joomla_root/index.php in your browser"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot move the message below this line. the message must be on the screen at the same time the browser opens. also revert the message to "Opening Joomla installer in browser..."

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done in 8cd7c0b. Moved the message dialog to after the wslview call so the browser opens first and the dialog appears simultaneously. Reverted the text back to "Opening Joomla installer in browser...".


message --title "Joomla ${JOOMLA_VERSION}" --msgbox "Joomla ${JOOMLA_VERSION} installation complete!\n\nDatabase: ${JOOMLA_DB_NAME}\nDatabase User: joomla\nDatabase Password: joomla\n\nOpening Joomla installer in browser..." 12 70

cleantmp

else
Expand Down
8 changes: 4 additions & 4 deletions tests/joomla.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ function test_main() {

# Check if database was created
local db_exists
db_exists=$(sudo mysql -u root -e "SHOW DATABASES LIKE 'joomla';" 2>/dev/null | grep -c joomla)
db_exists=$(sudo mysql -N -B -u root -e "SHOW DATABASES LIKE 'joomla_db';" 2>/dev/null | grep -c joomla_db)
assertTrue "Joomla database was not created" "[ ${db_exists} -ge 1 ]"
Comment thread
crramirez marked this conversation as resolved.

# Check if database user was created
local user_exists
user_exists=$(sudo mysql -u root -e "SELECT User FROM mysql.user WHERE User='joomla';" 2>/dev/null | grep -c joomla)
user_exists=$(sudo mysql -N -B -u root -e "SELECT User FROM mysql.user WHERE User='joomla';" 2>/dev/null | grep -c joomla)
assertTrue "Joomla database user was not created" "[ ${user_exists} -ge 1 ]"

}
Expand All @@ -53,11 +53,11 @@ function test_uninstall() {

# Database and user should be preserved (user data)
local db_count
db_count=$(sudo mysql -u root -e "SHOW DATABASES LIKE 'joomla';" 2>/dev/null | grep -c joomla || echo 0)
db_count=$(sudo mysql -N -B -u root -e "SHOW DATABASES LIKE 'joomla_db';" 2>/dev/null | grep -c joomla_db || true)
assertTrue "Joomla database should be preserved" "[ ${db_count} -ge 1 ]"
Comment thread
crramirez marked this conversation as resolved.

local user_count
user_count=$(sudo mysql -u root -e "SELECT User FROM mysql.user WHERE User='joomla';" 2>/dev/null | grep -c joomla || echo 0)
user_count=$(sudo mysql -N -B -u root -e "SELECT User FROM mysql.user WHERE User='joomla';" 2>/dev/null | grep -c joomla || true)
assertTrue "Joomla database user should be preserved" "[ ${user_count} -ge 1 ]"

# Note: LAMP stack should NOT be removed by Joomla uninstall
Expand Down