\FTFileMakerTask
Creates sample folder and file structure, useful to test performance, UI behaviour on deeply nested structures etc.
Downloads around 20MB of data from a public web location on first run,
in order to create reasonable fixture data (and keep it out of the module repo).
The related AWS S3 bucket is managed by SilverStripe Ltd.
Protip: In case you want to test thumbnail generation, you can
recursively delete any generated ones through the following bash command in `assets/`:
`find . -name '*Resampled*' -print0 | xargs -0 rm`
Parameters:
- reset=1: Optionally truncate ALL files and folders in the database, plus delete
the entire `assets/` directory.
Configuration
app/_config/frameworktest.yml
The following yml config make 1040 files / 520mb:
To make 100K records, increase the base folderCountByDepth from 1 to 100 and run the task overnight
```
FTFileMakerTask:
documentsOnly: true
doSetFolderPermissions: true
doSetOldCreationDate: false
doRandomlyPublish: false
depth: 3
folderCountByDepth:
- 1
- 9
- 7
- 0
- 0
fileCountByDepth:
- 50
- 25
- 20
- 0
- 0
Flush and run:
/dev/tasks/FTFileMakerTask?flush&reset=1
Synopsis
- // members
- private static bool $documentsOnly = false;
- private static bool $doSetFolderPermissions = true;
- private static bool $doPutProtectedFilesInPublicStore = false;
- private static bool $doSetOldCreationDate = true;
- private static bool $doRandomlyPublish = true;
- private static integer $depth = 2;
- private static bool $uniqueImages = true;
- private static array $folderCountByDepth = ;
- private static array $fileCountByDepth = ;
- protected string $fixtureFileBaseUrl = "https://s3-ap-southeast-2.amazonaws.com/silverstripe-frameworktest-assets/";
- protected string $defaultImageFileName = 'image-huge-tall.jpg';
- protected array $fixtureFileNames = ;
- protected array $fixtureFileTypes = ;
- protected string $lineBreak = "\n<br>";
- protected Member $anonymousMember = NULL;
- protected array $fileCounts = ;
- protected array $folderCounts = ;
- // methods
- public void run()
- protected void reset()
- protected void downloadFixtureFiles()
- protected void generateThumbnails()
- protected void generateFiles()
- protected void putProtectedFilesInPublicAssetStore()
- protected null watermarkImage()
Hierarchy
Extends
- SilverStripe\Dev\BuildTask
Tasks
Line | Task |
---|---|
66+ | Automatically retrieve file listing from S3 |
66+ | Handle HTTP errors from S3 |
Members
private
- $depth
—
int
How deep should or folder hierachy be. - $doPutProtectedFilesInPublicStore
—
bool
Put some files in wrong store to test logic meant to correct this kind of problem.. - $doRandomlyPublish
—
bool
Publish some files. - $doSetFolderPermissions
—
bool
Vary the permission on the folders - $doSetOldCreationDate
—
bool
Set the date of some files to an old date. - $documentsOnly
—
bool
If set to TRUE skip thumbnail generation - $fileCountByDepth
—
array
Number of files to create at various depths in the hierachy - $folderCountByDepth
—
array
Number of folders to create certain hierarchy. - $uniqueImages
—
bool
When true, watermark images for unique image binary per Image record
protected
- $anonymousMember — SilverStripe\Security\Member
- $defaultImageFileName
- $fileCounts
—
array
Allow override of the fileCountByDepth - $fixtureFileBaseUrl
- $fixtureFileNames
- $fixtureFileTypes
- $folderCounts
—
array
Allow override of the folderCountByDepth - $lineBreak
Methods
protected
- downloadFixtureFiles()
- generateFiles()
- generateThumbnails() — Creates thumbnails of sample images
- putProtectedFilesInPublicAssetStore()
- reset()
- watermarkImage()