Skip to content

Commit

Permalink
Cleanup and bump version for release
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterBooker committed May 19, 2024
1 parent ad26b85 commit 5a60de7
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "Monitor your WordPress install with Prometheus.",
"type": "wordpress-plugin",
"license": "GPL-3.0-or-later",
"version": "0.3.0",
"version": "0.4.0",
"minimum-stability": "dev",
"prefer-stable": true,
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion inc/admin-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace PromPress;

if ( ! defined( 'ABSPATH' ) ) {
if ( ! \defined( 'ABSPATH' ) ) {
die();
}

Expand Down
4 changes: 2 additions & 2 deletions local/db.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
* Enable Saving of DB Queries.
*/

if ( ! defined( 'SAVEQUERIES' ) ) {
define( 'SAVEQUERIES', true );
if ( ! \defined( 'SAVEQUERIES' ) ) {
\define( 'SAVEQUERIES', true );
}
24 changes: 20 additions & 4 deletions prompress.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: PromPress
* Plugin URI: https://github.com/PeterBooker/prompress
* Description: Monitor your WordPress website with Prometheus.
* Version: 0.3.0
* Version: 0.4.0
* Author: Peter Booker
* Author URI: https://peterbooker.com
* Text Domain: prompress
Expand All @@ -26,11 +26,11 @@
exit();
}

\define( 'PROMPRESS_VERSION', '0.3.0' );
\define( 'PROMPRESS_VERSION', '0.4.0' );
\define( 'PROMPRESS_DIR', \plugin_dir_path( __FILE__ ) );
\define( 'PROMPRESS_URL', \plugin_dir_url( __FILE__ ) );
\define( 'PROMPRESS_MIN_PHP_VERSION', '8.1' );
\define( 'PROMPRESS_MIN_WP_VERSION', '6.1' );
\define( 'PROMPRESS_MIN_WP_VERSION', '6.4' );

/**
* Check for required PHP version.
Expand All @@ -56,6 +56,18 @@ function wp_version_check() {
return true;
}

/**
* Check for Redis extension.
*
* @return bool
*/
function redis_extension_check() {
if ( ! \extension_loaded( 'redis' ) ) {
return false;
}
return true;
}

/**
* Admin notices if requirements aren't met.
*/
Expand All @@ -80,6 +92,10 @@ function requirements_error_notice() {
);
}

if ( ! redis_extension_check() ) {
$notices[] = \esc_html__( 'PromPress plugin requires the Redis (PECL) PHP extension.', 'prompress' );
}

foreach ( $notices as $notice ) {
echo '<div class="notice notice-error"><p>' . \esc_html( $notice ) . '</p></div>';
}
Expand All @@ -88,7 +104,7 @@ function requirements_error_notice() {
/**
* If either check fails, display notice and bail.
*/
if ( ! php_version_check() || ! wp_version_check() ) {
if ( ! php_version_check() || ! wp_version_check() || ! redis_extension_check() ) {
\add_action( 'admin_notices', __NAMESPACE__ . '\\requirements_error_notice' );
return;
}
Expand Down

0 comments on commit 5a60de7

Please sign in to comment.