Moodle
  1. Moodle
  2. MDL-13957

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

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.9
    • Fix Version/s: 1.8.9, 1.9.5
    • Component/s: Other
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_18_STABLE, MOODLE_19_STABLE
    • Rank:
      30410

      Description

      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.

      1. copy_userdirs_for_1_9
        2 kB
        Martin Mai
      1. user_image_links_are_broken.gif
        11 kB
      2. users.jpg
        77 kB

        Issue Links

          Activity

          Hide
          Eloy Lafuente (stronk7) added a comment -

          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

          Show
          Eloy Lafuente (stronk7) added a comment - 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
          Hide
          Andrew Carter added a comment -

          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?

          Show
          Andrew Carter added a comment - 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?
          Hide
          Eloy Lafuente (stronk7) added a comment -

          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!

          Show
          Eloy Lafuente (stronk7) added a comment - 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!
          Hide
          Andrew Carter added a comment -

          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

          Show
          Andrew Carter added a comment - 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
          Hide
          Andrew Carter added a comment -

          Screen shot showing old and new users directories after upgrade to 1.9

          Show
          Andrew Carter added a comment - Screen shot showing old and new users directories after upgrade to 1.9
          Hide
          Martin Mai added a comment -

          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."/");

          Show
          Martin Mai added a comment - 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."/");
          Hide
          Grant Sewell added a comment -

          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?

          Show
          Grant Sewell added a comment - 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?
          Hide
          Eloy Lafuente (stronk7) added a comment -

          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?

          Show
          Eloy Lafuente (stronk7) added a comment - 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?
          Hide
          Martin Dougiamas added a comment -

          Nicolas is working on such a script ...

          Show
          Martin Dougiamas added a comment - Nicolas is working on such a script ...
          Hide
          Nicolas Connault added a comment -

          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).

          Show
          Nicolas Connault added a comment - 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).

            People

            • Votes:
              4 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: