Quantcast
Channel: Backup and restore
Viewing all articles
Browse latest Browse all 6815

restore with new URL

$
0
0
by Alexander Urban.  

Hello,

for creating test instances I wrote a script that would find and replace all occurrences of the URL, such as 

moodle.myschool.com -> moodle-test.myschool.com

but there are some things I want to ask experts regarding that topic.

should I find/replace the strings in the moodledata folder as well? I asked chat-gpt and it told me that this will lead to inconsistent state because of precompiled php. To be honest - I don't know enough about php internals to tell if this is true or hallucination.

I am aware of the replace php script in moodle. It tells me that it cannot replace strings if the resulting string is longer than the current string.

I would stop cronjobs and apache, copy over my backup files to a test server and modify with the following script:

#!/bin/bash

echo 'replace strings in sql file'

sed -i ’s#moodle.myschool.com#moodl-test.myschool.com#g’ moodle.sql

echo 'replace in moodledata folder'

find /var/www/moodledata -type f -exec sed -i ’s#moodle.myschool.com#moodle-test.myschool.com#g’ {} +

echo 'replace in html folder'

find /var/www/html -type f -exec sed -i ‘#moodle.myschool.com#moodle-test.myschool.com#g’ {} +

I do know now that /var/www/html (the moodle files) should not contain URL-Strings but the base-URL. So this can be left out next time and should be edited manually.

Please let me know what you think - the most interesting part for me is the moodledata directory.

Thank you 

Alex


Viewing all articles
Browse latest Browse all 6815

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>