Skip to content

Commit

Permalink
Fix issues 110 and 117 (#119)
Browse files Browse the repository at this point in the history
Add Yoast/PHPUnit-Polyfills
  • Loading branch information
rwngallego authored Dec 15, 2021
1 parent 43b5812 commit ff65467
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 32 deletions.
6 changes: 5 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://github.com/perfectyorg
Tags: Push Notifications, Web Push Notifications, Notifications, User engagement
Requires at least: 5.0
Tested up to: 5.8
Stable tag: 1.4.1
Stable tag: 1.4.2
Requires PHP: 7.2
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -95,6 +95,10 @@ You can create an issue in our Github repo:

== Changelog ==

= 1.4.2 =
* Set the default log level to ERROR. Related [#117](https://github.com/perfectyorg/perfecty-push-wp/issues/117)
* Move the cron job check warning to the logger. Related [#110](https://github.com/perfectyorg/perfecty-push-wp/issues/110)

= 1.4.1 =
* Improvements to the job management section and the job stats. Related [#104](https://github.com/perfectyorg/perfecty-push-wp/issues/104), [#102](https://github.com/perfectyorg/perfecty-push-wp/issues/102)

Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"phpunit/phpunit": "5.7.27",
"wp-coding-standards/wpcs": "^2.3",
"dealerdirect/phpcodesniffer-composer-installer": "^0.7.0",
"phpcompatibility/phpcompatibility-wp": "*"
"phpcompatibility/phpcompatibility-wp": "*",
"yoast/phpunit-polyfills": "^1.0"
}
}
65 changes: 63 additions & 2 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion includes/class-perfecty-push.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public function load_logger() {
Perfecty_Push_Lib_Log::init( $logger, Perfecty_Push_Lib_Log::DEBUG );
} else {
$logger = new Perfecty_Push_Lib_Log_ErrorLog();
Perfecty_Push_Lib_Log::init( $logger, Perfecty_Push_Lib_Log::INFO );
Perfecty_Push_Lib_Log::init( $logger, Perfecty_Push_Lib_Log::ERROR );
}
}

Expand Down
26 changes: 2 additions & 24 deletions lib/class-perfecty-push-lib-cron-check.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,8 @@ public static function run() {
}

// we have failed more than the threshold, we consider the cron is not
// correctly working and we show the warning
self::show_warning();
Log::error( 'Multiple cron checks have failed. Please check your cron configuration.' );
// correctly working and log the error
Log::error( 'Multiple cron checks have failed. Please check your cron configuration in wp-config.php' );
}
}

Expand Down Expand Up @@ -84,25 +83,4 @@ private static function schedule_next_tick() {
private static function is_wp_cron_enabled() {
return ! ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON );
}

/**
* Shows the warning message
*/
private static function show_warning() {
$message = esc_html__( 'It seems no cron system is working.', 'perfecty-push-notifications' ) . '</b><br />';
$message .= esc_html__( 'Perfecty Push Notifications uses scheduled actions to execute the notification jobs.', 'perfecty-push-notifications' ) . ' ';
$message .= sprintf(
// translators: %1$s is the opening a tag
// translators: %2$s is the closing a tag
esc_html__(
'Please, check your wp-config.php to assure %1$sDISABLE_WP_CRON%2$s is not set to \'true\' ' .
'and/or a system cron action is set in your server to periodically call wp-cron.php',
'perfecty-push-notifications'
),
'<a href="https://developer.wordpress.org/plugins/cron/hooking-wp-cron-into-the-system-task-scheduler/" target="_blank">',
'</a>'
);
Class_Perfecty_Push_Lib_Utils::show_message( $message, 'warning' );
}

}
2 changes: 1 addition & 1 deletion lib/class-perfecty-push-lib-db.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public static function db_create() {
$wpdb->query( "ALTER TABLE $user_table DROP INDEX endpoint" );
}
}
if ( $db_version == 5) {
if ( $db_version == 5 ) {
// the counters have been adjusted, we migrate the old stats
$wpdb->query( "UPDATE $notifications_table SET failed = total - succeeded" );
}
Expand Down
4 changes: 2 additions & 2 deletions perfecty-push.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* Plugin Name: Perfecty Push Notifications
* Plugin URI: https://wordpress.org/plugins/perfecty-push-notifications
* Description: Self-hosted, Open Source and powerful <strong>Web Push Notifications</strong> plugin to send push notifications <strong>from your own server for free!</strong>
* Version: 1.4.1
* Version: 1.4.2
* Author: Perfecty
* Author URI: https://perfecty.org
* License: GPL-2.0+
Expand All @@ -34,7 +34,7 @@
* Start at version 1.0.0 and use SemVer - https://semver.org
* Rename this for your plugin and update it as you release new versions.
*/
define( 'PERFECTY_PUSH_VERSION', '1.4.1' );
define( 'PERFECTY_PUSH_VERSION', '1.4.2' );

/**
* DB Version of the plugin
Expand Down
2 changes: 2 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class InvalidNonceException extends Exception {
exit( 1 );
}

require_once dirname( dirname( __FILE__ ) ) . "/vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php";

// Give access to tests_add_filter() function.
require_once $_tests_dir . '/includes/functions.php';

Expand Down

0 comments on commit ff65467

Please sign in to comment.