custom-d / zon-storage
A storage api plugin for zon projects
Requires
- php: >=7.1
- league/flysystem: ^1.0
- league/flysystem-aws-s3-v3: ^1.0
This package is not auto-updated.
Last update: 2024-11-14 15:58:01 UTC
README
Installation:
- In your zon projects composer.json add to the bottom:
"repositories": [
{
"type": "vcs",
"url": "git@git.customd.com:composer/zon-storage.git"
}
]
then run composer require custom-d/zon-storage
Run
site/_composer/bin/zon-storage-setup
orfin exec site/_composer/bin/zon-storage-setup
and follow the promptsconfirm you now have migrations, models etc setup configure and run the migration
In your
site/application/libraries
folder a new file:DF_Files.php
with the following content should exist
<?php
require_once(dirname(__DIR__) . '/zon/libraries/DF_Files.php');
use CustomD\ZonStorage\StorageTrait;
class My_DF_Files extends DF_Files
{
use StorageTrait;
}
- If needed copy the files from zon/controllers to your own controllers dir. add at the top of the class:
use CustomD\ZonStorage\hasStorageTrait;
class Files
{
use hasStorageTrait;
and look for any references to upload / upload_files methods and the variable set for $display_url
and update to use a bucket name:
eg:
$display_url = (empty($this->input->post('display_url')) ? 'files/display' : $this->input->post('display_url'));
Becomes
$display_url = (empty($this->input->post('bucket')) ? 'local' : $this->input->post('bucket'));
The last step will involve looking where you use the df_files upload methods and altering the first part to being a bucket name. (alternatively you could set a file config for files/display
in your storage config file.)