Skip to main content

GravityKit\GravityMigrate\Media\FileCollector

Works out which files on disk the forms and entries in an export point at, and how many of

them fit inside the bundle.

The two sources are scoped differently. Entry uploads live in entry meta and belong to a submission, so they are bounded by whatever bounded the entries -- the selected forms and the date range. Image Choice images live in the form's own field definitions, so a form with no entries at all still carries them and no entry filter applies.

Since: %ver%

Source: src/Media/FileCollector.php:24

Details

  • Kind: class
  • Namespace: GravityKit\GravityMigrate\Media

Methods

MethodDescription
__construct()
collect()The files an export should carry, and what did not fit.
budget()The total bytes of files a bundle may carry.

Method Reference

__construct()

public function __construct( ?Util $util=null )

Parameters

NameTypeDefaultDescription
$utilUtil | nullnullUtility instance. Defaults to the shared one.

Since: %ver%

Source: src/Media/FileCollector.php:64

collect()

public function collect( array $form_ids, array $export_data, string $entry_meta_where='', ?int $budget_bytes=null ): array

The files an export should carry, and what did not fit.

Parameters

NameTypeDefaultDescription
$form_idsint[]Forms being exported.
$export_dataarrayData types the export was asked for.
$entry_meta_wherestring''The export's own WHERE clause for the entry meta table, so the files collected are exactly the files the exported entries reference. Must arrive already escaped.
$budget_bytesint | nullnullMaximum total bytes. Defaults to \self::budget().

Returns

  • array{included:string,excluded:string,included_size:int,excluded_size:int,total:int}

Since: %ver%

Source: src/Media/FileCollector.php:82

budget()

public static function budget(): int

The total bytes of files a bundle may carry.

Returns

  • int — Bytes.

Since: %ver%

Source: src/Media/FileCollector.php:132