Skip to content

Commit 657a26c

Browse files
committed
Export config to temp dir instead of private
1 parent 22beeba commit 657a26c

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

src/Commands/ConfigExportCommand.php

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -54,39 +54,33 @@ class ConfigExportCommand extends SSHBaseCommand implements SiteAwareInterface {
5454
* (<site>.<env>)
5555
*
5656
* @option string $destination Local destination directory to sync files. Defaults to drush config directory, or cwd if not found.
57-
* @option string $remote-destination Remote destination directory to sync files within private:// path. Defaults to 'config-export'.
58-
* @option string $remove-existing Remove existing config from remote destination before running drush export. For backwards compatibility only, since `drush cex` already does this.
57+
* @option string $remote-destination Remote destination directory relative to /tmp/ to sync files. Defaults to 'config-export'.
5958
* @usage <site.env> Exports config from <site.env> to <destination>
6059
*/
6160

62-
public function configExportRemote($site_env, $options = ['destination' => '', 'remote-destination' => 'config-export', 'remove-existing' => FALSE]) {
61+
public function configExportRemote($site_env, $options = ['destination' => '', 'remote-destination' => '', 'remove-existing' => FALSE]) {
6362
$this->prepareEnvironment($site_env);
6463
[$this->site, $this->env] = $this->getSiteEnv($site_env);
6564
$sftp = $this->env->sftpConnectionInfo();
66-
$remote_destination = trim($options['remote-destination'], '/');
65+
if (empty($remote_destination)) {
66+
$remote_destination = 'config-export-' . time();
67+
}
6768
// For some reason sshCommand doesn't work for this:
6869
$this->log()->notice('Verifying remote destination.');
6970
passthru($sftp['command'] . " << EOF
70-
mkdir files/private/{$remote_destination}
71-
bye
72-
EOF 2>/dev/null");
73-
if ($options['remove-existing']) {
74-
$this->log()->notice('Removing existing config.');
75-
passthru($sftp['command'] . " << EOF
76-
rm files/private/{$remote_destination}/*
71+
mkdir /tmp/{$remote_destination}
7772
bye
7873
EOF 2>/dev/null");
79-
}
8074
$this->log()->notice('Exporting remote config.');
81-
$this->executeCommand(['drush', 'cex', '--destination=private://' . $remote_destination]);
75+
$this->executeCommand(['drush', 'cex', '--destination=/tmp/' . $remote_destination]);
8276
$destination = $options['destination'];
8377
$this->log()->notice('Verifying local destination.');
8478
if (empty($options['destination'])) {
8579
$destination = getcwd();
8680
}
8781
$destination = rtrim($destination, '/');
8882
$this->log()->notice('Rsyncing config from remote to local.');
89-
$this->rsync($site_env, ':files/private/' . $remote_destination . '/', $destination);
83+
$this->rsync($site_env, ':/tmp/' . $remote_destination . '/', $destination);
9084
$this->log()->notice('Cleaning up file permissions.');
9185
passthru('chmod 644 ' . $destination . '/*.yml');
9286
}

0 commit comments

Comments
 (0)