| 1 | <?php |
||
| 2 | |||
| 3 | namespace LeKoala\FilePond; |
||
| 4 | |||
| 5 | use SilverStripe\Assets\File; |
||
| 6 | use SilverStripe\ORM\DataList; |
||
| 7 | use SilverStripe\ORM\DataObject; |
||
| 8 | use SilverStripe\AssetAdmin\Controller\AssetAdmin; |
||
|
0 ignored issues
–
show
|
|||
| 9 | use SilverStripe\Core\Extension; |
||
| 10 | |||
| 11 | /** |
||
| 12 | * @property File $owner |
||
| 13 | */ |
||
| 14 | class FilePondFileExtension extends Extension |
||
| 15 | { |
||
| 16 | /** |
||
| 17 | * @var array<string,string> |
||
| 18 | */ |
||
| 19 | private static $db = [ |
||
|
0 ignored issues
–
show
|
|||
| 20 | // This helps tracking state of files uploaded through ajax uploaders |
||
| 21 | "IsTemporary" => "Boolean", |
||
| 22 | ]; |
||
| 23 | /** |
||
| 24 | * @var array<string,string> |
||
| 25 | */ |
||
| 26 | private static $has_one = [ |
||
|
0 ignored issues
–
show
|
|||
| 27 | // Record is already used by versioned extensions |
||
| 28 | // ChangeSetItem already uses Object convention so we use the same |
||
| 29 | "Object" => DataObject::class, |
||
| 30 | ]; |
||
| 31 | |||
| 32 | /** |
||
| 33 | * Get a list of files uploaded the given DataObject |
||
| 34 | * It doesn't mean that the files are currently or still associated!! |
||
| 35 | * |
||
| 36 | * @param DataObject $record |
||
| 37 | * @return DataList|File[] |
||
| 38 | */ |
||
| 39 | public static function getObjectFiles(DataObject $record) |
||
| 40 | { |
||
| 41 | return File::get()->filter([ |
||
| 42 | 'ObjectID' => $record->ID, |
||
| 43 | 'ObjectClass' => get_class($record), |
||
| 44 | ])->exclude('IsTemporary', 1); |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * Called by Upload::loadIntoFile |
||
| 49 | * @return void |
||
| 50 | */ |
||
| 51 | public function onAfterUpload() |
||
| 52 | { |
||
| 53 | if (FilePondField::config()->enable_auto_thumbnails) { |
||
| 54 | $thumbs = AssetAdmin::create()->generateThumbnails($this->owner); |
||
|
0 ignored issues
–
show
|
|||
| 55 | } |
||
| 56 | } |
||
| 57 | } |
||
| 58 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths