src/Robo/Plugin/Commands/DigipolisLaravelSyncCommand.php
<?php
namespace DigipolisGent\Robo\Laravel\Robo\Plugin\Commands;
use Consolidation\AnnotatedCommand\Events\CustomEventAwareInterface;
use Robo\Tasks;
class DigipolisLaravelSyncCommand extends Tasks implements CustomEventAwareInterface
{
use \DigipolisGent\Robo\Helpers\Traits\DigipolisHelpersSyncCommandUtilities;
/**
* Sync the database and files between two Laravel 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 digipolisSyncLaravel(
$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->sync(
$sourceUser,
$sourceHost,
$sourceKeyFile,
$destinationUser,
$destinationHost,
$destinationKeyFile,
$sourceApp,
$destinationApp,
$opts
);
}
}