src/Robo/Plugin/Commands/DigipolisDrupal8Commands.php
<?php
namespace DigipolisGent\Robo\Drupal8\Robo\Plugin\Commands;
use Consolidation\AnnotatedCommand\AnnotationData;
use Consolidation\AnnotatedCommand\CommandError;
use Consolidation\AnnotatedCommand\Events\CustomEventAwareInterface;
use Consolidation\AnnotatedCommand\Events\CustomEventAwareTrait;
use DigipolisGent\CommandBuilder\CommandBuilder;
use DigipolisGent\Robo\Helpers\Traits\DigipolisHelpersCommandUtilities;
use DigipolisGent\Robo\Helpers\Traits\EventDispatcher;
use RandomLib\Factory;
use Robo\Tasks;
use SecurityLib\Strength;
use Symfony\Component\Console\Input\InputInterface;
class DigipolisDrupal8Commands extends Tasks implements CustomEventAwareInterface
{
use \DigipolisGent\Robo\Helpers\Traits\DigipolisHelpersDeployCommandUtilities;
use \Boedah\Robo\Task\Drush\loadTasks;
/**
* Sync the database and files between two Drupal 8 sites.
*
* @param string $sourceUser
* SSH user to connect to the source server.
* @param string $sourceHost
* IP address of the source server.
* @param string $sourceKeyFile
* Private key file to use to connect to the source server.
* @param string $destinationUser
* SSH user to connect to the destination server.
* @param string $destinationHost
* IP address of the destination server.
* @param string $destinationKeyFile
* Private key file to use to connect to the destination server.
* @param string $sourceApp
* The name of the source app we're syncing. Used to determine the
* directory to sync.
* @param string $destinationApp
* The name of the destination app we're syncing. Used to determine the
* directory to sync to.
*/
public function digipolisSyncDrupal8(
$sourceUser,
$sourceHost,
$sourceKeyFile,
$destinationUser,
$destinationHost,
$destinationKeyFile,
$sourceApp = 'default',
$destinationApp = 'default',
$opts = ['files' => false, 'data' => false]
) {
if (!$opts['files'] && !$opts['data']) {
$opts['files'] = true;
$opts['data'] = true;
}
return $this->syncTaskFactory->syncTask(
$sourceUser,
$sourceHost,
$sourceKeyFile,
$destinationUser,
$destinationHost,
$destinationKeyFile,
$sourceApp,
$destinationApp,
$opts
);
}
}