Skip to content

Commit 03becf6

Browse files
authored
Merge pull request #14 from iamsayan/develop
feat: update Action Scheduler to version 3.9.2 and add WP CLI commands
2 parents 05f3e81 + 3347d2b commit 03becf6

34 files changed

+2024
-59
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,28 @@ If you like Advanced Cron Scheduler plugin, please take a moment to [give a 5-st
44

55
All notable changes to this project will be documented in this file.
66

7+
## 1.1.4
8+
Release Date: 29th April, 2025
9+
10+
* Fixed: Wrong Settings URL.
11+
* Fixed: PHPCS Issues.
12+
* Updated: Action Scheduler library to v3.9.2.
13+
* Minimum WordPress supported version is now 6.5.0.
14+
* Tested up to WordPress 6.8.
15+
16+
## 1.1.3
17+
Release Date: 3rd January, 2025
18+
19+
* Fixed: Issue with migration of WP Cron events.
20+
21+
## 1.1.2
22+
Release Date: 2nd January, 2025
23+
24+
* Added: Support for Customizing the Action Scheduler.
25+
* Updated: Action Scheduler library to v3.9.0.
26+
* Minimum PHP supported version is now 7.1.
27+
* Tested up to WordPress 6.7.
28+
729
## 1.1.1
830
Release Date: 1st March, 2024
931

composer.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

includes/Base/Actions.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function register() {
3434
* Register settings link.
3535
*/
3636
public function settings_link( $links ) {
37-
$links[] = '<a href="' . admin_url( 'options-general.php#acswp-settings' ) . '">' . __( 'Settings', 'migrate-wp-cron-to-action-scheduler' ) . '</a>';
37+
$links[] = '<a href="' . admin_url( 'options-general.php?page=advanced-cron-scheduler' ) . '">' . __( 'Settings', 'migrate-wp-cron-to-action-scheduler' ) . '</a>';
3838
$links[] = '<a href="' . admin_url( 'tools.php?page=action-scheduler' ) . '">' . __( 'Action Scheduler', 'migrate-wp-cron-to-action-scheduler' ) . '</a>';
3939

4040
return $links;

includes/Core/Settings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ public function data_retention_period_field() { ?>
186186
?>
187187
</select>
188188
</div>
189-
<small>By default, Action Scheduler deletes completed actions every 30 days. Use this field to set a default actions delete duration.</small>
189+
<small><?= esc_html__( 'By default, Action Scheduler deletes completed actions every 30 days. Use this field to set a default actions delete duration.', 'migrate-wp-cron-to-action-scheduler' ); ?></small>
190190
</div>
191191
<?php
192192
}

includes/Helpers/HelperFunctions.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ protected function get_protected_hooks() {
152152
/**
153153
* Get settings.
154154
*/
155-
protected function get_settings( $key, $default = null ) {
155+
protected function get_settings( $key, $default_value = null ) {
156156
$settings = get_option( 'acswp_settings', [] );
157157
if ( empty( $settings ) || ! is_array( $settings ) ) {
158158
$settings = [];
@@ -162,6 +162,6 @@ protected function get_settings( $key, $default = null ) {
162162
return $settings[ $key ];
163163
}
164164

165-
return $default;
165+
return $default_value;
166166
}
167167
}

includes/Loader.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ public static function get_services() {
4141
public static function register_services() {
4242
foreach ( self::get_services() as $class ) {
4343
$service = self::instantiate( $class );
44+
4445
if ( method_exists( $service, 'register' ) ) {
4546
$service->register();
4647
}
@@ -53,8 +54,8 @@ public static function register_services() {
5354
* @param class $class class from the services array
5455
* @return class instance new instance of the class
5556
*/
56-
private static function instantiate( $class ) {
57-
$service = new $class();
57+
private static function instantiate( $service_class ) {
58+
$service = new $service_class();
5859

5960
return $service;
6061
}

migrate-wp-cron-to-action-scheduler.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Advanced Cron Scheduler for WordPress
44
* Plugin URI: https://wordpress.org/plugins/migrate-wp-cron-to-action-scheduler/
55
* Description: The Advanced Cron Scheduler plugin helps to easily replace or migrate Native WordPress Cron to the Action Scheduler Library.
6-
* Version: 1.1.3
6+
* Version: 1.1.4
77
* Author: Sayan Datta
88
* Author URI: https://www.sayandatta.co.in
99
* License: GPLv3
@@ -44,7 +44,7 @@ final class ACSWP {
4444
*
4545
* @var string
4646
*/
47-
public $version = '1.1.3';
47+
public $version = '1.1.4';
4848

4949
/**
5050
* Minimum version of WordPress required to run ACSWP.
@@ -211,7 +211,7 @@ function () {
211211
*
212212
* @return ACSWP
213213
*/
214-
function acswp() {
214+
function acswp() { // phpcs:ignore Universal.Files.SeparateFunctionsFromOO.Mixed
215215
return ACSWP::get();
216216
}
217217

readme.txt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
=== Advanced Cron Scheduler for WordPress ===
22
Contributors: infosatech
33
Tags: scheduler, wp cron, debug, cron manager, action scheduler
4-
Requires at least: 5.2
5-
Tested up to: 6.7
6-
Stable tag: 1.1.3
4+
Requires at least: 6.5
5+
Tested up to: 6.8
6+
Stable tag: 1.1.4
77
Requires PHP: 7.1
88
Donate link: https://www.paypal.me/iamsayan/
99
License: GPLv3
@@ -95,6 +95,15 @@ Yes, our plugins work independently of themes you are using. As long as your web
9595

9696
If you like Advanced Cron Scheduler, please take a moment to [give a 5-star rating](https://wordpress.org/support/plugin/migrate-wp-cron-to-action-scheduler/reviews/#new-post). It helps to keep development and support going strong. Thank you!
9797

98+
= 1.1.4 =
99+
Release Date: 29th April, 2025
100+
101+
* Fixed: Wrong Settings URL.
102+
* Fixed: PHPCS Issues.
103+
* Updated: Action Scheduler library to v3.9.2.
104+
* Minimum WordPress supported version is now 6.5.0.
105+
* Tested up to WordPress 6.8.
106+
98107
= 1.1.3 =
99108
Release Date: 3rd January, 2025
100109

vendor/autoload.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@
1414
echo $err;
1515
}
1616
}
17-
trigger_error(
18-
$err,
19-
E_USER_ERROR
20-
);
17+
throw new RuntimeException($err);
2118
}
2219

2320
require_once __DIR__ . '/composer/autoload_real.php';

vendor/composer/InstalledVersions.php

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,23 @@
2626
*/
2727
class InstalledVersions
2828
{
29+
/**
30+
* @var string|null if set (by reflection by Composer), this should be set to the path where this class is being copied to
31+
* @internal
32+
*/
33+
private static $selfDir = null;
34+
2935
/**
3036
* @var mixed[]|null
3137
* @psalm-var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>}|array{}|null
3238
*/
3339
private static $installed;
3440

41+
/**
42+
* @var bool
43+
*/
44+
private static $installedIsLocalDir;
45+
3546
/**
3647
* @var bool|null
3748
*/
@@ -309,6 +320,24 @@ public static function reload($data)
309320
{
310321
self::$installed = $data;
311322
self::$installedByVendor = array();
323+
324+
// when using reload, we disable the duplicate protection to ensure that self::$installed data is
325+
// always returned, but we cannot know whether it comes from the installed.php in __DIR__ or not,
326+
// so we have to assume it does not, and that may result in duplicate data being returned when listing
327+
// all installed packages for example
328+
self::$installedIsLocalDir = false;
329+
}
330+
331+
/**
332+
* @return string
333+
*/
334+
private static function getSelfDir()
335+
{
336+
if (self::$selfDir === null) {
337+
self::$selfDir = strtr(__DIR__, '\\', '/');
338+
}
339+
340+
return self::$selfDir;
312341
}
313342

314343
/**
@@ -325,19 +354,24 @@ private static function getInstalled()
325354
$copiedLocalDir = false;
326355

327356
if (self::$canGetVendors) {
357+
$selfDir = self::getSelfDir();
328358
foreach (ClassLoader::getRegisteredLoaders() as $vendorDir => $loader) {
359+
$vendorDir = strtr($vendorDir, '\\', '/');
329360
if (isset(self::$installedByVendor[$vendorDir])) {
330361
$installed[] = self::$installedByVendor[$vendorDir];
331362
} elseif (is_file($vendorDir.'/composer/installed.php')) {
332363
/** @var array{root: array{name: string, pretty_version: string, version: string, reference: string|null, type: string, install_path: string, aliases: string[], dev: bool}, versions: array<string, array{pretty_version?: string, version?: string, reference?: string|null, type?: string, install_path?: string, aliases?: string[], dev_requirement: bool, replaced?: string[], provided?: string[]}>} $required */
333364
$required = require $vendorDir.'/composer/installed.php';
334365
self::$installedByVendor[$vendorDir] = $required;
335366
$installed[] = $required;
336-
if (strtr($vendorDir.'/composer', '\\', '/') === strtr(__DIR__, '\\', '/')) {
367+
if (self::$installed === null && $vendorDir.'/composer' === $selfDir) {
337368
self::$installed = $required;
338-
$copiedLocalDir = true;
369+
self::$installedIsLocalDir = true;
339370
}
340371
}
372+
if (self::$installedIsLocalDir && $vendorDir.'/composer' === $selfDir) {
373+
$copiedLocalDir = true;
374+
}
341375
}
342376
}
343377

0 commit comments

Comments
 (0)