-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for wp-cli commands via /bin folder
- Loading branch information
1 parent
6b45daf
commit 17db241
Showing
3 changed files
with
64 additions
and
35 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +0,0 @@ | ||
<?php | ||
|
||
namespace Zeek\WP_Util; | ||
|
||
use Zeek\WP_Util\ErrorHandling; | ||
use function A7\autoload; | ||
use function Zeek\WP_Util\get_env_value; | ||
|
||
function bootstrap( $dir ) { | ||
/** | ||
* Load .env file and set up constants | ||
*/ | ||
Constants::init( $dir ); | ||
|
||
/** | ||
* Add Sentry Error Logging | ||
*/ | ||
ErrorHandling::init(); | ||
|
||
/** | ||
* Enable WP Util Behaviors | ||
*/ | ||
new Behaviors(); | ||
|
||
/** | ||
* Kick off third party integrations as dictated by our .env variables | ||
*/ | ||
new ThirdParty\Init(); | ||
|
||
/** | ||
* Autoload all php files in /src/ | ||
* // @todo ensure this path exists | ||
*/ | ||
autoload( $dir . '/src' ); | ||
} | ||
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,40 @@ | ||
<?php | ||
|
||
namespace Zeek\WP_Util; | ||
|
||
use Zeek\WP_Util\ErrorHandling; | ||
use function A7\autoload; | ||
use function Zeek\WP_Util\get_env_value; | ||
use Zeek\WP_Util\ThirdParty\Init; | ||
|
||
function bootstrap( $dir ) { | ||
/** | ||
* Load .env file and set up constants | ||
*/ | ||
Constants::init( $dir ); | ||
|
||
/** | ||
* Add Sentry Error Logging | ||
*/ | ||
ErrorHandling::init(); | ||
|
||
/** | ||
* Enable WP Util Behaviors | ||
*/ | ||
new Behaviors(); | ||
|
||
/** | ||
* Kick off third party integrations as dictated by our .env variables | ||
*/ | ||
new ThirdParty\Init(); | ||
|
||
/** | ||
* Autoload all php files in /src/ | ||
*/ | ||
autoload( $dir . '/src' ); | ||
|
||
/** | ||
* Load /bin folder for any wp cli commands safely | ||
*/ | ||
bootstrap_wp_cli_commands( $dir ); | ||
} |
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,24 @@ | ||
<?php | ||
|
||
namespace Zeek\WP_Util; | ||
|
||
use function A7\autoload; | ||
|
||
function bootstrap_wp_cli_commands( $dir ) { | ||
|
||
// Check to see if we're currently running WP CLI | ||
if ( ! defined( 'WP_CLI' ) ) { | ||
return; | ||
} | ||
|
||
if ( true !== WP_CLI ) { | ||
return; | ||
} | ||
|
||
if ( ! class_exists( 'WP_CLI' ) ) { | ||
return; | ||
} | ||
|
||
// Looks like we're running wp-cli, so we can safely load the /bin folder | ||
autoload( $dir . '/bin' ); | ||
} |