1
1
<?php
2
2
namespace Cbx \Careertoolkit \Factories \Misc ;
3
+ use Cbx \Careertoolkit \Factories \Factory ;
3
4
4
5
/**
5
6
* Easy plugin checker command command
6
7
* Class EasyPluginChecker
7
8
* @since 1.0.1
8
9
*/
9
- class EasyPluginChecker{
10
+ class EasyPluginChecker extends Factory {
10
11
11
12
/**
12
13
* Register CLI command
@@ -25,12 +26,13 @@ public function wp_cli_register_commands() {
25
26
* @since 1.0.0
26
27
*/
27
28
public function run ( $ args , $ assoc_args ) {
29
+ \WP_CLI ::success ("Plugin check output written to " );
28
30
global $ wpdb ;
29
31
30
32
$ plugin = $ args [0 ];
31
- $ exclude_directories = WP_CLI \Utils \get_flag_value ($ assoc_args , 'exclude-directories ' , '' );
32
- $ format = WP_CLI \Utils \get_flag_value ($ assoc_args , 'format ' , 'table ' ); // Default format is table
33
- $ output_file = WP_CLI \Utils \get_flag_value ($ assoc_args , 'output-file ' , '' );
33
+ $ exclude_directories = \ WP_CLI \Utils \get_flag_value ($ assoc_args , 'exclude-directories ' , '' );
34
+ $ format = \ WP_CLI \Utils \get_flag_value ($ assoc_args , 'format ' , 'table ' ); // Default format is table
35
+ $ output_file = \ WP_CLI \Utils \get_flag_value ($ assoc_args , 'output-file ' , '' );
34
36
35
37
// Set default output file if not provided
36
38
if (empty ($ output_file )) {
@@ -49,22 +51,22 @@ public function run( $args, $assoc_args ) {
49
51
exec ($ command , $ output , $ return_var );
50
52
51
53
if ($ return_var !== 0 ) {
52
- WP_CLI ::error ('Error running the plugin check command. ' );
54
+ \ WP_CLI ::error ('Error running the plugin check command. ' );
53
55
}
54
56
55
57
// Combine the output into a single string
56
58
$ output_content = implode ("\n" , $ output );
57
59
58
60
// Clean the file (truncate) before writing new output
59
61
if (file_put_contents ($ output_file , '' ) === false ) {
60
- WP_CLI ::error ('Failed to clear the output file. ' );
62
+ \ WP_CLI ::error ('Failed to clear the output file. ' );
61
63
}
62
64
63
65
// Write the output to the file
64
66
if (file_put_contents ($ output_file , $ output_content ) === false ) {
65
- WP_CLI ::error ('Failed to write output to the file. ' );
67
+ \ WP_CLI ::error ('Failed to write output to the file. ' );
66
68
}
67
69
68
- WP_CLI ::success ("Plugin check output written to {$ output_file }" );
70
+ \ WP_CLI ::success ("Plugin check output written to {$ output_file }" );
69
71
} //end method run
70
72
} //end class EasyPluginChecker
0 commit comments