How to properly manual delete the remaining 'assignfeedback_editpdf' after uninstalling the AnnotatePDF plugin

How to properly manual delete the remaining 'assignfeedback_editpdf' after uninstalling the AnnotatePDF plugin

by Rodel Cariño -
Number of replies: 16

I found out that multiple entries of assignfeedback_editpdf was autogenerated whenever a student submit a image file or a teacher issues a image feedback file, the total filesize of the multiple assignfeedback_editpdf entries was about 4x - 5x the size of the actual uploaded file. we ran low disk space and decided to uninstall AnnotatePDF plugin so that all of its related data will be deleted as well, after uninstallation i run moosh file-delete --flush to immidiately emty the trashcan and its a success we recover about 50GB of disk space, but upon checking the mdl_files table, there's still 28GB assignfeedback_editpdf where filearea are 'tmp_jpg_to_pdf' & 'stamps'. How can i properly removed these remaining data, so that the deletion will be cascaded to all of its related data and no orphan records will be left?

Average of ratings: -
In reply to Rodel Cariño

Re: How to properly manual delete the remaining 'assignfeedback_editpdf' after uninstalling the AnnotatePDF plugin

by Serhii Banha -
Hi! Do you find some solution?
In reply to Serhii Banha

Re: How to properly manual delete the remaining 'assignfeedback_editpdf' after uninstalling the AnnotatePDF plugin

by Rodel Cariño -

Nope I'm not doing manual deletion to any of the tables, what I did was every time our disk quota is about 80% full I again uninstall the AnnotatePDF plugin - that trick frees up ~40GB of our dusk space. 

In reply to Rodel Cariño

Re: How to properly manual delete the remaining 'assignfeedback_editpdf' after uninstalling the AnnotatePDF plugin

by Johnny Lo -
How did you find out the extra space used are from the assignfeedback_editpdf plugin?
In reply to Johnny Lo

Re: How to properly manual delete the remaining 'assignfeedback_editpdf' after uninstalling the AnnotatePDF plugin

by Dublin Design -

In moodledata/temp/assignfeedback_editpdf/pageimages folder there is usually number of subfolders with long random names like 00e24d2e392c898e771c20fdc90ee52dce173733. content inside are pdf files.

Not sure if this is auto delete when removed from database, I have few GB already and growing sad

In reply to Rodel Cariño

Re: How to properly manual delete the remaining 'assignfeedback_editpdf' after uninstalling the AnnotatePDF plugin

by Achim Raphael -

This is a longer known, annoying bug in this plugin:
https://tracker.moodle.org/browse/MDL-69570

I can't understand why it isn't still not fixed.
In our moodle we have to clean up these orphaned files (10GB every week) continuously with moosh and bash-shellscripts. sad

In reply to Achim Raphael

Re: How to properly manual delete the remaining 'assignfeedback_editpdf' after uninstalling the AnnotatePDF plugin

by Hariharasudhan A S -
Hi, I am facing the same problem. Could you please share the script your are using. Thanks
In reply to Hariharasudhan A S

Re: How to properly manual delete the remaining 'assignfeedback_editpdf' after uninstalling the AnnotatePDF plugin

by Achim Raphael -
Hi

The scripts are too specific to our installation to share them, but I can tell you how I do it:

First I get a list of the ids of all courses in the category, from which I want to purge all editpdf-files:
moosh -n -p $moodlepath -c $catid | awk -F, '{ print $1 }' | tr -d \" >$tmpfile
(You can use moosh -n category-list $category-name to find a categories id)

Then I scan these courses for the editpdf-files:

rm $editpdffiles 2>/dev/null
i=0
while read -r cid; do
i=$((i + 1))
[ $i -eq 1 ] && continue;
moosh -n -p $moodlepath file-list course=$cid \
| grep -e "assignfeedback_editpdf" \
| grep -v -e ":stamps:" \
>>$editpdffiles
done < $tmpfile

This gives a list of all these files. Here a sample line:
1581580 0 .... f111716a9e35eea8aa735106e3cba13857eae832 Saturday, 10. April 2021, 10:13 77645:assignfeedback_editpdf:combined:40147 combined.pdf
---

You can now purge all these files (or filter them before by date as I do)
cat $editpdffiles | moosh -n -p $moodlepath file-delete -s

Hope it helps a bit.

But be careful and check all twice, so you not delete something wrong wink
Average of ratings: Useful (1)
In reply to Hariharasudhan A S

Re: How to properly manual delete the remaining 'assignfeedback_editpdf' after uninstalling the AnnotatePDF plugin

by Christian Stickel -

I don't have moosh installed, so my approach is different, although still using bash. It assumes that you have a separate DB Server to connect through ssh, but that can be changed easily. The select statement creates a deletelist shellscript which is then executed and removes the physical files. Afterwards the db entries in mdl_files are removed.

mytime="1 YEAR"
sqluser"yourusername"
sqlPW="yourpassword"

#create deletelist script
ssh user@yourserver "mysql -u$sqluser -p$sqlPW yourmoodle_db -e \"SELECT DISTINCT CONCAT('rm -f /path/to/moodledata/filedir/', LEFT(mdl_files.contenthash, 2),'/', MID(mdl_files.contenthash, 3, 2),'/', mdl_files.contenthash,';') AS shellscript FROM mdl_files WHERE component = 'assignfeedback_editpdf' AND timecreated < UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL $mytime));\"" > clear.sh;

#modify and execute deletelist script
sed -i '1d' clear.sh
chmod +x clear.sh
/path/to/clear.sh;

#delete database entries
ssh user@yourserver "mysql -u$sqluser -p$sqlPW yourmoodle_db -e \"DELETE FROM mdl_files WHERE component = 'assignfeedback_editpdf' AND timecreated < UNIX_TIMESTAMP(DATE_SUB(NOW(),INTERVAL $mytime));\"";

Average of ratings: Useful (3)
In reply to Christian Stickel

Re: How to properly manual delete the remaining 'assignfeedback_editpdf' after uninstalling the AnnotatePDF plugin

by Achim Raphael -
Nice.
Is anyone able to write a moodleplugin doing this?
Then this could be used via backend by those who don't have access to the server.
Average of ratings: Useful (2)
In reply to Achim Raphael

Re: How to properly manual delete the remaining 'assignfeedback_editpdf' after uninstalling the AnnotatePDF plugin

by Tyler Bogdan -
I've done a bit of cleaning of these files (ones that are 4-5 years old) but it still makes me nervous to do so. What exactly are their purpose? We actively use AnnotatePDF and I don't want to delete files that are being relied upon for the plugin to function or for students to view feedback on their assignments.
In reply to Tyler Bogdan

Re: How to properly manual delete the remaining 'assignfeedback_editpdf' after uninstalling the AnnotatePDF plugin

by Achim Raphael -
In reply to Achim Raphael

Re: How to properly manual delete the remaining 'assignfeedback_editpdf' after uninstalling the AnnotatePDF plugin

by Jose Miralles -
Hi there!
Is there any fix now of this issue without coding for those we are afraid of doing it?
In reply to Achim Raphael

Re: How to properly manual delete the remaining 'assignfeedback_editpdf' after uninstalling the AnnotatePDF plugin

by Johnny Lo -
We are running 3.11.9+ on IIS and MS SQL 2019. Can anyone provide a quick guideline on how to merge the fix to the current local branch? I started to use Git to upgrade moodle a couple of times already but can definitely use some guidiance in merging fixes.
Average of ratings: Useful (1)
In reply to Rodel Cariño

Re: How to properly manual delete the remaining 'assignfeedback_editpdf' after uninstalling the AnnotatePDF plugin

by Mawan A. Nugroho -
There is one course that contains 6 GB of data, even though the participant has been deleted and even the user has been deleted. Upon investigation, the cause was assignfeedback_editpdf. I think, AnnotatePDF plugin is the worst plugin in Moodle, and we should remove this plugin asap.


Average of ratings: Useful (1)
In reply to Mawan A. Nugroho

Re: How to properly manual delete the remaining 'assignfeedback_editpdf' after uninstalling the AnnotatePDF plugin

by Christian Stickel -
Delete either the assignment or the course and the data will begone.
Average of ratings: Useful (1)