This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Added to the bottom of Provision_Service_http_pack | |
| function shell_exec($command) { | |
| $this->_each_server($this->server->master_web_servers, __FUNCTION__, array($command)); | |
| $this->_each_server($this->server->slave_web_servers, __FUNCTION__, array($command)); | |
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * After a site is installed, reach out to each web server and verify that the | |
| * files directory is a symlink to the correct AFS volume. | |
| */ | |
| function drush_myclient_provision_post_provision_install() { | |
| if (d()->type == 'site' && method_exists(d()->service('http'), '_each_server')) { | |
| $volume_id = d()->myclient_site_afs_volume_name; | |
| $site_path = d()->site_path; | |
| // Remove the files and private directory and any child directories if they exist. | |
| $command = 'rm -rf ' . escapeshellarg($site_path . '/files') . ' && rm -rf ' . escapeshellarg($site_path . '/private'); | |
| d()->service('http')->shell_exec($command); | |
| drush_log(dt('Executed @command on remote servers.', array('@command' => $command)), 'notice'); | |
| drush_log(dt('Removed old files directories on remote servers'), 'success'); | |
| // Create symlinks from the old paths to AFS. | |
| $volume_path = '/afs/myclient/g/web/drupal/' . $volume_id; | |
| $command = 'ln -s ' . escapeshellarg($volume_path . '/files') . ' ' . escapeshellarg($site_path . '/files') . ' && ' . | |
| 'ln -s ' . escapeshellarg($volume_path . '/private') . ' ' . escapeshellarg($site_path . '/private'); | |
| d()->service('http')->shell_exec($command); | |
| drush_log(dt('Executed @command on remote servers.', array('@command' => $command)), 'notice'); | |
| drush_log(dt('Created symlinks for files and private directories on remote servers'), 'success'); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment