Commit a700e6b3 authored by helmo's avatar helmo

Code cleanup

parent 69929390
......@@ -5,14 +5,13 @@
*/
/**
* Provision backup-delete command
* Provision backup-delete command.
*
* These are the hooks that will be executed by the drush_invoke function
* when deleting a backup file from the backend.
*/
function drush_provision_drupal_provision_backup_delete($backup = null) {
if($backup) {
function drush_provision_drupal_provision_backup_delete($backup = NULL) {
if ($backup) {
$backups = explode(',', $backup);
foreach ($backups as $filename) {
$success = provision_file()->unlink($filename)
......@@ -26,7 +25,7 @@ function drush_provision_drupal_provision_backup_delete($backup = null) {
}
/**
* Implementation of drush_hook_post_provision_backup_delete()
* Implements drush_hook_post_COMMAND().
*
* If we have a client name and backups provided, cleanup the backup
* symlinks created for that client.
......@@ -34,7 +33,7 @@ function drush_provision_drupal_provision_backup_delete($backup = null) {
* Will not provoke a rollback if there is no symlink, for backward
* compatibility.
*/
function drush_provision_drupal_post_provision_backup_delete($backup = null) {
function drush_provision_drupal_post_provision_backup_delete($backup = NULL) {
if ($backup && d()->client_name) {
$backup_dir = d()->server->clients_path . '/' . d()->client_name . '/backups';
$backups = explode(',', $backup);
......
<?php
/**
* @file
* Deploy command implementation
*
* This command when called will
......@@ -16,11 +17,11 @@
*/
/**
* Make sure we have a valid site being deployd, and that the file being deployd from exists
* Make sure we have a valid site being deployd, and that the file being deployd from exists.
*
* Implementation of drush_hook_COMMAND_validate().
*/
function drush_provision_drupal_provision_deploy_validate($backup_file = null) {
function drush_provision_drupal_provision_deploy_validate($backup_file = NULL) {
$exists = provision_file()->exists($backup_file)
->succeed('Deploying site from @path')
->fail('Could not find backup file @path', 'PROVISION_BACKUP_NOT_FOUND')
......@@ -45,16 +46,16 @@ function drush_provision_drupal_provision_deploy_validate($backup_file = null) {
}
/**
* Make a backup before making any changes, and add extract the file we are restoring from
* Make a backup before making any changes, and add extract the file we are restoring from.
*
* Implementation of drush_hook_pre_COMMAND().
* Implementats drush_hook_pre_COMMAND().
*/
function drush_provision_drupal_pre_provision_deploy($backup_file) {
// the url is likely to have changed in the deployment
$extracted = provision_file()->extract($backup_file, drush_get_option('extract_path'))
->succeed('Successfully extracted the contents of @path')
->fail('Failed to extract the contents of @path to @target', 'PROVISION_BACKUP_EXTRACTION_FAILED')
->status();
if ($extracted) {
// Make sure the files in the files directory are accessible by the web server.
provision_file()->chgrp(drush_get_option('extract_path') . '/files', d('@server_master')->web_group, TRUE)
......@@ -67,7 +68,6 @@ function drush_provision_drupal_pre_provision_deploy($backup_file) {
->succeed('Changed group ownership of temp files in <code>@path</code> to @gid')
->fail('Could not change group ownership of temp files in <code>@path</code> to @gid');
if (drush_get_option('deploy_replace_site', FALSE)) {
$old = d()->site_path . '.restore';
$new = d()->site_path;
......@@ -80,7 +80,7 @@ function drush_provision_drupal_pre_provision_deploy($backup_file) {
drush_set_option('site_dirs_swapped', TRUE);
}
else {
return false;
return FALSE;
}
}
......@@ -131,7 +131,7 @@ function drush_provision_drupal_pre_provision_deploy($backup_file) {
}
/**
* Remove the extracted site directory
* Remove the extracted site directory.
*
* Implementation of drush_hook_pre_COMMAND_rollback().
*/
......@@ -139,7 +139,7 @@ function drush_provision_drupal_pre_provision_deploy_rollback() {
if (drush_get_option('deploy_replace_site', FALSE)) {
if (drush_get_option('site_dirs_swapped', FALSE)) {
// swap the site directories back if necessary.
// Swap the site directories back if necessary.
$old = d()->site_path . '.restore';
$new = d()->site_path;
......@@ -158,7 +158,7 @@ function drush_provision_drupal_pre_provision_deploy_rollback() {
}
/**
* Implementation of drush_hook_COMMAND().
* Implements drush_hook_COMMAND().
*/
function drush_provision_drupal_provision_deploy() {
_provision_drupal_maintain_aliases();
......@@ -166,10 +166,10 @@ function drush_provision_drupal_provision_deploy() {
}
/**
* Implementation of drush_hook_post_COMMAND().
* Implements drush_hook_post_COMMAND().
*/
function drush_provision_drupal_post_provision_deploy() {
// call the drush updatedb command.
// Call the drush updatedb command.
provision_backend_invoke(d()->name, 'updatedb');
// We should be able to fully load Drupal now.
if (drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_FULL)) {
......@@ -177,17 +177,17 @@ function drush_provision_drupal_post_provision_deploy() {
drush_set_option('packages', _scrub_object(provision_drupal_system_map()), 'site');
_provision_drupal_rebuild_caches();
// rebuild the node access tables only if necessary
// Rebuild the node access tables only if necessary.
if (!function_exists("node_access_needs_rebuild") || node_access_needs_rebuild()) {
node_access_rebuild();
drush_log(dt('Rebuilt node access table'));
}
} else {
}
else {
drush_log("could not bootstrap drupal after updatedb");
}
// remove the restore directory
// Remove the restore directory.
if (!drush_get_error() && drush_get_option('deploy_replace_site', FALSE)) {
_provision_recursive_delete(drush_get_option('extract_path'));
}
......
<?php
/**
* Provision verify command
* @file
* Code related to verify tasks.
*/
/**
* Provision verify command.
*
* Disable an enabled and installed site
*/
......@@ -20,7 +25,7 @@ function drush_provision_drupal_provision_verify_validate() {
/**
* implementation of provision_verify
* Implements drush_hook_pre_COMMAND().
*/
function drush_provision_drupal_pre_provision_verify() {
if (d()->type === 'server') {
......@@ -34,7 +39,7 @@ function drush_provision_drupal_pre_provision_verify() {
provision_file()->create_dir(d()->include_path, dt('Provision PHP configuration'), 0711);
if (!provision_file()->exists(d()->include_path . '/global.inc')->succeed('Global configuration file exists')->status()) {
// Create an empty global.inc so the include doesn't fail with
// open_basedir restrictions
// open_basedir restrictions.
$config = new Provision_Config_Global_Settings(d()->name);
$config->write();
}
......@@ -46,12 +51,12 @@ function drush_provision_drupal_pre_provision_verify() {
}
}
elseif (d()->type === 'platform') {
// create a platform from a makefile, if it doesnt already exist and the makefile does.
// Create a platform from a makefile, if it doesnt already exist and the makefile does.
if (!provision_file()->exists(d()->root)->status() && !empty(d()->makefile)) {
drush_log(dt("Platform path does not exist, fetching from drush makefile"));
$arguments = array();
$options = array();
// propagate working-copy args downward
// Propagate working-copy args downward.
if (drush_get_option('working-copy') || !empty(d()->make_working_copy)) {
$options[] = '--working-copy';
}
......@@ -71,7 +76,7 @@ function drush_provision_drupal_pre_provision_verify() {
drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_ROOT);
// If we couldn't bootstrap, there's no sense in continuing past this point.
if(drush_get_error()) {
if (drush_get_error()) {
return drush_set_error("DRUSH_INVALID_DRUPAL_ROOT",
"Drush could not bootstrap this platform. Please check the platform directory exists and is readable.");
}
......@@ -113,7 +118,7 @@ function drush_provision_drupal_pre_provision_verify() {
}
/**
* Implementation of hook_provision_post_verify
* Implements drush_hook_provision_post_COMMAND().
*/
function drush_provision_drupal_post_provision_verify() {
if (d()->type === 'site') {
......@@ -124,4 +129,3 @@ function drush_provision_drupal_post_provision_verify() {
drush_include_engine('drupal', 'cron_key');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment