summaryrefslogtreecommitdiff
path: root/includes/install.core.inc
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2012-12-08 19:10:21 -0500
committerDavid Rothstein <drothstein@gmail.com>2012-12-08 19:10:21 -0500
commit3ed0414d17e42753a8b5587c1225e3582cfe7bbd (patch)
tree18251f12ff16122b208c6b87025a95d04292cb0a /includes/install.core.inc
parentc7e45d937d6ac63b2f4fc5a44ce3567159f86052 (diff)
downloadbrdo-3ed0414d17e42753a8b5587c1225e3582cfe7bbd.tar.gz
brdo-3ed0414d17e42753a8b5587c1225e3582cfe7bbd.tar.bz2
Issue #1727430 by tedbow, webchick, fubhy | amontero: Added 'exclusive' flag to install profiles to auto-select them during installation.
Diffstat (limited to 'includes/install.core.inc')
-rw-r--r--includes/install.core.inc33
1 files changed, 32 insertions, 1 deletions
diff --git a/includes/install.core.inc b/includes/install.core.inc
index 9805e1c88..7a694e9bb 100644
--- a/includes/install.core.inc
+++ b/includes/install.core.inc
@@ -1041,7 +1041,21 @@ function install_select_profile(&$install_state) {
}
/**
- * Selects an installation profile from a list or from a $_POST submission.
+ * Selects an installation profile.
+ *
+ * A profile will be selected if:
+ * - Only one profile is available,
+ * - A profile was submitted through $_POST,
+ * - Exactly one of the profiles is marked as "exclusive".
+ * If multiple profiles are marked as "exclusive" then no profile will be
+ * selected.
+ *
+ * @param array $profiles
+ * An associative array of profiles with the machine-readable names as keys.
+ *
+ * @return
+ * The machine-readable name of the selected profile or NULL if no profile was
+ * selected.
*/
function _install_select_profile($profiles) {
if (sizeof($profiles) == 0) {
@@ -1061,6 +1075,23 @@ function _install_select_profile($profiles) {
}
}
}
+ // Check for a profile marked as "exclusive" and ensure that only one
+ // profile is marked as such.
+ $exclusive_profile = NULL;
+ foreach ($profiles as $profile) {
+ $profile_info = install_profile_info($profile->name);
+ if (!empty($profile_info['exclusive'])) {
+ if (empty($exclusive_profile)) {
+ $exclusive_profile = $profile->name;
+ }
+ else {
+ // We found a second "exclusive" profile. There's no way to choose
+ // between them, so we ignore the property.
+ return;
+ }
+ }
+ }
+ return $exclusive_profile;
}
/**