## General help

### can't edit text if an image is missing from moodle data, can't fix it either.

This discussion has been locked because a year has elapsed since the last post. Please start a new discussion topic.
can't edit text if an image is missing from moodle data, can't fix it either.

so, when your moodledata folder decides that a file no longer exists, you're screwed right?

I saw broken images in my course, so I pressed the pencil to edit the descriptions, and this happened.

Pressing continue takes you back to the homepage. So ... apart from getting an error, then doing a "touch" on that file to create it again, and then refreshing and getting the next error (touch, repeat, etc). Is there a way that the "Continue" might take you to an editor so you can actually FIX the problem, say by upload said files again?

Average of ratings: -
Re: can't edit text if an image is missing from moodle data, can't fix it either.

'cannot read file OR *permissions problem*'. Touch might create the file but are permissions on the touched file correct?

Did you investigate if the contenthash named file in filedir/82/ff/ actually existed before 'touching'?

If the contenthashed file name does exist did you check the type of file it was.  Example of filedir/4e/*/*

[root@sos filedir]# ls -l 4e/*/*
-rw-rw-rw- 1 apache apache 114688 Feb  4 09:57 4e/28/4e28a256ed6aae09fe39b59e235c93bf8301a94c
-rw-rw-rw- 1 apache apache   2717 Aug 23 10:53 4e/5d/4e5d217850be0a404fe2861227773fd869f0715a
-rw-rw-rw- 1 apache apache 286411 Feb  2 11:39 4e/61/4e61f64c640b758cb70610c504f07498c870c1d3
-rw-rw-rw- 1 apache apache  54284 Jan 10 13:53 4e/e2/4ee20548a96fdd1dc84ca63e4199c159b4246306

file -b 4e/*/*
Microsoft Office Document
PNG image data, 90 x 90, 8-bit/color RGBA, non-interlaced
Zip archive data, at least v2.0 to extract
PNG image data, 400 x 36, 8-bit/color RGBA, non-interlaced

'spirit of sharing', Ken

Average of ratings: -
Re: can't edit text if an image is missing from moodle data, can't fix it either.

Hmmm ... responding to own post ... that a faux-paux?  Anyway, in investigating the new Moodle 2 file system, found a need and came up with a simple bash script (one liner) that might help system admins and thought I'd share.  It does relate, somewhat, to the issues explored in this thread (me thinks).

This is for linux/MacOSX.  Sometimes working with the new Moodle file system one might need to know information about the files whose names have been hashed.

While one could do a MySQL query to see info, one might also need to see what the operating system knows about them, thus this one liner:

In the moodledata/filedir directory, issue the following command:

for f in ./*/*/*; do echo "$f"; file -b "$f"; echo "-------"; done

Output:
List the directory/hashfilename and underneath shows the file information - file type and other info related to the file.

Example:  the one-liner above is an a file called 'explore'.  the 'source' command treats the file (explore) like it was an executable.

[root@sos filedir]# source explore
./01/d8/01d8f546f769c889972a75265b54377f7fe8b9c6
Zip archive data, at least v2.0 to extract
-------
./01/fa/01fa3ffc95f5be7e23b5013c09230ee1753ee75f
PNG image data, 35 x 35, 8-bit/color RGB, non-interlaced
-------
./02/2e/022ebb2062f165ace9871582475e8cd4fb964ea1
ISO Media, MPEG v4 system, version 2
-------
./02/55/0255403cd42d810c4c70d92cb7c63028456029a9
Zip archive data, at least v2.0 to extract

Hope someone finds it useful! ;)

'spirit of sharing', Ken

Average of ratings: -
Re: can't edit text if an image is missing from moodle data, can't fix it either.

yep, had already checked the fs to see if they existed. I did that off the bat since it was the obvious choice. Did a chown / chmod reset on the folders to make sure the apache user had access to moodledata in case that was the problem, checked other things worked etc. In this case the files were missing and since they are still referenced they are causing the process to crash. I'm sure this shouldn't be a problem otherwise google would hand me a  "oh yeah, duh" answer, but it hasn't in this case. Any suggestions, however oddball at this point would be appreciated

Average of ratings: -