To bring better automation to multi-homed sites behind a load balancer - it would be beneficial if a plugin event could be triggered by:
JFolder::copy/create/delete/move
JFile::copy/delete/move/upload/write
With events attached to these actions, a plugin could be created to initiate a mirror operation to other servers. Another possible use might be to scan articles for recently written image files for automatic resize.
Good idea? Bad idea? Does something like this already exist?
I realize this is a feature request - I'd be happy to write it
Title |
|
Title |
|
Category | ⇒ | Plugins |
Labels |
Added:
?
|
As soon as I have this working and tested on my dev system, I'll submit a PR
That actually didn't take very long. Tomorrow (today...heck, it's 3AM) is my wife's birthday - so I doubt I'll be submitting it 'til Tuesday. I'm sure that my simple approach misses some critical consideration, so I look forward to hearing feedback once submitted.
Won't this make the filesystem code dependent on the database? Not sure that's a good idea.
I think adding plugin events to those classes adds to much overhead to them.
Imho a better approach would be to adjust the autoloader in a plugin so it loads your own JFile/JFolder classes instead of the core ones. But then, those two classes are of the few ones that don't get autoloaded correctly (often jimport()
is used instead). We should probably fix those so the autoloader is used instead. Either by replacing the jimport statements with
JLoader::register('JFile', JPATH_LIBRARIES . '/joomla/filesystem/file.php');
JLoader::register('JFolder', JPATH_LIBRARIES . '/joomla/filesystem/folder.php');
or by fixing the classes themself (if possible)
I'm not sure what purpose loading my own JFile/JFolder classes would serve if my goal is to have an event on all filesystem operations. I certainly can't rely on others to load my replacement classes.
The goal is to be able to perform actions whenever filesystem operations are performed by ANY part of Joomla. Someone uploads a file - a plugin can be written to virus scan it.
Anyway, I created the PR.
I'm not sure what purpose loading my own JFile/JFolder classes would serve if my goal is to have an event on all filesystem operations. I certainly can't rely on others to load my replacement classes.
If the class is autoloaded, then the extensions don't even have to know your class exists. You just register your own JFile/JFolder classes and they get used by every code that request these classes. That is what I meant.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-08-03 10:38:46 |
Closed_By | ⇒ | brianteeman |
Closed as the PR was closed
Surenly not a bad idea at all IMHO, plus if you can submit a PR