SiteDrive Drive API
The SiteDrive Drive API offers a way to interact with drives inside SiteDrive.
sitedrive_drives
Get all available drives. This will not return the folders or files.
Returns
Array
of Drives
sitedrive_drive
This is the basic read by ID function.
Arguments
$id |
The ID of the Drive from the SiteDrive table |
Returns
Associative Array
of the drive. Throws an error if trying to grab a drive that does not exist.
sitedrive_drive_by_name_or_id
Given an associative array of an argument of id
or name
will return a drive.
Arguments
$params |
Either pass an id or name in the array to grab the desired Drive. Connecting to an external Drive will refer the drive by name . |
Returns
Associative Array
of the drive. Throws an error if trying to grab a drive that does not exist.
sitedrive_drive_create
Create a drive based on the data provided.
Arguments
$driveInsert |
A Drive array. Has values name , url , external , published , and settings . Some of these are only used depending on if the drive is external and some of these only matter if the drive is local. |
Returns
Associative Array
of the created drive. It will throw an error it failed to insert a database row.
sitedrive_drive_update
Update a drive based on ID.
Arguments
$id |
ID of the Drive to change |
$fields |
A Drive array. Can change everything, but the ID |
sitedrive_drive_delete
Delete a drive by ID. This will also delete all folder and file entries within the drive.
Arguments
$id |
ID of the Drive to delete |
sitedrive_drive_settings_fields
This function will return all available settings fields that could go into the drive settings field. This is a JSON stored database field and can be extended through the filter sitedrive_drive_settings_field
.
Returns
Associative Array
of all settings fields.
sitedrive_drive_importable
Allows a drive to be imported. It currently only checks if it's an external drive, but was created for use in the future of a possible Dropbox of Google Drive integration.
Returns
bool
if the drive is importable.