|
@@ 263-283 (lines=21) @@
|
| 260 |
|
* |
| 261 |
|
* @subcommand activate-component |
| 262 |
|
*/ |
| 263 |
|
public function activate_component( $args, $assoc_args ) { |
| 264 |
|
|
| 265 |
|
if ( ! class_exists( 'PodsInit' ) ) { |
| 266 |
|
WP_CLI::error( __( 'PodsInit not available', 'pods' ) ); |
| 267 |
|
|
| 268 |
|
return; |
| 269 |
|
} |
| 270 |
|
|
| 271 |
|
$component = $assoc_args['component']; |
| 272 |
|
|
| 273 |
|
$active = PodsInit::$components->is_component_active( $component ); |
| 274 |
|
|
| 275 |
|
if ( $active ) { |
| 276 |
|
WP_CLI::error( sprintf( __( 'Component %s is already active.', 'pods' ), $component ) ); |
| 277 |
|
} else { |
| 278 |
|
PodsInit::$components->activate_component( $component ); |
| 279 |
|
|
| 280 |
|
WP_CLI::success( __( 'Component activated.', 'pods' ) ); |
| 281 |
|
} |
| 282 |
|
|
| 283 |
|
} |
| 284 |
|
|
| 285 |
|
/** |
| 286 |
|
* Deactivate a component. |
|
@@ 299-319 (lines=21) @@
|
| 296 |
|
* |
| 297 |
|
* @subcommand deactivate-component |
| 298 |
|
*/ |
| 299 |
|
public function deactivate_component( $args, $assoc_args ) { |
| 300 |
|
|
| 301 |
|
if ( ! class_exists( 'PodsInit' ) ) { |
| 302 |
|
WP_CLI::error( __( 'PodsInit not available', 'pods' ) ); |
| 303 |
|
|
| 304 |
|
return; |
| 305 |
|
} |
| 306 |
|
|
| 307 |
|
$component = $assoc_args['component']; |
| 308 |
|
|
| 309 |
|
$active = PodsInit::$components->is_component_active( $component ); |
| 310 |
|
|
| 311 |
|
if ( ! $active ) { |
| 312 |
|
WP_CLI::error( sprintf( __( 'Component %s is not active.', 'pods' ), $component ) ); |
| 313 |
|
} else { |
| 314 |
|
PodsInit::$components->deactivate_component( $component ); |
| 315 |
|
|
| 316 |
|
WP_CLI::success( __( 'Component deactivated.', 'pods' ) ); |
| 317 |
|
} |
| 318 |
|
|
| 319 |
|
} |
| 320 |
|
|
| 321 |
|
/** |
| 322 |
|
* Clear the Pods cache. |