-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from Automattic/add/cli-rebuild
feat: wp-cli command to reset db tables
- Loading branch information
Showing
3 changed files
with
47 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
/** | ||
* WP-CLI integration. | ||
* | ||
* @package Newspack | ||
*/ | ||
|
||
namespace NewspackContentConverter; | ||
|
||
/** | ||
* Class Config | ||
* | ||
* @package NewspackContentConverter | ||
*/ | ||
class CLI { | ||
|
||
/** | ||
* Singleton instance. | ||
* | ||
* @var Config | ||
*/ | ||
private static $instance; | ||
|
||
/** | ||
* Config constructor. | ||
*/ | ||
public function __construct() { | ||
\WP_CLI::add_command( 'newspack-content-converter reset', [ $this, 'cli_reset' ] ); | ||
} | ||
|
||
/** | ||
* Reset the Newspack Content Converter tables. This action is equivalent to uninstalling, deleting, and reinstaalling the plugin. | ||
*/ | ||
public static function cli_reset() { | ||
\NewspackContentConverter\Installer::uninstall_plugin( true ); | ||
\WP_CLI::line( __( 'Uninstallation complete.', 'newspack-content-converter' ) ); | ||
\NewspackContentConverter\Installer::install_plugin( true ); | ||
\WP_CLI::line( __( 'Installation complete.', 'newspack-content-converter' ) ); | ||
\WP_CLI::success( 'Reset complete.' ); | ||
} | ||
} | ||
new \NewspackContentConverter\CLI(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters