Projet

Général

Profil

Révision 73a44071

Ajouté par Assos Assos il y a plus de 8 ans

Weekly update of contrib modules

Voir les différences:

drupal7/sites/all/modules/uuid/uuid_services/uuid_services.module
158 158
 */
159 159
function _uuid_services_entity_delete($entity_type, $uuid) {
160 160
  try {
161
    $return = entity_uuid_delete($entity_type, array($uuid));
161
    $uuid_exist = (bool) entity_get_id_by_uuid($entity_type, array($uuid));
162
    if (!$uuid_exist) {
163
      /* UUID not found. Don't try to delete something that doesn't exist. */
164
      $args = array('@uuid' => $uuid, '@type' => $entity_type);
165
      watchdog('uuid_services', 'UUID @uuid not found for entity type @type', $args, WATCHDOG_WARNING);
166
      return TRUE;
167
    }
168

  
169
    $return = entity_uuid_delete($entity_type, array($uuid)) !== FALSE;
162 170
    return $return;
163 171
  }
164 172
  catch (Exception $exception) {
......
208 216
    if ($op == 'update' && empty($entity_ids)) {
209 217
      $op = 'create';
210 218
    }
211
    // Taxonomy and Comment module uses 'edit' instead of 'update'.
212
    // Oh, how I love Drupal consistency.
213
    if (($entity_type == 'taxonomy_term' || $entity_type == 'comment') && $op == 'update') {
214
      $op = 'edit';
219
    // If the user doesn't exist return 406 like services does.
220
    if (($entity_type == 'user' && empty($entity) && $op == 'view')) {
221
      return services_error(t('There is no user with UUID @uuid.', array('@uuid' => $args[1])), 406);;
215 222
    }
216 223
    // The following code is taken from entity_access() with some extra logic
217 224
    // to handle the case where an entity type is not defining an access
......
227 234
    return services_error($exception, 406, $entity_type);
228 235
  }
229 236
}
230

  
231
/**
232
 * Implements hook_services_resources().
233
 */
234
function uuid_services_services_resources() {
235
  module_load_include('inc', 'uuid_services', 'resources/field_collection.resource');
236

  
237
  $resources = array(
238
    '#api_version' => 3002,
239
  );
240

  
241
  $resources += _field_collection_resource_definition();
242

  
243
  return $resources;
244
}

Formats disponibles : Unified diff