custom-d/zon-storage

A storage api plugin for zon projects

1.0.2 2022-02-28 20:02 UTC

This package is not auto-updated.

Last update: 2024-11-14 15:58:01 UTC


README

Installation:

  1. 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

  1. Run site/_composer/bin/zon-storage-setup or fin exec site/_composer/bin/zon-storage-setup and follow the prompts

  2. confirm you now have migrations, models etc setup configure and run the migration

  3. 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;
}

  1. 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.)