Commit e0e9b8cb authored by Abhishek's avatar Abhishek
Browse files

few comments fixed

parent 355b69d2
Pipeline #11947 failed with stage
in 1 minute and 34 seconds
...@@ -22,6 +22,7 @@ RUN apt-get update && apt-get install -y \ ...@@ -22,6 +22,7 @@ RUN apt-get update && apt-get install -y \
git \ git \
sudo \ sudo \
mariadb-client \ mariadb-client \
curl \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Add custom PHP settings for Moodle # Add custom PHP settings for Moodle
......
...@@ -36,14 +36,13 @@ DB_NAME="moodle" ...@@ -36,14 +36,13 @@ DB_NAME="moodle"
# ============================================================================== # ==============================================================================
# SCRIPT EXECUTION # SCRIPT EXECUTION
# ============================================================================== # ==============================================================================
# GL: - remove "definitive"
echo "🚀 Starting Definitive Moodle Automation Script..." echo "🚀 Starting Moodle Automation Script..."
echo " -> Using Moodle URL: $MOODLE_URL" echo " -> Using Moodle URL: $MOODLE_URL"
echo " -> Using Backend URL: $BACKEND_URL" echo " -> Using Backend URL: $BACKEND_URL"
# GL: - consider placing the following steps 1 and 2 in a dockerfile and create your own image. That way, you can later spin up multiple instances easily if the test load grows. # GL: - consider placing the following steps 1 and 2 in a dockerfile and create your own image. That way, you can later spin up multiple instances easily if the test load grows.
# remove next comment line
# --- THIS IS THE FIX ---
# We now wait for the Moodle web application itself to be fully responsive. # We now wait for the Moodle web application itself to be fully responsive.
# We repeatedly curl the login page until we get a 200 OK status code. # We repeatedly curl the login page until we get a 200 OK status code.
# This is the most reliable way to know the site is ready. # This is the most reliable way to know the site is ready.
...@@ -68,8 +67,7 @@ if [ ! -f "$PLUGIN_ZIP_NAME" ]; then echo "❌ Plugin ZIP file not found." && ex ...@@ -68,8 +67,7 @@ if [ ! -f "$PLUGIN_ZIP_NAME" ]; then echo "❌ Plugin ZIP file not found." && ex
if [ ! -f "$DTA_CONFIG_FILE" ]; then echo "❌ DTA config file not found." && exit 1; fi if [ ! -f "$DTA_CONFIG_FILE" ]; then echo "❌ DTA config file not found." && exit 1; fi
echo "✅ Pre-flight checks passed." echo "✅ Pre-flight checks passed."
# GL: - name "Installing DTA plugin" echo "📦 Step 1: Installing DTA plugin..."
echo "📦 Step 1: Installing custom plugin..."
docker exec -u "$MOODLE_SYSTEM_USER" "$MOODLE_CONTAINER" bash -c "set -e; mkdir -p '$MOODLE_ROOT_IN_CONTAINER/mod/assign/submission'; unzip -o '/tmp/$PLUGIN_ZIP_NAME' -d '$MOODLE_ROOT_IN_CONTAINER/mod/assign/submission'; php '$MOODLE_ROOT_IN_CONTAINER/admin/cli/upgrade.php' --non-interactive; php '$MOODLE_ROOT_IN_CONTAINER/admin/cli/purge_caches.php'" docker exec -u "$MOODLE_SYSTEM_USER" "$MOODLE_CONTAINER" bash -c "set -e; mkdir -p '$MOODLE_ROOT_IN_CONTAINER/mod/assign/submission'; unzip -o '/tmp/$PLUGIN_ZIP_NAME' -d '$MOODLE_ROOT_IN_CONTAINER/mod/assign/submission'; php '$MOODLE_ROOT_IN_CONTAINER/admin/cli/upgrade.php' --non-interactive; php '$MOODLE_ROOT_IN_CONTAINER/admin/cli/purge_caches.php'"
echo "✅ Plugin installed." echo "✅ Plugin installed."
...@@ -83,8 +81,8 @@ docker exec -u "$MOODLE_SYSTEM_USER" "$MOODLE_CONTAINER" php "$MOODLE_ROOT_IN_CO ...@@ -83,8 +81,8 @@ docker exec -u "$MOODLE_SYSTEM_USER" "$MOODLE_CONTAINER" php "$MOODLE_ROOT_IN_CO
echo " -> Enabling Web Service File Uploads (System-wide)..." echo " -> Enabling Web Service File Uploads (System-wide)..."
docker exec -u "$MOODLE_SYSTEM_USER" "$MOODLE_CONTAINER" php "$MOODLE_ROOT_IN_CONTAINER/admin/cli/cfg.php" --name=webserviceuploaddisabled --set=0 docker exec -u "$MOODLE_SYSTEM_USER" "$MOODLE_CONTAINER" php "$MOODLE_ROOT_IN_CONTAINER/admin/cli/cfg.php" --name=webserviceuploaddisabled --set=0
# remove next comment line
# --- THIS IS THE FINAL FIX ---
# Enable username/password authentication for web service token generation # Enable username/password authentication for web service token generation
echo " -> Enabling password authentication for web services..." echo " -> Enabling password authentication for web services..."
docker exec -u "$MOODLE_SYSTEM_USER" "$MOODLE_CONTAINER" php "$MOODLE_ROOT_IN_CONTAINER/admin/cli/cfg.php" --name=enablewsauthpassword --set=1 docker exec -u "$MOODLE_SYSTEM_USER" "$MOODLE_CONTAINER" php "$MOODLE_ROOT_IN_CONTAINER/admin/cli/cfg.php" --name=enablewsauthpassword --set=1
...@@ -210,8 +208,7 @@ INSERT IGNORE INTO mdl_external_services_functions (externalserviceid, functionn ...@@ -210,8 +208,7 @@ INSERT IGNORE INTO mdl_external_services_functions (externalserviceid, functionn
(@serviceid, 'mod_assign_get_submissions'), (@serviceid, 'mod_assign_get_submissions'),
(@serviceid, 'mod_assign_save_grade'), (@serviceid, 'mod_assign_save_grade'),
(@serviceid, 'assignsubmission_dta_save_submission'); (@serviceid, 'assignsubmission_dta_save_submission');
# GL: - remove following comment line
# -- *** THIS IS THE CRITICAL FIX ***
# -- Authorize the teacher user to use this service. # -- Authorize the teacher user to use this service.
SET @automationuserid = (SELECT id FROM mdl_user WHERE username = '$AUTOMATION_USER_NAME' AND deleted = 0 ORDER BY id ASC LIMIT 1); SET @automationuserid = (SELECT id FROM mdl_user WHERE username = '$AUTOMATION_USER_NAME' AND deleted = 0 ORDER BY id ASC LIMIT 1);
INSERT IGNORE INTO mdl_external_services_users (externalserviceid, userid, iprestriction, validuntil, timecreated) INSERT IGNORE INTO mdl_external_services_users (externalserviceid, userid, iprestriction, validuntil, timecreated)
...@@ -247,8 +244,7 @@ echo "✅ Assigned System Roles to Automation User." ...@@ -247,8 +244,7 @@ echo "✅ Assigned System Roles to Automation User."
docker exec -u "$MOODLE_SYSTEM_USER" "$MOODLE_CONTAINER" php "$MOODLE_ROOT_IN_CONTAINER/admin/cli/purge_caches.php" docker exec -u "$MOODLE_SYSTEM_USER" "$MOODLE_CONTAINER" php "$MOODLE_ROOT_IN_CONTAINER/admin/cli/purge_caches.php"
sleep 15 sleep 15
# GL: - remove the following comment line
# --- THIS IS THE CRITICAL FIX ---
echo " -> Purging Moodle caches to apply service changes..." echo " -> Purging Moodle caches to apply service changes..."
docker exec -u "$MOODLE_SYSTEM_USER" "$MOODLE_CONTAINER" php "$MOODLE_ROOT_IN_CONTAINER/admin/cli/purge_caches.php" docker exec -u "$MOODLE_SYSTEM_USER" "$MOODLE_CONTAINER" php "$MOODLE_ROOT_IN_CONTAINER/admin/cli/purge_caches.php"
echo "✅ Caches purged." echo "✅ Caches purged."
...@@ -298,8 +294,6 @@ if [ -z "$NEW_COURSE_ID" ] || [ "$NEW_COURSE_ID" == "null" ]; then ...@@ -298,8 +294,6 @@ if [ -z "$NEW_COURSE_ID" ] || [ "$NEW_COURSE_ID" == "null" ]; then
exit 1 exit 1
fi fi
echo "✅ Successfully created course '$COURSE_SHORTNAME' with ID: $NEW_COURSE_ID" echo "✅ Successfully created course '$COURSE_SHORTNAME' with ID: $NEW_COURSE_ID"
# GL: - remove following comment line
# --- END OF ROBUST ERROR CHECK ---
# --- Step 5: Enroll Teacher User into the New Course --- # --- Step 5: Enroll Teacher User into the New Course ---
echo "🧑‍🏫 Step 5: Enrolling teacher in the new course..." echo "🧑‍🏫 Step 5: Enrolling teacher in the new course..."
...@@ -382,8 +376,6 @@ if (count(\$argv) < 3) { exit("Error: Course ID and DTA Item ID are required.\n" ...@@ -382,8 +376,6 @@ if (count(\$argv) < 3) { exit("Error: Course ID and DTA Item ID are required.\n"
\$data->assignsubmission_dta_enabled = 1; \$data->assignsubmission_dta_enabled = 1;
\$data->assignsubmission_file_enabled = 1; \$data->assignsubmission_file_enabled = 1;
//GL: - remove following comment line
// --- THIS IS FIX #1: Correct property name for the DTA file manager ---
// This assumes the form element for your file manager is named 'package_filemanager' // This assumes the form element for your file manager is named 'package_filemanager'
// The final property name becomes assignsubmission_dta_package_filemanager // The final property name becomes assignsubmission_dta_package_filemanager
\$data->dta = 1; // Explicitly enable the dta group of settings \$data->dta = 1; // Explicitly enable the dta group of settings
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment