* which might vary per the value of $do_parse
* as well as if the plugin requires a SquirrelMail
* core plugin, in which case it is "CORE" or
- * "CORE:1.5.2" or similar), 'activate' - value is
- * boolean: TRUE indicates that the plugin must
- * also be activated, FALSE means that it only
- * needs to be present, but does not need to be
- * activated. Note that the return value might
- * be an empty array, indicating that the plugin
- * has no dependencies.
+ * "CORE:1.5.2" or similar, or, if the plugin is
+ * actually incompatible (not required) with this
+ * one, the constant SQ_INCOMPATIBLE will be found
+ * here), 'activate' - value is boolean: TRUE
+ * indicates that the plugin must also be activated,
+ * FALSE means that it only needs to be present,
+ * but does not need to be activated. Note that
+ * the return value might be an empty array,
+ * indicating that the plugin has no dependencies.
*
*/
function get_plugin_dependencies($plugin_name, $force_inclusion = FALSE,
// parse version into something we understand?
//
- if ($do_parse)
+ if ($do_parse && $plugin_requirements['version'] != SQ_INCOMPATIBLE)
{
// massage version number into something we understand
* corresponding values) will be available:
* 'version' - value is the minimum version
* required for that plugin (in printable, non-
- * parsed format), 'activate' - value is boolean:
- * TRUE indicates that the plugin must also be
- * activated, FALSE means that it only needs to
- * be present, but does not need to be activated.
+ * parsed format) or the constant SQ_INCOMPATIBLE,
+ * which indicates that the plugin is actually
+ * incompatible (not required), 'activate' - value
+ * is boolean: TRUE indicates that the plugin must
+ * also be activated, FALSE means that it only needs
+ * to be present, but does not need to be activated.
*
*/
function check_plugin_dependencies($plugin_name, $force_inclusion = FALSE)
}
+ // if the plugin is actually incompatible; check that it
+ // is not activated
+ //
+ if ($depend_requirements['version'] == SQ_INCOMPATIBLE)
+ {
+
+ if (is_plugin_enabled($depend_name))
+ $missing_or_bad[$depend_name] = $depend_requirements;
+
+ continue;
+
+ }
+
// check for normal plugins
//
$version = explode('.', $depend_requirements['version'], 3);
}
else if (is_array($failed_dependencies)) {
$missing_plugins = '';
+ $incompatible_plugins = '';
foreach ($failed_dependencies as $depend_name => $depend_requirements) {
- $missing_plugins .= ', ' . $depend_name . ' (version ' . $depend_requirements['version'] . ', ' . ($depend_requirements['activate'] ? 'must be activated' : 'need not be activated') . ')';
+ if ($depend_requirements['version'] == SQ_INCOMPATIBLE)
+ $incompatible_plugins .= ', ' . $depend_name;
+ else
+ $missing_plugins .= ', ' . $depend_name . ' (version ' . $depend_requirements['version'] . ', ' . ($depend_requirements['activate'] ? 'must be activated' : 'need not be activated') . ')';
}
- do_err($name . ' is missing some dependencies: ' . trim($missing_plugins, ', '), FALSE);
+ $error_string = (!empty($incompatible_plugins) ? $name . ' cannot be activated at the same time as the following plugins: ' . trim($incompatible_plugins, ', ') : '')
+ . (!empty($missing_plugins) ? (!empty($incompatible_plugins) ? '. ' . $name . ' is also ' : $name . ' is ') . 'missing some dependencies: ' . trim($missing_plugins, ', ') : '');
+ do_err($error_string, FALSE);
}
}