Skip to main content

GravityKit\GravityMigrate\Uploader

The REST endpoints the upload widget posts an export bundle to, and deletes it through.

Since: 1.0.0

Source: src/Uploader.php:19

Details​

  • Kind: class
  • Namespace: GravityKit\GravityMigrate

Methods​

MethodDescription
__construct()Constructor.
get_instance()Returns class instance.
register_uploader_routes()Registers REST API routes for file uploader setting.
process_upload()Stores an uploaded bundle in the imports directory and stages it for import.
process_delete()Deletes all temporarily created tables for migration.
ajax_routes()Removes the uploaded file settings

Method Reference​

__construct()​

public function __construct()

Constructor.

Since: 1.0.0

Source: src/Uploader.php:43

get_instance()​

public static function get_instance(): Uploader

Returns class instance.

Returns​

  • Uploader

Since: 1.0.0

Source: src/Uploader.php:56

register_uploader_routes()​

public function register_uploader_routes()

Registers REST API routes for file uploader setting.

Returns​

  • void

Since: 1.0.0

Source: src/Uploader.php:71

process_upload()​

public function process_upload()

Stores an uploaded bundle in the imports directory and stages it for import.

Returns​

  • array | \WP_Error — REST response body: [ 'file' => <path> ] on success, or a WP_Error on a failed upload. Returned, never echoed -- emitting output here fires before the REST server sends its headers.

Since: 1.0.0

Source: src/Uploader.php:109

process_delete()​

public function process_delete()

Deletes all temporarily created tables for migration.

Deletes the imported dump directory.

Returns​

  • array | \WP_Error — REST response body on success, or the WP_Error from {@see self::clear_imports()} when a background import owns the data this would delete.

Since: 1.0.0

Source: src/Uploader.php:336

ajax_routes()​

public function ajax_routes( $routes )

Removes the uploaded file settings

Parameters​

NameTypeDefaultDescription
$routesarrayFoundation routes for the Settings class.

Returns​

  • array

Since: 1.1.0

Source: src/Uploader.php:389