Skip to content

Commit

Permalink
Fix #12, #16 - PHP Fatal error: Uncaught Error: Call to undefined fun…
Browse files Browse the repository at this point in the history
…ction run_rocket_bot_for_all_langs()
  • Loading branch information
GeekPress committed May 28, 2019
1 parent 9b833eb commit 62ce0c8
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions command.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,11 +224,11 @@ public function clean( $args = array(), $assoc_args = array() ) {
} else {

if ( ! empty( $assoc_args['confirm'] ) && $assoc_args['confirm'] ) {
WP_CLI::line('Deleting all cache files.');
WP_CLI::line( 'Deleting all cache files.' );
} else {
WP_CLI::confirm('Delete all cache files ?');
WP_CLI::confirm( 'Delete all cache files ?' );
}

rocket_clean_domain();
WP_CLI::success( 'All cache files cleared.' );

Expand All @@ -246,25 +246,19 @@ public function clean( $args = array(), $assoc_args = array() ) {
* @subcommand preload
*/
public function preload( $args = array(), $assoc_args = array() ) {

if ( rocket_has_i18n() ) {
run_rocket_bot_for_all_langs();
} else {
run_rocket_bot( 'cache-preload' );
}
run_rocket_bot( 'cache-preload' );

WP_CLI::success( 'Finished WP Rocket preload cache files.' );

}

/**
* Regenerate file
* Regenerate file
*
* ## OPTIONS
*
* [--file=<file>]
* : The file to regenerate. It could be:
* - htaccess
* : The file to regenerate. It could be:
* - htaccess
* - advanced-cache
* - config (It's the config file stored in the wp-rocket-config folder)
*
Expand All @@ -279,22 +273,22 @@ public function regenerate( $args = array(), $assoc_args = array() ) {
switch( $assoc_args['file'] ) {
case 'advanced-cache':
rocket_generate_advanced_cache_file();
WP_CLI::success( 'The advanced-cache.php file has just been regenerated.' );
WP_CLI::success( 'The advanced-cache.php file has just been regenerated.' );
break;
case 'config':
rocket_generate_config_file();
WP_CLI::success( 'The config file has just been regenerated.' );
WP_CLI::success( 'The config file has just been regenerated.' );
break;
case 'htaccess':
$GLOBALS['is_apache'] = true;
flush_rocket_htaccess();
WP_CLI::success( 'The .htaccess file has just been regenerated.' );
WP_CLI::success( 'The .htaccess file has just been regenerated.' );
break;
default:
WP_CLI::error( 'You don\'t specify a good value for the "file" argument. It should be: advanced-cache, config or htaccess.' );
break;
}

} else {
WP_CLI::error( 'You don\'t specify the "file" argument.' );
}
Expand Down

0 comments on commit 62ce0c8

Please sign in to comment.