Skip to content

Commit 8b4fa27

Browse files
committed
Improve wp action-scheduler source --all for situations where registered sources are not available.
1 parent e2dceaa commit 8b4fa27

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

classes/WP_CLI/System_Command.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaping output is not necessary in WP CLI.
66

77
use ActionScheduler_SystemInformation;
8+
use WP_CLI;
89
use function \WP_CLI\Utils\get_flag_value;
910

1011
/**
@@ -161,7 +162,13 @@ public function source( array $args, array $assoc_args ) {
161162
}
162163

163164
$sources = ActionScheduler_SystemInformation::get_sources();
164-
$rows = array();
165+
166+
if ( empty( $sources ) ) {
167+
WP_CLI::log( __( 'Detailed information about registered sources is not currently available.', 'action-scheduler' ) );
168+
return;
169+
}
170+
171+
$rows = array();
165172

166173
foreach ( $sources as $check_source => $version ) {
167174
$active = dirname( $check_source ) === $source;

0 commit comments

Comments
 (0)