summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
authorDavid Rothstein <drothstein@gmail.com>2015-10-10 13:26:16 -0400
committerDavid Rothstein <drothstein@gmail.com>2015-10-10 13:26:16 -0400
commitc60d7b098a9db9abd9a8de3b6f125df3a2bfda24 (patch)
tree31e502258c9991500f338ffecfec39ad274572e4 /includes
parent56bbd4ba0165c8c8f902ee6ebde66a4d5fdfb1a0 (diff)
downloadbrdo-c60d7b098a9db9abd9a8de3b6f125df3a2bfda24.tar.gz
brdo-c60d7b098a9db9abd9a8de3b6f125df3a2bfda24.tar.bz2
Issue #2205271 by trobey, jhedstrom, hass, alexpott, chx, joachim, jhodgdon: Add an optional project namespace for dependencies
Diffstat (limited to 'includes')
-rw-r--r--includes/common.inc25
1 files changed, 22 insertions, 3 deletions
diff --git a/includes/common.inc b/includes/common.inc
index ef71ee8b6..acef70afb 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -7368,7 +7368,16 @@ function drupal_write_record($table, &$record, $primary_keys = array()) {
* Information stored in a module .info file:
* - name: The real name of the module for display purposes.
* - description: A brief description of the module.
- * - dependencies: An array of shortnames of other modules this module requires.
+ * - dependencies: An array of dependency strings. Each is in the form
+ * 'project:module (versions)'; with the following meanings:
+ * - project: (optional) Project shortname, recommended to ensure uniqueness,
+ * if the module is part of a project hosted on drupal.org. If omitted,
+ * also omit the : that follows. The project name is currently ignored by
+ * Drupal core but is used for automated testing.
+ * - module: (required) Module shortname within the project.
+ * - (versions): Optional version information, consisting of one or more
+ * comma-separated operator/value pairs or simply version numbers, which
+ * can contain "x" as a wildcard. Examples: (>=7.22, <7.28), (7.x-3.x).
* - package: The name of the package of modules this module belongs to.
*
* See forum.info for an example of a module .info file.
@@ -7653,7 +7662,12 @@ function debug($data, $label = NULL, $print_r = FALSE) {
* Parses a dependency for comparison by drupal_check_incompatibility().
*
* @param $dependency
- * A dependency string, for example 'foo (>=7.x-4.5-beta5, 3.x)'.
+ * A dependency string, which specifies a module dependency, and optionally
+ * the project it comes from and versions that are supported. Supported
+ * formats include:
+ * - 'module'
+ * - 'project:module'
+ * - 'project:module (>=version, version)'
*
* @return
* An associative array with three keys:
@@ -7668,6 +7682,12 @@ function debug($data, $label = NULL, $print_r = FALSE) {
* @see drupal_check_incompatibility()
*/
function drupal_parse_dependency($dependency) {
+ $value = array();
+ // Split out the optional project name.
+ if (strpos($dependency, ':')) {
+ list($project_name, $dependency) = explode(':', $dependency);
+ $value['project'] = $project_name;
+ }
// We use named subpatterns and support every op that version_compare
// supports. Also, op is optional and defaults to equals.
$p_op = '(?P<operation>!=|==|=|<|<=|>|>=|<>)?';
@@ -7676,7 +7696,6 @@ function drupal_parse_dependency($dependency) {
$p_major = '(?P<major>\d+)';
// By setting the minor version to x, branches can be matched.
$p_minor = '(?P<minor>(?:\d+|x)(?:-[A-Za-z]+\d+)?)';
- $value = array();
$parts = explode('(', $dependency, 2);
$value['name'] = trim($parts[0]);
if (isset($parts[1])) {