Skip to main content

GravityKit\GravityMigrate\Migration\BundlePath

Limits a bundle path to the folders GravityMigrate writes bundles into.

Without it, bundle-import copies any readable file, wp-config.php included, into the uploads tree. Bundles this site exported are in the exports folder; one from another site goes in the imports folder.

Since: 2.1.1

Source: src/Migration/BundlePath.php:22

Details​

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

Methods​

MethodDescription
resolve()The real path of a bundle inside the exports or imports folder, or the refusal.
is_inside()Whether a real path sits inside a real folder.

Method Reference​

resolve()​

public static function resolve( string $path, ?Util $util=null )

The real path of a bundle inside the exports or imports folder, or the refusal.

Parameters​

NameTypeDefaultDescription
$pathstringThe path as the caller gave it.
$utilUtil | nullnullResolves the folders; passed in so a test can point them elsewhere.

Returns​

Since: 2.1.1

Source: src/Migration/BundlePath.php:41

is_inside()​

public static function is_inside( string $real_path, string $real_folder, ?bool $is_windows=null ): bool

Whether a real path sits inside a real folder.

The trailing slash keeps a sibling folder whose name starts with the allowed one from matching. Separators are normalized only on Windows, where realpath() returns backslashes and trailingslashit() appends "/"; elsewhere a backslash can be part of a folder name.

Parameters​

NameTypeDefaultDescription
$real_pathstringA path realpath() returned.
$real_folderstringA folder realpath() returned.
$is_windowsbool | nullnullWhether the paths are Windows paths; this server's when null.

Returns​

  • bool

Since: 2.1.1

Source: src/Migration/BundlePath.php:100