Issue Details (XML | Word | Printable)

Key: MDL-8605
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Blocker Blocker
Assignee: Nicolas Connault
Reporter: Eloy Lafuente (stronk7)
Votes: 0
Watchers: 9
Operations

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

Reduce the number of dirs under the users file area

Created: 22/Feb/07 02:16 AM   Updated: 12/May/09 04:14 PM
Return to search
Component/s: Administration
Affects Version/s: 1.8, 1.9
Fix Version/s: 1.8.4, 1.9, 2.0

File Attachments: 1. File hash.php (0.8 kB)
2. File newhash.php (0.8 kB)

Issue Links:
Dependency
Relates
 

Participants: Andrea Bicciolo, Anthony Borrow, Eloy Lafuente (stronk7), Iñaki Arenaza, Jose Rama, Martin Dougiamas, Nicolas Connault, Oswald Zangerle, Petr Skoda, Red Morris, Ryan Smith and Tim Hunt
Security Level: None
QA Assignee: Petr Skoda
Resolved date: 21/Oct/07
Affected Branches: MOODLE_18_STABLE, MOODLE_19_STABLE
Fixed Branches: MOODLE_18_STABLE, MOODLE_19_STABLE, MOODLE_20_STABLE


 Description  « Hide
Currently (all Moodle versions) under the moodledata/users directory, one dir with the userid is created to store, basically, the avatar of the user. This system has two big drawbacks:

1) BIG sites are beginning to raise the "Max files per dir" OS limit. And usually, this is one hard limit.
2) The structure under each userid directory is pretty plain and we should start to accommodate it for future personal storage.

So, I would propose to:

1) Create one simple algorithm that, based in one number (userid), will return one unique hash of fixed length.
2) Create one function - create_user_dir($userid) - in order to create the user storage area. Such storage area should be created by creating nested subdirs with parts of the hash calculated in step 1 (nor raising, say, 12 bits, per name = 4096 dirs per dir). This function could have one optional parameter ($migrate = false), to allow migration from old user storage areas to the new ones transparently.
3) Create one function - get_user_dir($userid) - in order to get the path to the user storage area. This function should check for the new areas + the current ones in order to keep compatibility.
4) Inside each user storage area, create one "private" dir, where we'll move the avatars. Such "private" dir is intended to store files that are handled by Moodle but without FileManager access for students in the future.
5) Change all current uses of user storage area to use the functions defined above.
6) Document it to allow developers to know how they must handle files in that zone.

Sounds simple. Ciao :-)

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Nicolas Connault committed 11 files to 'Moodle CVS' - 11/Oct/07 05:01 PM
MDL-8605 New user directories implemented
MODIFY enrol/imsenterprise/enrol.php   Rev. 1.14    (+1 -1 lines)
MODIFY lib/db/upgradelib.php   Rev. 1.10    (+2 -2 lines)
MODIFY user/editlib.php   Rev. 1.12    (+3 -3 lines)
MODIFY lib/db/upgrade.php   Rev. 1.155    (+40 -1 lines)
MODIFY user/pix.php   Rev. 1.17    (+3 -3 lines)
MODIFY lib/gdlib.php   Rev. 1.15    (+18 -15 lines)
MODIFY lib/simpletest/testmoodlelib.php   Rev. 1.10    (+20 -1 lines)
MODIFY auth/mnet/auth.php   Rev. 1.28    (+5 -5 lines)
MODIFY version.php   Rev. 1.565    (+1 -1 lines)
MODIFY lib/moodlelib.php   Rev. 1.961    (+32 -3 lines)
MODIFY lang/en_utf8/moodle.php   Rev. 1.142    (+2 -1 lines)
Nicolas Connault committed 11 files to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 11/Oct/07 07:12 PM
MDL-8605 New user directories implemented
MODIFY user/pix.php   Rev. 1.16.4.1    (+2 -2 lines)
MODIFY lib/simpletest/testmoodlelib.php   Rev. 1.9.2.1    (+20 -1 lines)
MODIFY lib/db/upgradelib.php   Rev. 1.9.2.1    (+2 -2 lines)
MODIFY auth/mnet/auth.php   Rev. 1.27.2.1    (+5 -5 lines)
MODIFY lib/gdlib.php   Rev. 1.14.2.1    (+17 -14 lines)
MODIFY lib/moodlelib.php   Rev. 1.960.2.1    (+32 -3 lines)
MODIFY lang/en_utf8/moodle.php   Rev. 1.141.2.1    (+2 -1 lines)
MODIFY version.php   Rev. 1.563.2.1    (+1 -1 lines)
MODIFY lib/db/upgrade.php   Rev. 1.154.2.1    (+41 -1 lines)
MODIFY enrol/imsenterprise/enrol.php   Rev. 1.13.2.1    (+1 -1 lines)
MODIFY user/editlib.php   Rev. 1.11.2.1    (+3 -3 lines)
Nicolas Connault committed 9 files to 'Moodle CVS' on branch 'MOODLE_18_STABLE' - 11/Oct/07 09:19 PM
MDL-8605 New user directories implemented
MODIFY lib/moodlelib.php   Rev. 1.837.2.69    (+31 -2 lines)
MODIFY lib/simpletest/testmoodlelib.php   Rev. 1.2.4.6    (+19 -0 lines)
MODIFY lang/en_utf8/moodle.php   Rev. 1.105.2.18    (+2 -1 lines)
MODIFY user/pix.php   Rev. 1.16.2.1    (+2 -2 lines)
MODIFY user/editlib.php   Rev. 1.4.2.3    (+3 -3 lines)
MODIFY lib/gdlib.php   Rev. 1.13.12.1    (+17 -13 lines)
MODIFY enrol/imsenterprise/enrol.php   Rev. 1.8.6.4    (+1 -1 lines)
MODIFY auth/mnet/auth.php   Rev. 1.14.2.13    (+5 -5 lines)
MODIFY lib/db/upgrade.php   Rev. 1.27.2.19    (+45 -1 lines)
Nicolas Connault committed 3 files to 'Moodle CVS' on branch 'MOODLE_18_STABLE' - 11/Oct/07 10:16 PM
MDL-8605 Minor typos and version.php fix
MODIFY version.php   Rev. 1.425.2.20    (+1 -1 lines)
MODIFY lib/db/upgrade.php   Rev. 1.27.2.20    (+9 -6 lines)
MODIFY user/editlib.php   Rev. 1.4.2.4    (+2 -2 lines)
Nicolas Connault committed 1 file to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 11/Oct/07 10:18 PM
MDL-8605 Preventing new user folder from being created when original folder is empty
MODIFY lib/db/upgrade.php   Rev. 1.154.2.2    (+6 -2 lines)
Nicolas Connault committed 1 file to 'Moodle CVS' - 11/Oct/07 10:19 PM
MDL-8605 Preventing new user folder from being created when original folder is empty
MODIFY lib/db/upgrade.php   Rev. 1.156    (+6 -2 lines)
Mitsuhiro Yoshida committed 2 files to 'Lang CVS' - 12/Oct/07 01:17 AM
Translated a new string for New user directories MDL-8605.
MODIFY ja_utf8/README   Rev. 1.539    (+1 -1 lines)
MODIFY ja_utf8/moodle.php   Rev. 1.247    (+2 -1 lines)
martignoni committed 1 file to 'Lang CVS' - 12/Oct/07 04:38 AM
MDL-8605 New user directories implemented
MODIFY fr_utf8/moodle.php   Rev. 1.174    (+2 -1 lines)
Nicolas Connault committed 7 files to 'Moodle CVS' - 13/Oct/07 03:13 AM
MDL-8605 More changes to upgrade and restore, and some unit tests with db and rs mock objects
MODIFY lib/moodlelib.php   Rev. 1.962    (+47 -2 lines)
MODIFY lib/gdlib.php   Rev. 1.16    (+2 -2 lines)
MODIFY backup/restorelib.php   Rev. 1.284    (+42 -34 lines)
MODIFY backup/backuplib.php   Rev. 1.180    (+13 -21 lines)
MODIFY backup/lib.php   Rev. 1.90    (+2 -2 lines)
ADD lib/simpletest/testbackuplib.php   Rev. 1.1    (+0 -0 lines)
MODIFY lib/dmllib.php   Rev. 1.117    (+4 -4 lines)
Nicolas Connault committed 8 files to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 13/Oct/07 04:24 AM
MDL-8605 Backup and restore implementation
MODIFY calendar/view.php   Rev. 1.95.2.2    (+1 -1 lines)
MODIFY calendar/export.php   Rev. 1.7.2.2    (+1 -1 lines)
MODIFY lib/moodlelib.php   Rev. 1.960.2.2    (+47 -2 lines)
MODIFY lib/simpletest/testbackuplib.php   Rev. 1.1.2.2    (+135 -0 lines)
MODIFY lib/gdlib.php   Rev. 1.14.2.2    (+2 -2 lines)
MODIFY backup/lib.php   Rev. 1.89.2.1    (+3 -3 lines)
MODIFY backup/restorelib.php   Rev. 1.283.2.1    (+29 -21 lines)
MODIFY backup/backuplib.php   Rev. 1.179.2.1    (+10 -18 lines)
Nicolas Connault committed 1 file to 'Moodle CVS' - 13/Oct/07 04:25 AM
MDL-8605 using remove_dir instead of rmdir, which doesn't support deleting non-empty directories
MODIFY backup/lib.php   Rev. 1.91    (+2 -2 lines)
Nicolas Connault committed 5 files to 'Moodle CVS' on branch 'MOODLE_18_STABLE' - 13/Oct/07 04:26 AM
MDL-8605 Backup and restore implemented, and using remove_dir instead of rmdir, which doesn't support deleting non-empty directories
MODIFY backup/restorelib.php   Rev. 1.218.2.25    (+42 -34 lines)
MODIFY lib/gdlib.php   Rev. 1.13.12.2    (+2 -3 lines)
MODIFY backup/lib.php   Rev. 1.78.2.4    (+3 -3 lines)
MODIFY backup/backuplib.php   Rev. 1.135.2.4    (+10 -18 lines)
MODIFY lib/moodlelib.php   Rev. 1.837.2.70    (+47 -2 lines)
Petr Skoda committed 2 files to 'Moodle CVS' on branch 'MOODLE_18_STABLE' - 14/Oct/07 06:05 AM
MDL-8605 quick fix for broken user pix upgrade
MODIFY lib/db/upgrade.php   Rev. 1.27.2.21    (+8 -11 lines)
MODIFY version.php   Rev. 1.425.2.21    (+1 -1 lines)
Petr Skoda committed 1 file to 'Moodle CVS' on branch 'MOODLE_18_STABLE' - 14/Oct/07 06:14 AM
MDL-8605 eh, forgot to undo some testing code before commit, sorry
MODIFY lib/db/upgrade.php   Rev. 1.27.2.22    (+2 -2 lines)
Nicolas Connault committed 2 files to 'Moodle CVS' - 15/Oct/07 01:17 PM
MDL-8605 putting versions in sync between 1.9 and head
MODIFY version.php   Rev. 1.566    (+1 -1 lines)
MODIFY lib/db/upgrade.php   Rev. 1.160    (+2 -2 lines)
Nicolas Connault committed 2 files to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 15/Oct/07 01:18 PM
MDL-8605 putting versions in sync between 1.9 and head
MODIFY version.php   Rev. 1.563.2.3    (+1 -1 lines)
MODIFY lib/db/upgrade.php   Rev. 1.154.2.4    (+2 -2 lines)
Nicolas Connault committed 1 file to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 16/Oct/07 12:54 PM
MDL-8605 Upgrade of user folder will not occur if the user folder already exists
MODIFY lib/db/upgrade.php   Rev. 1.154.2.5    (+2 -2 lines)
Nicolas Connault committed 1 file to 'Moodle CVS' - 16/Oct/07 12:54 PM
MDL-8605 Upgrade of user folder will not occur if the user folder already exists
MODIFY lib/db/upgrade.php   Rev. 1.161    (+2 -2 lines)
Petr Skoda committed 1 file to 'Moodle CVS' - 21/Oct/07 04:57 AM
MDL-8605 fixed user image restore code
MODIFY backup/restorelib.php   Rev. 1.287    (+14 -13 lines)
Petr Skoda committed 1 file to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 21/Oct/07 04:59 AM
MFC: MDL-8605 fixed user image restore code
MODIFY backup/restorelib.php   Rev. 1.283.2.4    (+27 -26 lines)
Petr Skoda committed 1 file to 'Moodle CVS' on branch 'MOODLE_18_STABLE' - 21/Oct/07 05:04 AM
MFC: MDL-8605 fixed user image restore code
MODIFY backup/restorelib.php   Rev. 1.218.2.28    (+22 -21 lines)
Nicolas Connault committed 1 file to 'Moodle CVS' on branch 'MOODLE_19_STABLE' - 12/May/09 03:46 PM
MDL-8605 New script (web and CLI) for restoring user profile pictures that failed to move to the new folder during upgrade.
MODIFY admin/Attic/fixuserpix.php   Rev. 1.1.2.1    (+275 -0 lines)
Nicolas Connault committed 1 file to 'Moodle CVS' on branch 'MOODLE_18_STABLE' - 12/May/09 03:46 PM
MDL-8605 New script (web and CLI) for restoring user profile pictures that failed to move to the new folder during upgrade.
MODIFY admin/Attic/fixuserpix.php   Rev. 1.1.4.2    (+275 -0 lines)