Command line interface
Kloudspeaker has command line interface script, which allows controlling Kloudspeaker from server scripts.
System and plugins can register commands that can be run, optionally as specified user.
For example:
php kloudspeaker/backend/cmd.php upload --user=2 --src=/tmp/downloads/000948.pdf --target=3:/documents
This command would execute command named upload
, and it would be run as user with id 2. The file would be uploaded into folder with ID 3 and subfolder "documents".
Performs file upload just as it would from UI. This will trigger same events and handlers as they would in UI, for example event logging, quota checking etc.
Requires attributes src
for local file to be uploaded and target
for Kloudspeaker location where file is uploaded
Performs file copy, differs from command upload
so that file is added in the background without triggering events or action handlers.
Requires attributes src
for local file to be uploaded and target
for Kloudspeaker location where file is uploaded
Plugins can register own commands like this:
class MyPlugin extends PluginBase {
public function setup() {
$this->env->commands()->register("my-plugin:some-command", $this);
}
}
In register call:
- First parameter is command name, use unique names that don't collide (prefix with plugin name etc)
- Second parameter is command handler
Possible command handler options are:
- Object reference. With this option, it is assumed that the object has function "execute" which will be called.
- Function name as string. With this option, global function with given name is executed.
In all cases, the execute is called with two parameters:
- Command name (string)
- Invocation options (array of name/value pairs from the command line)
- Home
- Installation
- Migration from Mollify
- Configuration
- Client configuration options
- Backend configuration options
- Languages
- Uploader
- Troubleshooting
- Plugins
- Quota
- History
- File viewer editor
- Registration
- Comments
- Share
- Archiver
- Item details
- Notificator
- Event logging
- Lost password
- Item collection
- Trash bin
- WebDAV
- Permissions
- Security
- External interface
- Command line interface
- Customizations
- Resources
- Client resource map
- Development
- Client modules
- Plugin
- Creating UI
- Client API
- Development environment
- Change log