Replace cli tool moodle.19

Replace cli tool moodle.19

by Albert Ramsbottom -
Number of replies: 5

Hi


Does anyone know if there is a replace tool for URL chnage in Moodle 1.9 and if so how is it run?


Cheers

Average of ratings: -
In reply to Albert Ramsbottom

Re: Replace cli tool moodle.19

by Ken Task -
Picture of Particularly helpful Moodlers

How true, Howard! smile

OR, if large site and no tweaks to php times to execute/etc., might also do it the very old way ...

a sed search and replace on an sql dump of the DB for the moodle.

or

an editor that has 'friendly' search and replace (like nano) on an sql dump of the DB for moodle.

Then re-import the DB sql.

One of the 'old dudes' ... 'spirit of sharing', Ken


In reply to Albert Ramsbottom

Re: Replace cli tool moodle.19

by Ken Task -
Picture of Particularly helpful Moodlers

Looks like you are in the process of 'marching' a site from 1.9.20+ to higher - I hope using git as that does take the web service out of the loop.

From what I re-call, had to make some tweaks ... like max_packet_allowed and max_input_vars as well.

The first hop from 1.9.20+ to the version of 2 you've chosen ... think 2.2.highest ... will be the most massive especially in moodledata and the new file system.   From that time forward, site will be using Legacy in file system - site as well as courses.   Don't turn off Legacy.

There is a plugin called 'poof' one could install at some point to edit resources that are using Legacy ... or, if you are game, https://sos.tcea.org/clipoof - a command line 'poof' tool to convert a backup of a course from using Legacy to 'normal' file system.   Just happened to be working on that this weekend as I re-visited Moodle HQ's 'advice' on Legacy and I have some sites that have been marched from 1.9.x to now 3.4.x and 3.5.x and am getting nervous about Legacy.

https://docs.moodle.org/35/en/Legacy_course_files

Q: "Long term, will there be any problem keeping a large number of Legacy files?
Response: Possibly if you want to import (as opposed to restore) you may lose legacy files."

And you'll see some strangeness in moodledata ... a bunch of old course ID directories.  1 is the front page. Good idea not to remove them as they could still be involved in certificates.

And good idea to install and run mysqltuner to get a look at the DB for the site ... maybe at each stage for a while and especially when one is approaching the version 3's when database changes/tweaks started coming into play.

Oh what fun!  2 cent advice.

'spirit of sharing', Ken


Average of ratings: Useful (1)
In reply to Ken Task

Re: Replace cli tool moodle.19

by Albert Ramsbottom -

Thanks Howard and Ken

Great advice. On this one we are just rolling it over to an archive, and we have had a trying day. As we didnt realise that there wasnt a CLI version of the search and replace. This has caused us issues at it will not complete in the browser

The DB is 4GB and takes hours and hours to dump, so we have a few issues

I suggested that we dumped it last week and ran "sed", however it would have still taken half a day to dump back in

We are looking at alternatives for tomorrow


Cheers

In reply to Albert Ramsbottom

Re: Replace cli tool moodle.19

by Ken Task -
Picture of Particularly helpful Moodlers

Archival purpose ... well then, how important is it to retain the 'who done it' table?  That table is usually the largest table and thus could have 1G (millions of rows) in the sql dump.   If it's not important, truncate that table before the  dump.

Often ask K12 entities that question ... 'How important is the who done it table?'   Since they are not looking to track who did what beyond a single academic year, truncating that table has resulted in sql dumps being multiple gigs less.

'spirit of sharing', Ken