You are here

function apps_app_find_conflicts in Apps 7

Find the apps that this app is in conflict with.

Apps can conflict with any app on any server, so calculate the conflict information as needed.

Parameters

$app: The fully loaded app array as from app_app_load().

Return value

an array of arrays with keys 'server' and 'name'.

3 calls to apps_app_find_conflicts()
apps_app_access in ./apps.module
Access callback for the operations that can be performed on an app.
apps_preprocess_apps_app_page in theme/apps.theme.inc
Implements hook_preprocess_apps_app_page().
apps_preprocess_apps_catalog_page in theme/apps.theme.inc
Implements hook_preprocess_apps_update_page().

File

./apps.module, line 371
Module file for Apps

Code

function apps_app_find_conflicts($app) {
  if ($conflict_cache = cache_get('apps_app_conflicts_' . $app['machine_name'])) {
    return $conflict_cache->data;
  }
  $conflicts = $app['conflicts'];
  foreach (array_keys(apps_servers()) as $server_name) {
    if ($apps = apps_apps($server_name)) {
      foreach ($apps as $app_name => $app_info) {
        foreach ($app_info['conflicts'] as $conflict_key => $conflict_info) {
          if ($conflict_info['server'] == $app['server']['name'] && $conflict_info['name'] == $app['machine_name']) {
            $conflicts[] = array(
              'name' => $app_name,
              'server' => $app_info['server']['name'],
            );
          }
        }
      }
    }
  }
  cache_set('apps_app_conflicts_' . $app['machine_name'], $conflicts);
  return $conflicts;
}