When files are uploaded, we create a folder. Make the following improvements:
- folders are in a hierarchy matching the page hierarchy
- there is one folder per page
- if the page is renamed we keep using the same folder, so that there's just one folder per page. The folder name is remembered as an attribute of the page.
- folder names are limited to 30 characters, to allow for a fairly deep hierarchy
- folder names are always unique. The -1, -2 approach is used to avoid duplication.
- If the length of a folder name would be too close to the limit, just use the name of the page
- limit file names to 30 characters
For long names, truncation is done in the middle.
Note that existing files will be left where they are, to avoid breaking links.
A field is added to lesson_builder_pages. If auto.ddl is on everything will work automatically. folder varchar(250).