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
| Method | Description |
|---|---|
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
| Name | Type | Default | Description |
|---|---|---|---|
$path | string | The path as the caller gave it. | |
$util | Util | null | null | Resolves the folders; passed in so a test can point them elsewhere. |
Returns
string| WP_Error
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
| Name | Type | Default | Description |
|---|---|---|---|
$real_path | string | A path realpath() returned. | |
$real_folder | string | A folder realpath() returned. | |
$is_windows | bool | null | null | Whether the paths are Windows paths; this server's when null. |
Returns
bool
Since: 2.1.1
Source: src/Migration/BundlePath.php:100