2017 © Pedro PelĂĄez
 

typo3-cms-extension filefill

Find and fetch missing local files from different remotes

image

ichhabrecht/filefill

Find and fetch missing local files from different remotes

  • Saturday, June 23, 2018
  • by IchHabRecht
  • Repository
  • 5 Watchers
  • 13 Stars
  • 962 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 2 Open issues
  • 9 Versions
  • 244 % Grown

The README.md

TYPO3 Extension filefill

Latest Stable Version Build Status StyleCI, (*1)

Find and fetch missing local files from different remotes., (*2)

Ever tried to set up a new system as copy from an existing one? Wondered if all the files (in fileadmin) are really needed? Ever run into the problem that a local file was missing?, (*3)

Filefill fetches missing files from one or multiple remote servers to ensure you have all the files you need for the new system., (*4)

Once the configuration is set up, fetching can be triggered by loading a page with missing files in the frontend., (*5)

The extension requires the usage of FAL api to fetch missing files. Files are stored directly in the (local) storage folder (e.g. fileadmin). You can re-run filefill at any time by deleting the local files in the storage folder., (*6)

Installation

Simply install the extension with Composer or the Extension Manager., (*7)

composer require ichhabrecht/filefill, (*8)

Usage

You need to configure resources for one or more existing file storages., (*9)

Prerequisite: Only storages with a "Local filesystem" driver are currently supported., (*10)

Resources for file storages can be configured using one of the two following options where the database record configuration is preferred if set. If not set, the TYPO3_CONF_VARS configuration is used., (*11)

Database record configuration

  • go to the root of your TYPO3 page tree (id=0)
  • change to the list module (Web -> List on the left side)
  • find the "File Storage" section and edit a record
  • change to the tab "File Fill" and select the enable checkbox
  • define the resource chain that should be used to fetch missing files

TYPO3_CONF_VARS configuration

  • given a file storage with uid 1, the configuration might look like this
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['filefill']['storages'][1] = [
    [
        'identifier' => 'domain',
        'configuration' => 'https://example.com',
    ],
    [
        'identifier' => 'domain',
        'configuration' => 'https://another-example.com',
    ],
    [
        'identifier' => 'sys_domain',
    ],
    [
        'identifier' => 'placeholder',
    ],
    [
        'identifier' => 'imagebuilder',
        'configuration' => [
            'backgroundColor' => '#FFFFFF',
            'textColor' => '#000000',
        ],
    ],
    [
        'identifier' => 'static',
        'configuration' => [
            'path/to/example/file.txt' => 'Hello world!',
            'another' => [
                'path' => [
                    'to' => [
                        'anotherFile.txt' => 'Lorem ipsum',
                        '*.youtube' => 'yiJjpKzCVE4',
                    ],
                    '*' => 'This file was found in /another/path folder.',
                ],
            ],
            '*.vimeo' => '143018597',
            '*' => 'This is some static text for all other files.',
        ],
    ],
];
  • you don't need to configure resources that you don't want to use
  • the ordering in your configuration defines the ordering of processing

Resources

Resources define the places (url / services) where filefill tries to fetch missing files from. You can use multiple resources to build some kind of fallback chain., (*12)

Single domain

Fetch missing files from a fixed url., (*13)

Configuration:, (*14)

  • Url: Enter a valid url (incl http/https scheme)

You can use multiple single domains within one resources configuration., (*15)

Domain records

Fetch missing files from all available site configurations. Filefill runs through all base and variant urls as long as the file can be fetched or all domains are processed., (*16)

Configuration:, (*17)

  • no configuration required (the checkbox is just a field placeholder)

There is no need for multiple usage. All domains are used by default., (*18)

Placeholder.com

Fetch a missing image from the placeholder.com service. This fetches an image with the correct resolution of the original file., (*19)

Configuration:, (*20)

  • no configuration required (the checkbox is just a field placeholder)

There is no need for multiple usage. This resource can be the last one in the chain but can handle image files only., (*21)

Image builder

Create an empty image with the correct resolution of the original file. The height and width is added as a text layer., (*22)

Configuration:, (*23)

  • Background color: Enter a valid hex code as background color
  • Text color: Enter a valid hex code as text color

Static file

Ensure missing files will be available. By default, an empty file will be created., (*24)

Configuration:, (*25)

  • You can configure the content of a file by its path or extension

Please use TypoScript syntax for record configuration., (*26)

path/to/example/file.txt = Hello world!
another {
    path {
        to {
            anotherFile\.txt = Lorem ipsum
            *\.youtube => yiJjpKzCVE4
        }
        * = This file was found in /another/path folder.
    }
}
*\.vimeo = 143018597
* = This is some static text for all other files.

Additional resources

You can add own resource handlers to fetch files from additional services., (*27)

Registration

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['filefill']['resourceHandler']['identifierName'] = [
    'title' => 'Name of the resource',
    'handler' => \Vendor\Extension\Resource\ResourceHandler::class,
    'config' => [
        'label' => 'Name of the resource',
        'config' => [
            'type' => 'check',
            'default' => 1,
        ],
    ],
];
  • title: name of the resource that is taken as backend (flex) button label
  • handler: name of the class that handels the actual implementation
  • config: TCA configuration for the backend (flex) field

Handler

namespace Vendor\Extension\Resource;
class ResourceHandler implements \IchHabRecht\Filefill\Resource\RemoteResourceInterface
{
    public function hasFile($fileIdentifier, $filePath, FileInterface $fileObject = null)
    {
        return true;
    }

    public function getFile($fileIdentifier, $filePath, FileInterface $fileObject = null)
    {
        return 'file content';
    }
}

The handler needs to implement the interface \IchHabRecht\Filefill\Resource\RemoteResourceInterface and therefore has to add both functions hasFile and getFile., (*28)

Debugging

You can enable additional log information by configuring a filefill logger., (*29)

$GLOBALS['TYPO3_CONF_VARS']['LOG']['IchHabRecht']['Filefill'] = [
    'writerConfiguration' => [
        \TYPO3\CMS\Core\Log\LogLevel::DEBUG => [
            \TYPO3\CMS\Core\Log\Writer\FileWriter::class => [
                'logFileInfix' => 'filefill',
            ],
        ],
    ],
];

Known issues

1509741907 TYPO3Fluid\Fluid\Core\ViewHelper\Exception

Folder "[...]" does not exist., (*30)

Filefill tries to fetch the existing file from any resource. However, due to the FAL api the exception cannot be prevented nor handled by filefill. Try to reload the page again, the exception (for this specific file) should not occur anymore. Please note that there might be a new exception for a new file. In this case you need to reload your page until all files were properly created on your current system., (*31)

Community

The Versions

23/06 2018

dev-pre-merge

dev-pre-merge https://github.com/IchHabRecht/filefill

Find and fetch missing local files from different remotes

  Sources   Download

GPL-2.0-or-later

The Requires

 

file extension typo3 placeholder missing

23/06 2018

dev-update-skeleton

dev-update-skeleton https://github.com/IchHabRecht/filefill

Find and fetch missing local files from different remotes

  Sources   Download

GPL-2.0-or-later

The Requires

 

file extension typo3 placeholder missing

22/06 2018

dev-master

9999999-dev https://github.com/IchHabRecht/filefill

Find and fetch missing local files from different remotes

  Sources   Download

GPL-2.0-or-later

The Requires

 

file extension typo3 placeholder missing

22/06 2018

1.3.1

1.3.1.0 https://github.com/IchHabRecht/filefill

Find and fetch missing local files from different remotes

  Sources   Download

GPL-2.0-or-later

The Requires

 

file extension typo3 placeholder missing

19/06 2018

1.3.0

1.3.0.0 https://github.com/IchHabRecht/filefill

Find and fetch missing local files from different remotes

  Sources   Download

GPL-2.0-or-later

The Requires

 

file extension typo3 placeholder missing

07/06 2018

1.2.1

1.2.1.0 https://github.com/IchHabRecht/filefill

Find and fetch missing local files from different remotes

  Sources   Download

GPL-2.0-or-later

The Requires

 

file extension typo3 placeholder missing

15/03 2018

1.2.0

1.2.0.0 https://github.com/IchHabRecht/filefill

Find and fetch missing local files from different remotes

  Sources   Download

GPL-2.0-or-later

The Requires

 

file extension typo3 placeholder missing

12/03 2018

1.1.0

1.1.0.0 https://github.com/IchHabRecht/filefill

Find and fetch missing local files from different remotes

  Sources   Download

GPL-2.0-or-later

The Requires

 

file extension typo3 placeholder missing

10/03 2018

1.0.0

1.0.0.0 https://github.com/IchHabRecht/filefill

Find and fetch missing local files from different remotes

  Sources   Download

GPL-2.0-or-later

The Requires

 

file extension typo3 placeholder missing