Pantheon\Terminus\Commands\Env\CloneContentCommand::cloneContent PHP Method

cloneContent() public method

Clone content from one environment to another
public cloneContent ( string $site_env, string $target_env, array $options = ['db-only' => false, 'files-only' => false] )
$site_env string The origin site/environment to clone content from
$target_env string The target environment to clone content to
$options array
    public function cloneContent($site_env, $target_env, array $options = ['db-only' => false, 'files-only' => false])
    {
        if (!empty($options['db-only']) && !empty($options['files-only'])) {
            throw new TerminusException("You cannot specify both --db-only and --files-only");
        }
        list($site, $env) = $this->getSiteEnv($site_env);
        $from_name = $env->getName();
        $target = $site->getEnvironments()->get($target_env);
        if (empty($options['db-only'])) {
            $workflow = $target->cloneFiles($from_name);
            $this->log()->notice("Cloning files from {from_name} environment to {target_env} environment", compact(['from_name', 'target_env']));
            while (!$workflow->checkProgress()) {
                // @TODO: Add Symfony progress bar to indicate that something is happening.
            }
            $this->log()->notice($workflow->getMessage());
        }
        if (empty($options['files-only'])) {
            $workflow = $target->cloneDatabase($from_name);
            $this->log()->notice("Cloning database from {from_name} environment to {target_env} environment", compact(['from_name', 'target_env']));
            while (!$workflow->checkProgress()) {
                // @TODO: Add Symfony progress bar to indicate that something is happening.
            }
            $this->log()->notice($workflow->getMessage());
        }
    }
CloneContentCommand