additional output on failure to find/create cache directory

This commit is contained in:
Brian 2023-07-28 11:42:22 -06:00
parent 5dcffefefd
commit f9125ca8cf
Signed by: brian
GPG Key ID: DE1A5390A3B84CD8

View File

@ -20,6 +20,7 @@ class App {
/**
* Any logic that needs executed when the plugin is activated.
*
* @package PluginNamespace\App
* @since 1.0.0
*
* @return void
@ -37,18 +38,21 @@ class App {
/**
* Any logic that needs executed when the plugin is deactivated.
*
* @package PluginNamespace\App
* @since 1.0.0
*
* @return void
*/
public static function plugin_deactivation(): void {
//
// phpcs:disable
// phpcs:enable
}
/**
* Check that the cache directory for Blade exists and
* if not then attempt to create it.
*
* @package PluginNamespace\App
* @since 1.0.0
*
* @throws \Exception
@ -59,13 +63,13 @@ class App {
if ( ! file_exists( NMSP_PLUGIN_BASE_DIR . '/cache/blade/.gitignore' ) ) {
try {
mkdir( NMSP_PLUGIN_BASE_DIR . '/cache/blade', 0755, true );
} catch ( Exception $e ) {
} catch ( Exception $exp ) {
$error_payload = array(
'level' => 'critical',
'message' => $e->getMessage(),
'message' => $exp->getMessage(),
'context' => array(
'file' => $e->getFile(),
'line' => $e->getLine(),
'file' => $exp->getFile(),
'line' => $exp->getLine(),
),
);
error_log( json_encode( $error_payload, JSON_PRETTY_PRINT ) );
@ -77,12 +81,13 @@ class App {
* Return an instance of this plugin class. If it has
* not been initialized, do so then return it.
*
* @package PluginNamespace\App
* @since 1.0.0
*
* @return \PluginNamespace\App
*/
public static function get_instance(): App {
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof App ) ) {
if ( ! ( self::$instance instanceof App ) ) {
self::$instance = new App();
self::$instance->load_plugin_textdomain();
@ -96,6 +101,7 @@ class App {
/**
* Load your translation files for this plugin.
*
* @package PluginNamespace\App
* @since 1.0.0
*
* @return void
@ -107,14 +113,17 @@ class App {
/**
* Steps to take when initializing this plugin??
*
* @package PluginNamespace\App
* @since 1.0.0
*
* @return void
*/
public function scaffold_plugin(): void {
// phpcs:disable
if ( is_admin() ) {
// admin only logic here
// admin only logic here, remove phpcs calls around this
}
// phpcs:enable
// other logic here
}
@ -126,6 +135,7 @@ class App {
*
* @codeCoverageIgnore
*
* @package PluginNamespace\App
* @since 1.0.0
*
* @return void
@ -148,6 +158,7 @@ class App {
/**
* Load BladeOne as the templating engine for the plugin.
*
* @package PluginNamespace\App
* @since 1.0.0
*
* @param \eftec\bladeone\BladeOne $blade