Backup/restore changes activity type

Backup/restore changes activity type

by Stephen Ogden -
Number of replies: 5
Hi all,

I'm having an issue that I hope someone can help me resolve - or at least give me some pointers as where to look!

I have a course that contains:
When I duplicate the page activity the link to the resource activity gets altered.

Instead of linking to something like: https://my.moodle.site/mod/resource/view.php?id=4221 ...
it instead points to a non-existent activity like: https://my.moodle.site/mod/<third-party-plugin-name>/view.php?id=4225

I get the exact same behaviour if I backup the course and restore to a new course.

I've altered the domain name and name of the third party plugin to protect the innocent (or guilty?).

Has anyone come across this behaviour before?

Is this likely to only be a bug in this third-party plugin or is this a Moodle bug (behaviour that should never ever be possible no matter how badly a third-party plugin might be written) ?

Note: error tested and replicated on Moodle 3.4.3 (Build: 20180517) and Moodle 3.6.1 (Build: 20181205)

many thanks for any help that you can provide
Average of ratings: -
In reply to Stephen Ogden

Re: Backup/restore changes activity type

by Ken Task -
Picture of Particularly helpful Moodlers

If you suspect an issue with a 3rd party plugin, how will anyone be able to help if the plugin info is not shared here?

Think it quite proper to share that info ... plugin maker/maintainer might need to be informed of a bug - if it is a bug.  Others who use the same plugin might have a work-around or fix for it as well.

So 3rd party plugin info, please!

Also turn on debugging to see if Moodle is saying something.

It also doesn't hurt to share info about server ... we know Moodle version ... but PHP/MySQL/MariaDB?  Shared hosting or VPS? etc.

'SoS', Ken

In reply to Ken Task

Re: Backup/restore changes activity type

by Stephen Ogden -

Hi Ken,

Thanks for the response. The plugin is from a commercial provider and I certainly will report this bug to them. If this isn't something anyone has ever encountered it would certainly make me feel more inclined to think it is a bug in their product.

PHP 7.1.14, MYSQL 5.7.16.10, Running on own VM.

Have you experienced this bug before? Anyone else?

many thanks

In reply to Stephen Ogden

Re: Re: Backup/restore changes activity type

by Ken Task -
Picture of Particularly helpful Moodlers

And no debug info?

Can't say that I've experienced first hand but then again don't run many $ plugins either.   $ or not, what is this plugins purpose?  Any link to description of the plugin might useful as well if debug is reporting anything.

Other ... since it involves a file, might also check web service error logs.

'SoS', Ken



In reply to Ken Task

Re: Re: Re: Backup/restore changes activity type

by Stephen Ogden -
No debug as this was working 'correctly' as per the bug I've described in my recent post. Glad I got to the bottom of it, thank you for your engagement and help.
In reply to Stephen Ogden

Re: Backup/restore changes activity type

by Stephen Ogden -
In case anyone encounters this sort of problem in the future, I've found the bug.

The third party plugin had errors in both restore_<PLUGIN-NAME>_activity_task.class.php and backup_<PLUGIN-NAME>_activity_task.class.php files. I'm assuming these had been copied (as starting points) from the standard resource plugin but had kept the references to '$@RESOURCEINDEX*$2@$' and '$@RESOURCEVIEWBYID*$2@$'.

This resulted in the backup/restore related activities regex matching links to RESOURCE activities and treating them as belonging to this third party plugin and re-writing links (as described above)

The fix is as simple as changing those references to unique values: '$@<PLUGIN-NAME>INDEX*$2@$' and '$@<PLUGIN-NAME>VIEWBYID*$2@$'.
Average of ratings: Useful (1)