-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Jetpack integration loader, add the way to load config in local d…
…ev env (#6101) * Add Jetpack integration loader, add the way to load config in local dev env * refactor: unify loading logic and use filters to modify file path or config data --------- Co-authored-by: Volodymyr Kolesnykov <[email protected]>
- Loading branch information
1 parent
62bd96d
commit b34c55f
Showing
3 changed files
with
68 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
/** | ||
* Integration: Jetpack. | ||
*/ | ||
namespace Automattic\VIP\Integrations; | ||
|
||
class JetpackIntegration extends Integration { | ||
protected string $version = ''; | ||
|
||
public function is_loaded(): bool { | ||
return class_exists( 'Jetpack' ); | ||
} | ||
|
||
public function configure(): void { | ||
if ( isset( $this->get_env_config()['version'] ) ) { | ||
$this->version = $this->get_env_config()['version']; | ||
} elseif ( defined( 'VIP_JETPACK_PINNED_VERSION' ) ) { | ||
$this->version = constant( 'VIP_JETPACK_PINNED_VERSION' ); | ||
} else { | ||
$this->version = vip_default_jetpack_version(); | ||
} | ||
} | ||
|
||
public function load(): void { | ||
if ( $this->is_loaded() ) { | ||
return; | ||
} | ||
|
||
// Pass through to the old code for now which will respect all existing constants | ||
if ( ! defined( 'WP_INSTALLING' ) ) { | ||
vip_jetpack_load(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters