Форумы / Cotonti / Extensions / Folder storage mode conversion script.

Change to Folder storage mode after site has started.

Elgan
#1 06.04.2009 08:32
Folder storage mode:
(If enabled, will store the user files in subfolders /datas/users/USERID/... instead of prepending the USERID to the filename. Must be set at the FIRST setup of the site ONLY. As soon as a file is uploaded to any PFS, it's too late to change this. It is not recommended to change this setting for now.)

If you would like to turn this on. like i did. but your site has started , even ran LDU once and it would be too much too late to change to the folder method.

The following lil script takes every file in a specified dir and turns it from USERID-filename (prepending the USERID to the filename) to /USERID/filename.

The script runs no SQL but will provide SQL for you to run. The SQL will change all your fps_file name from ID-filename to filename. And set all page_urls from www.yourdomain.com/7-filename to www.yourdomain.com/7/filename



how to use?
Before any use make a backup! if you can, backup files! eek. Then you need to backup your database.
tables sed_page and sed_files are only effected by the script.

the script is here
http://www.cotonti.com/pastebin/29

save it as something.php and place it in your root.
navigate to the script and it shall run.
Enter the SQL.

then dont forget to delete the script!

eg
MAKE A BACKUP!
1 make a swap.php, paste in the code.
2 upload to root
3 navigate to www.domain.com/swap.php
4 SQL >
5 delete www.domain.com/swap.php
DemptD
#2 28.04.2009 06:05
Hmm it didnt work... On my server the script just goes all white and nothing happens...
Elgan
#3 28.04.2009 23:04
eeek. Did u backup? did anything actually happen ?

seems odd. How many files do you have? What version php is it?

if you wish we could chat on msn or something and we could play and make it work. It could be a number of things. pm me if so.
DemptD
#4 28.04.2009 23:28
Did a backup but the script didnt change anything :p

Around 1000 files, 167 members. PHP 5

PMd you :)