diff --git a/aegir.make b/aegir.make index d60ac548d9e974b2f4f77ce29326aac0e855944e..2ae49564d3f24fe275f2406e9b3612e1bd005056 100644 --- a/aegir.make +++ b/aegir.make @@ -6,4 +6,4 @@ projects[drupal][type] = "core" projects[hostmaster][type] = "profile" projects[hostmaster][download][type] = "git" projects[hostmaster][download][url] = "http://git.drupal.org/project/hostmaster.git" -projects[hostmaster][download][tag] = "6.x-1.5" +projects[hostmaster][download][tag] = "6.x-1.6" diff --git a/db/db.drush.inc b/db/db.drush.inc index 0bff9d49ee8c11059bb511add4778dc3e64f27a0..8ae961c0725254511720c3d4ddb050171d253ca8 100644 --- a/db/db.drush.inc +++ b/db/db.drush.inc @@ -1,5 +1,5 @@ context->uri; @@ -101,7 +102,7 @@ class provisionService_db extends provisionService { } drush_set_error('PROVISION_CREATE_DB_FAILED', dt("Could not find a free database names after 100 attempts")); - return false; + return FALSE; } /** @@ -112,7 +113,7 @@ class provisionService_db extends provisionService { $creds = $this->generate_site_credentials(); } extract($creds); - + if (!$this->can_create_database()) { drush_set_error('PROVISION_CREATE_DB_FAILED'); drush_log("Database could not be created.", 'error'); @@ -135,9 +136,9 @@ class provisionService_db extends provisionService { else { drush_set_error('PROVISION_CREATE_DB_FAILED', dt("Could not create @name database", array("@name" => $db_name))); } - return $status; + return $status; } - + /** * Remove the database and user account for the supplied credentials */ @@ -147,18 +148,18 @@ class provisionService_db extends provisionService { } extract($creds); - if ( $this->database_exists($db_name) ) { + if ($this->database_exists($db_name)) { drush_log(dt("Dropping database @dbname", array('@dbname' => $db_name))); if (!$this->drop_database($db_name)) { drush_log(dt("Failed to drop database @dbname", array('@dbname' => $db_name)), 'warning'); } } - - if ( $this->database_exists($db_name) ) { - drush_set_error('PROVISION_DROP_DB_FAILED'); - return FALSE; + + if ($this->database_exists($db_name)) { + drush_set_error('PROVISION_DROP_DB_FAILED'); + return FALSE; } - + foreach ($this->grant_host_list() as $db_grant_host) { drush_log(dt("Revoking privileges of %user@%client from %database", array('%user' => $db_user, '%client' => $db_grant_host, '%database' => $db_name))); if (!$this->revoke($db_name, $db_user, $db_grant_host)) { @@ -168,7 +169,7 @@ class provisionService_db extends provisionService { } - function import_site_database($dump_file = null, $creds = array()) { + function import_site_database($dump_file = NULL, $creds = array()) { if (is_null($dump_file)) { $dump_file = d()->site_path . '/database.sql'; } @@ -194,7 +195,7 @@ class provisionService_db extends provisionService { function generate_site_credentials() { $creds = array(); - // replace with service type + // replace with service type $db_type = drush_get_option('db_type', function_exists('mysqli_connect') ? 'mysqli' : 'mysql'); // As of Drupal 7 there is no more mysqli type if (drush_drupal_major_version() >= 7) { @@ -308,10 +309,10 @@ class provisionService_db_pdo extends provisionService_db { catch (PDOException $e) { return drush_set_error('PROVISION_DB_CONNECT_FAIL', $e->getMessage()); } - } + } function close() { - $this->conn = null; + $this->conn = NULL; } function query($query) { @@ -322,14 +323,14 @@ class provisionService_db_pdo extends provisionService_db { } $this->query_callback($args, TRUE); $query = preg_replace_callback(PROVISION_QUERY_REGEXP, array($this, 'query_callback'), $query); - + try { $result = $this->conn->query($query); } catch (PDOException $e) { drush_log($e->getMessage(), 'warning'); return FALSE; - } + } return $result; @@ -356,7 +357,7 @@ class provisionService_db_pdo extends provisionService_db { } } - + function database_exists($name) { $dsn = $this->dsn . ';dbname=' . $name; try { @@ -371,4 +372,3 @@ class provisionService_db_pdo extends provisionService_db { } } } - diff --git a/platform/login_reset.provision.inc b/platform/login_reset.provision.inc index eb02449899878d1b750a5d00c680721dceaabc6c..716222a776174ff3692827022922012bb1126a36 100644 --- a/platform/login_reset.provision.inc +++ b/platform/login_reset.provision.inc @@ -16,7 +16,16 @@ */ function drush_provision_drupal_provision_login_reset() { drush_bootstrap(DRUSH_BOOTSTRAP_DRUPAL_FULL); - $account = user_load(1); + // Drupal 7/8 take a uid as an integer and not an array + if (drush_drupal_major_version() >= 7) { + $account = user_load(1); + } + else { + $account = user_load(array('uid' => 1)); + } + if (empty($account)) { + return drush_set_error('PROVISION_UNABLE_TO_LOAD_UID_1', 'Could not load the admin user with uid 1 on this site.'); + } $onetime = user_pass_reset_url($account); // pass the login link to the front end drush_set_option('login_link', $onetime); diff --git a/provision.context.platform.inc b/provision.context.platform.inc index 2a89f0d692b5a9c3bd6e1c2b9e97dfd5db0fb416..9e82393478ce27b1e675284db9751de38d24ec69 100644 --- a/provision.context.platform.inc +++ b/provision.context.platform.inc @@ -15,8 +15,9 @@ class provisionContext_platform extends provisionContext { static function option_documentation() { return array( '--root' => 'platform: path to a Drupal installation', - '--server' => 'drush backend server; default @server_master', - '--web_server' => 'web server hosting the platform; default @server_master', + '--server' => 'platform: drush backend server; default @server_master', + '--web_server' => 'platform: web server hosting the platform; default @server_master', + '--makefile' => 'platform: drush makefile to use for building the platform if it doesn\'t already exist', ); } diff --git a/provision.drush.inc b/provision.drush.inc index f96a687b1af11b6ee26abd5c940ce90f9bdcce83..6c40f3827f523ee9012279acc36c10b91e653242 100644 --- a/provision.drush.inc +++ b/provision.drush.inc @@ -83,6 +83,9 @@ function provision_drush_command() { ); $items['provision-install'] = array( 'description' => dt('Provision a new site using the provided data.'), + 'examples' => array( + 'drush @site provision-install' => 'Install the site as defined by the site Drush alias generated with provision-save.', + ), 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT ); @@ -93,88 +96,127 @@ function provision_drush_command() { ); $items['provision-import'] = array( - 'arguments' => array('domain.com' => dt('The domain of the site to import.')), 'description' => dt('Turn an already running site into a provisioned site.'), + 'examples' => array( + 'drush @site provision-import' => 'Import the site as defined by the site Drush alias generated with provision-save.', + ), 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT ); $items['provision-backup'] = array( - 'arguments' => array('domain.com' => dt('The domain of the site to back up.')), 'optional arguments' => array('backup-file' => dt('The file to save the backup to. This will be a gzipped tarball.')), 'description' => dt('Generate a back up for the site.'), + 'examples' => array( + 'drush @site provision-backup' => 'Back up the site as defined by the site Drush alias generated with provision-save.', + ), 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT ); $items['provision-enable'] = array( - 'arguments' => array('domain.com' => dt('The domain of the site to enable (only if enabled).')), 'description' => 'Enable a disabled site.', + 'examples' => array( + 'drush @site provision-enable' => 'Enable the site as defined by the site Drush alias generated with provision-save.', + ), 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT ); $items['provision-disable'] = array( - 'arguments' => array('domain.com' => dt('The domain of the site to disable (only if disabled).')), 'description' => 'Disable a site.', + 'examples' => array( + 'drush @site provision-disable' => 'Disable the site as defined by the site Drush alias generated with provision-save.', + ), 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT ); $items['provision-lock'] = array( 'description' => 'Lock a platform from having any other sites provisioned on it.', + 'examples' => array( + 'drush @platform provision-lock' => 'Lock the platform as defined by the platform Drush alias generated with provision-save.', + ), 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT ); $items['provision-unlock'] = array( 'description' => 'Unlock a platform so that sites can be provisioned on it.', + 'examples' => array( + 'drush @platform provision-unlock' => 'Unlock the platform as defined by the platform Drush alias generated with provision-save.', + ), 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT ); $items['provision-verify'] = array( - 'arguments' => array('domain.com' => dt('The domain of the site to verify).')), 'description' => 'Verify that the provisioning framework is correctly installed.', - 'bootstrap' => DRUSH_BOOTSTRAP_DRUSH, + 'examples' => array( + 'drush @site provision-verify' => 'Verify the site as defined by the site Drush alias generated with provision-save.', + 'drush @platform provision-verify' => 'Verify the platform as defined by the platform Drush alias generated with provision-save.', + ), + 'bootstrap' => DRUSH_BOOTSTRAP_DRUSH ); $items['provision-restore'] = array( 'description' => 'Restore the site to a previous backup. This will also generate a backup of the site as it was.', - 'arguments' => array('domain.com' => dt('The domain of the site to be restored'), + 'arguments' => array( 'site_backup.tar.gz' => dt('The backup to restore the site to.')), + 'examples' => array( + 'drush @site provision-restore ~/backups/some_site.tar.gz' => 'Restore the site to the backup in ~/backups/some_site.tar.gz.', + ), 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT ); $items['provision-deploy'] = array( 'description' => 'Deploy an existing backup to a new url.', - 'arguments' => array('domain.com' => dt('The domain to deploy the site package to.'), + 'arguments' => array( 'site_backup.tar.gz' => dt('The backup to deploy.')), + 'examples' => array( + 'drush @site provision-deploy ~/backups/some_site.tar.gz' => 'Deploy the site as defined by the site Drush alias, from the backup in ~/backups/some_site.tar.gz.', + ), 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT ); $items['provision-migrate'] = array( 'description' => 'Migrate a site between platforms.', - 'arguments' => array('domain.com' => dt('The domain to migrate. Any outstanding updates will be run.'), - '/path/to/platform' => dt('The platform to migrate the site to.')), + 'arguments' => array( + '@platform_name' => dt('The Drush alias of the platform.')), + 'examples' => array( + 'drush @site provision-migrate @platform_name' => 'Migrate the site as defined by the Drush alias, to the platform as defined by the platform\'s Drush alias', + ), 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT ); $items['provision-clone'] = array( 'description' => 'Clone a site between platforms.', - 'arguments' => array('domain.com' => dt('The domain to clone. Any outstanding updates will be run.'), - 'new.domain.com' => dt('The new domain name to use.'), - '/path/to/platform' => dt('The platform to clone the site to.')), + 'arguments' => array( + '@new_site' => dt('The Drush alias of the new site as generated by provision-save.'), + '@platform_name' => dt('The Drush alias of the platform to clone the site onto.')), + 'examples' => array( + 'drush @site provision-clone @new_site @platform_name' => 'Clone the original site to the new site on a platform', + ), 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT ); $items['provision-delete'] = array( 'description' => 'Delete a site.', + 'examples' => array( + 'drush @site provision-delete' => 'Delete the site as defined by the site Drush alias generated with provision-save.', + ), 'bootstrap' => DRUSH_BOOTSTRAP_DRUSH ); $items['provision-login_reset'] = array( 'description' => 'Generate a one-time login reset URL.', + 'examples' => array( + 'drush @site provision-login-reset' => 'Generate a one-time login reset URL for the site as defined by the site Drush alias generated with provision-save.', + ), 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_ROOT ); $items['provision-backup_delete'] = array( 'description' => 'Delete a backup file.', 'arguments' => array('backup-file' => dt('The backup file to delete. This will be a gzipped tarball.')), + 'examples' => array( + 'drush @site provision-backup_delete /path/to/site_backup.tgz' => 'Delete a backup of this site as defined by the site Drush alias generated with provision-save.', + ), 'bootstrap' => DRUSH_BOOTSTRAP_DRUSH + ); $items['hostmaster-migrate'] = array( @@ -191,10 +233,24 @@ function provision_drush_command() { 'description' => dt('Install and verify the Hostmaster frontend.'), 'bootstrap' => DRUSH_BOOTSTRAP_DRUSH, 'arguments' => array( - 'example.com' => dt('The name of the site to install'), - '/path/to/platform' => dt('The platform to install the site on.'), - 'you@example.com' => dt('The email account to send a welcome mail to'), + 'example.com' => dt('The URL of the site to install, optional (default: %host).', array('%host' => provision_fqdn())), ), + 'options' => array + ( + 'http_service_type' => dt('Webserver type to configure (default: %webserver)', array('%webserver' => 'apache')), + 'drush_make_version' => dt('Drush make version to install, if not present (default: %drush_make', array('%drush_make' => '6.x-2.3')), + 'aegir_db_host' => dt('Database host to connect to (default: %host)', array('%host' => 'localhost')), + 'aegir_db_user' => dt('Database user to connect as (default: %user)', array('%user' => 'root')), + 'aegir_db_pass' => dt('Database password to use'), + 'client_email' => dt('Email of the first client to create in the frontend'), + 'client_name' => dt('Name of the first client to create in the frontend (default: %user)', array('%user' => 'admin')), + 'makefile' => dt('The makefile used to create the hostmaster platform (default: %makefile)', array('%makefile' => dirname(__FILE__). '/aegir.make')), + 'aegir_host' => dt('Fully qualified domain name of the local server (default: %fqdn)', array('%fqdn' => provision_fqdn())), + 'script_user' => dt('User to run the backend as (default: %user)', array('%user' => provision_current_user())), + 'web_group' => dt('Group the webserver is running as (default: %group)', array('%group' => _provision_default_web_group())), + 'version' => dt('The version of this released. (default: %version)', array('%version' => provision_version())), + 'aegir_root' => dt('Install aegir in this home directory (default: %home). Do not change unless you know what you are doing.', array('%home' => drush_server_home())), + ), ); $items['backend-parse'] = array( diff --git a/provision.info b/provision.info index 088a815ce35e513e9cbafa8ed757fe50a7fcbd9c..8866aa5d3e68c998f19ab159272200474154cbbf 100644 --- a/provision.info +++ b/provision.info @@ -1,4 +1,4 @@ name=Provision description="Aegir backend" -version=6.x-1.5 +version=6.x-1.6 diff --git a/upgrade.sh.txt b/upgrade.sh.txt index 4e31d3cb02f1a8a8efe7cf533b711f72d35c98d5..cdd14193af7af5163ba26884d24914bfe780ee2c 100644 --- a/upgrade.sh.txt +++ b/upgrade.sh.txt @@ -15,7 +15,7 @@ msg() { } # basic variables, change before running -AEGIR_VERSION="6.x-1.5" +AEGIR_VERSION="6.x-1.6" DRUSH_DIR=$HOME/drush DRUSH=$DRUSH_DIR/drush.php if which drush 2> /dev/null > /dev/null && which drush | grep -v 'no drush in' > /dev/null; then