Moodle Data
Moodle Data
There are three areas that should be backed up before any upgrade:
mv /var/www/html/moodle /var/www/html/moodlebkup
#cd /var/
tar -cvf moodledata.tar moodledata
Next, copy across your config.php, any custom plugins, and your .htaccess file if
you created one (check that custom plugins are the correct version for your new
Moodle first):
#cd /var/www/html/
cp moodlebkup/config.php moodle
cp -pr moodlebkup/theme/mytheme moodle/theme/mytheme (if exists)
cp -pr moodlebkup/mod/mymod moodle/mod/mymod (if exits)
Don't forget to make moodle/config.php (and the rest of the source code) readable
by your www server. For maximum security the files should not be writeable by your
server. This is especially important on a 'production' server open to the public
internet.
If you use cron, take care that cron.php is executeable and uses the correct php
command:
----------------
ONE Time if migration from version earlier then 3.2 to 3.2. Then DB enginee
conversion is required.
---------
MySQL storage engine conversion
cd /var/www/html/moodle/
/usr/bin/php admin/cli/mysql_engine.php --engine=InnoDB
To proceed with the conversion, run the command using the fix option:
Upgrade moodle
sudo -u apache /usr/bin/php /var/www/html/moodle/admin/cli/upgrade.php (if error
occured databse cannot be read then use the GUI method)
OR From GUi
https://moodle.sngpl.com.pk/admin/index.php
Now you can connect to the database as the root user, which should not ask for a
password.
mysql -u root
Now that you have root access, you can change the root password.
mv /var/www/html/moodle /var/www/html/moodlebkup
mysql -u root -p
CREATE DATABASE moodle;
mysql -u root -p moodle < data-dump.sql
Optional Optimization
I recently found on our Moodle server that students were timing out when trying to
self-enrol on a course.
Site Administration > Server > Scheduled tasks > Edit task schedule: Self enrolment
synchronise enrolments task
Change the /10 into /1 to have this task run every minute ( change into * to run
the script every minute.)