?
avatar stutteringp0et
stutteringp0et
21 May 2016

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

avatar stutteringp0et stutteringp0et - open - 21 May 2016
avatar stutteringp0et stutteringp0et - change - 21 May 2016
The description was changed
avatar stutteringp0et stutteringp0et - change - 21 May 2016
Title
new system plugin events related to JFile and JFolder
new plugin events related to JFile and JFolder
avatar stutteringp0et stutteringp0et - change - 21 May 2016
Title
new system plugin events related to JFile and JFolder
new plugin events related to JFile and JFolder
avatar brianteeman brianteeman - change - 21 May 2016
Category Plugins
avatar brianteeman brianteeman - change - 23 May 2016
Labels Added: ?
avatar alikon
alikon - comment - 28 May 2016

Surenly not a bad idea at all IMHO, plus if you can submit a PR

avatar stutteringp0et
stutteringp0et - comment - 30 May 2016

As soon as I have this working and tested on my dev system, I'll submit a PR

avatar stutteringp0et
stutteringp0et - comment - 30 May 2016

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.

avatar chrisdavenport
chrisdavenport - comment - 30 May 2016

Won't this make the filesystem code dependent on the database? Not sure that's a good idea.

avatar Bakual
Bakual - comment - 30 May 2016

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)

avatar stutteringp0et
stutteringp0et - comment - 30 May 2016

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.

avatar Bakual
Bakual - comment - 30 May 2016

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.

avatar brianteeman brianteeman - change - 3 Aug 2016
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-08-03 10:38:46
Closed_By brianteeman
avatar brianteeman brianteeman - close - 3 Aug 2016
avatar brianteeman
brianteeman - comment - 3 Aug 2016

Closed as the PR was closed


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/10568.

Add a Comment

Login with GitHub to post a comment