|
@@ 110-130 (lines=21) @@
|
| 107 |
|
* @synopsis --component=<component> |
| 108 |
|
* @subcommand activate-component |
| 109 |
|
*/ |
| 110 |
|
function activate_component( $args, $assoc_args ) { |
| 111 |
|
|
| 112 |
|
if ( ! class_exists( 'PodsInit' ) ) { |
| 113 |
|
WP_CLI::error( __( 'PodsInit not available', 'pods' ) ); |
| 114 |
|
|
| 115 |
|
return; |
| 116 |
|
} |
| 117 |
|
|
| 118 |
|
$component = $assoc_args['component']; |
| 119 |
|
|
| 120 |
|
$active = PodsInit::$components->is_component_active( $component ); |
| 121 |
|
|
| 122 |
|
if ( $active ) { |
| 123 |
|
WP_CLI::error( sprintf( __( 'Component %s is already active', 'pods' ), $component ) ); |
| 124 |
|
} else { |
| 125 |
|
PodsInit::$components->activate_component( $component ); |
| 126 |
|
|
| 127 |
|
WP_CLI::success( __( 'Component activated', 'pods' ) ); |
| 128 |
|
} |
| 129 |
|
|
| 130 |
|
} |
| 131 |
|
|
| 132 |
|
/** |
| 133 |
|
* Deactivate a component |
|
@@ 138-158 (lines=21) @@
|
| 135 |
|
* @synopsis --component=<component> |
| 136 |
|
* @subcommand deactivate-component |
| 137 |
|
*/ |
| 138 |
|
function deactivate_component( $args, $assoc_args ) { |
| 139 |
|
|
| 140 |
|
if ( ! class_exists( 'PodsInit' ) ) { |
| 141 |
|
WP_CLI::error( __( 'PodsInit not available', 'pods' ) ); |
| 142 |
|
|
| 143 |
|
return; |
| 144 |
|
} |
| 145 |
|
|
| 146 |
|
$component = $assoc_args['component']; |
| 147 |
|
|
| 148 |
|
$active = PodsInit::$components->is_component_active( $component ); |
| 149 |
|
|
| 150 |
|
if ( ! $active ) { |
| 151 |
|
WP_CLI::error( sprintf( __( 'Component %s is already not active', 'pods' ), $component ) ); |
| 152 |
|
} else { |
| 153 |
|
PodsInit::$components->deactivate_component( $component ); |
| 154 |
|
|
| 155 |
|
WP_CLI::success( __( 'Component deactivated', 'pods' ) ); |
| 156 |
|
} |
| 157 |
|
|
| 158 |
|
} |
| 159 |
|
|
| 160 |
|
/** |
| 161 |
|
* Clear pods cache |