Skip to content

Load remoting classes from modules

We're writing a module for ISPConfig for which we also need to expose some remoting API methods. The remoting handlers currently only load remoting classes from interface/lib/classes/remote.d/*. One option would be to symlink my own file there, either automagically if the directory is writeable or with some instructions. But I think it would be even cooler if we would load additional remoting classes from modules. This allows third party module builders to add their own API functionalities, as long as they create a module.conf.php and some remoting classes in their own modules. This PR:

  1. introduces ISPConfigJSONHandler from which the json, soap and rest handlers now extend to reduce code duplication in the class loading logic in their constructors
  2. changes the searching for remoting classes to use glob() - on one hand because I think it is better readable, but also because we can now skip one 'layer' of iterating over each module directory to look for remoting classes
  3. finally, it loads additional remoting classes from modules if they follow the conventions (must exist in interface/web/<my custom module>/lib/classes/remote.d/<commandgroup>.inc.php, the class itself must be named remoting_<commandgroup> and extend the \remoting class)
Edited by Webslice

Merge request reports