Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As outlined in issue 50:
Moodle file names should not be more than 255 characters, but the filter_imageopt table only allows 255 for the urlpath (filename+other elements). This means that any file name over ~230 characters (substantially less if it contains characters that require urlencoding) prevents the page from rendering.
In order to allow for this situation I have changed the fieldtype to text, this meant I had to drop the unique index on url path as this is not supported on this column type.
To accommodate dropping the index:
I made the add_url_path_to_queue function ignore multiple records as in theory on high traffic sites that could be the case. Multiple rows will not cause an issue though as they will still get mopped up in the normal way by the delete_queue_item_by_path function.
The filter_imageopt table never gets cleared out so large sites can end up with a significant number of entries that were created for images that never ended up being loaded. This would not have been an issue with the unique index in place but without it there is a potential storage issue (the client I'm working with has 14k rows in this table). To mitigate this I now remove all entries over 12 months old.