Issue Details (XML | Word | Printable)

Key: MDL-13957
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Nicolas Connault
Reporter: Charles Kelly
Votes: 4
Watchers: 7
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

NOT FOUND ERRORS = /user/pix.php/2/f2.jpg after updating to 1.9 from 1.8

Created: 18/Mar/08 02:53 PM   Updated: 12/May/09 04:22 PM
Return to search
Component/s: Other
Affects Version/s: 1.9
Fix Version/s: 1.8.9, 1.9.5

File Attachments: 1. File copy_userdirs_for_1_9 (2 kB)

Image Attachments:

1. user_image_links_are_broken.gif
(11 kB)

2. users.jpg
(77 kB)
Issue Links:
Duplicate
 

Participants: Andrew Carter, Charles Kelly, Eloy Lafuente (stronk7), Grant Sewell, Martin Dougiamas, Martin Mai and Nicolas Connault
Security Level: None
Resolved date: 12/May/09
Affected Branches: MOODLE_19_STABLE
Fixed Branches: MOODLE_18_STABLE, MOODLE_19_STABLE


 Description  « Hide
Links to "user" photos did not work after updating from Moodle 1.8 to Moodle 1.9.

However, I noticed the link works on moodle.og
http://moodle.org/user/pix.php/2/f2.jpg

I wonder if some code has been changed since moodle.org updated from 1.8 to 1.9 that may have cause this problem.

I've attached an image that helps show the problem.
This is a new install Moodle. 1.9 (March 16 or 17, 2008 version.)
I installed it in a new directory, then set my config.php file to use a copy of the "moodledata" folder.

Related?
I noticed that now in the moodledata folder, there is a "user" folder using a new folder structure and the older "users" folder, which I assume is perhaps just a backup of the data.




 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Eloy Lafuente (stronk7) added a comment - 30/Mar/08 10:12 AM
Hi Charles,

as part of the migration from 1.8 to 1.9 user images have been moved from the old "users" dir to a new "user" dir, using one extra level in the new storage to prevent some problems in BIG sites.

Curiously, it sees that the new "user" structure was properly generated in your site (from screenshot), with user 2 images ready to be served.

Can you confirm what version of this script:

moodle/user/pix.php

are you using? Just to be 100% sure you aren't running a outdated version.

Assigning this to Nicolas... hi worked on the user-images migration and has more knowledge about what can be failing... ciao


Andrew Carter added a comment - 17/Apr/08 05:22 AM
Hi,

I've been doing some testing in preparation for upgrading from 1.8.2 to 1.9 (20080409) and I am experiencing a similar problem to the one mentioned above. After upgrading, some, but not all, of the user pictures display the default image instead of the one that they uploaded.

I did a diff on the two versions of pix.php and I've pasted the results below:

--------------------------------------------------
~/compare ]$ diff old.php new.php
1c1
< <?PHP // $Id: pix.php,v 1.16 2007/01/26 20:15:54 skodak Exp $

> <?PHP // $Id: pix.php,v 1.16.4.1 2007/10/11 11:12:52 nicolasconnault Exp $
21c21
< $pathname = $CFG->dataroot.'/users/'.$userid.'/'.$image;

> $pathname = make_user_directory($userid, true) . "/$image";
-----------------------------------------------------

Now, out of curiosity I changed the $pathname assignment in the new file back to the old definition and the user pictures display properly. So it seems that something is not working properly for us with the new definition.

Any ideas?


Eloy Lafuente (stronk7) added a comment - 17/Apr/08 09:06 AM
Hi Andrew,

changing to the old $pathname works because old images are left in the original place ("users" dir). But all the new images and so on will go to the new "user" dir, so won't display ok using the old $pathname.

Anyway, it's seems that we are receiving more than one reports about missing images. Andrew, could you, please:

  • did you get any error in the upgrade process?
  • give us some user ids that are failing after the upgrade. Are you able to find some pattern is those ids (for example, "al those ending in 00 aren't working" or "all those bigger that 456 arent working".
  • can you search for them in the new "user" dir (should be below on intermendate.

Thanks!


Andrew Carter added a comment - 17/Apr/08 09:50 PM
Ok, I've gone into the new user directory and it looks like all of the users with id's higher than 169 are missing. I changed the pix.php script back to the new $pathname definition and copied a couple people over from the users directory and their images appear properly.

To answer your other question, I did not get any error in the upgrade process (at least none that I saw).

I have also attached a screen shot of the old users directory and the new user directory.

Cheers,

-Andrew


Andrew Carter added a comment - 17/Apr/08 09:51 PM
Screen shot showing old and new users directories after upgrade to 1.9

Martin Mai added a comment - 01/Nov/08 09:57 AM
same issue when upgrading from 1.8.3 to 1.8.7 and 1.9.3 (some of the user images are missing, no Error-Message during upgrade). Bigger and smaller user ids are affected.

I tried the silly php snippet in the attachement to copy missing directories
like
exec("rsync -a -v ".$path."users/".$user_dir."/"
." ".$path."user/".$group_dir."/".$user_dir."/");


Grant Sewell added a comment - 06/Nov/08 11:05 PM
I tried the snippet as well but no luck. In fact, I've tried a number of things to resolve this issue and have had little success.

I'm really suprised that this is listed as "Minor" - it may not create a functionality problem, but it really does look unprofessional.
I haven't had user images appear since March (after upgrade from 1.8 to 1.9+) - can we escalate this or at least try to find a workaround?


Eloy Lafuente (stronk7) added a comment - 10/Nov/08 09:02 AM
Agree... I'm raising this to Major... perhaps we could try another upgrade step, or at least provide a fix_missing_images php script to help with this problem, Nico?

Martin Dougiamas added a comment - 12/May/09 01:27 PM
Nicolas is working on such a script ...

Nicolas Connault added a comment - 12/May/09 04:22 PM
A new script, admin/fixuserpix.php, has been added to 1.8 and 1.9. It can either be run in the browser (if logged as admin user) or from CLI (with admin user credentials).