| Server IP : 65.108.144.40 / Your IP : 216.73.217.165 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 User : dev ( 1000) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/successkpi/wp-content/plugins/wpe-site-migration/class/SiteMigration/Cli/ |
Upload File : |
<?php
namespace DeliciousBrains\WPMDB\SiteMigration\Cli;
use DeliciousBrains\WPMDB\Common\Migration\MigrationHelper;
use DeliciousBrains\WPMDB\WPMDBDI;
use WP_CLI;
class Commands {
public function __construct() {
add_action( 'cli_init', [ $this, 'register' ] );
}
/**
* Register the command with WP-CLI.
*/
public static function register() {
WP_CLI::add_command( 'migrate', self::class );
}
/**
* Output the connection info string.
*
* ## OPTIONS
* [--version]
* : Include the version in the connection info.
*
* ## EXAMPLES
*
* wp migrate connection-info
*
*/
public function connection_info( $args, $assoc_args ) {
$migration_helper = WPMDBDI::getInstance()->get( MigrationHelper::class );
if ( is_a( $migration_helper, MigrationHelper::class ) ) {
$connection_info = implode( ' ', $migration_helper->get_connection_info() );
if ( is_array( $assoc_args ) && in_array( 'version', array_keys( $assoc_args ) ) ) {
$connection_info .= ' ' . $this->version();
}
WP_CLI::log( $connection_info );
}
}
/**
* Get the version of the plugin.
*
* @return string|null
*/
private function version() {
if ( isset( $GLOBALS['wpmdb_meta']['wpe-site-migration']['version'] ) ) {
return $GLOBALS['wpmdb_meta']['wpe-site-migration']['version'];
}
return null;
}
}