I probably wouldn’t add this to Media Cloud, mostly because I only add features my clients request or need for a given build.
However, you could add this to your plugin, fairly easily I think. Off the top of my head you’d have to:
- Detect if media cloud plugin was activated via
is_plugin_active('ilab-media-tools')
- The
\ILAB\MediaCloud\Tools\ToolsManager::instance()
is the entry point into the plugin itself. You won’t have to include/require any files as it should autoload.
- Determine if cloud storage is enabled and activated by doing something like
\ILAB\MediaCloud\Tools\ToolsManager::instance()->toolEnabled('storage')
- If it’s enabled, you can get the storage interface via
\ILAB\MediaCloud\Tools\ToolsManager::instance()->tools['storage']
- Once you have the storage interface, you can copy a file to a new one and delete the old one. Refer to
classes/Cloud/Storage/StorageInterface.php
for the method signatures, but it’d only be two calls.
- The data for storage is held in an array in an attachment’s meta (you can fetch with
wp_get_attachment_metadata($id)
called s3
. Use and update the values in that.
I think that’s all you’d have to do to get it working.
In theory ??
-
This reply was modified 6 years, 1 month ago by
interfacelab.
-
This reply was modified 6 years, 1 month ago by
interfacelab.