// We only care when there is a url callback and aliases are present.
  if (empty($entity->url_alias) || !isset($info['uri callback'])) {
    return FALSE;
  }

  $callback = $info['uri callback'];
  $uri = $callback($entity);
  $path = $uri['path'];

  // Delete existing aliases.
  path_delete(array('source' => $path));

If I create an alias, deploy, remove the alias and deploy again. The alias won't be removed from the destination server.
We can rearange the code so it will take in to account this situation.

  // We only care when there is a url callback and aliases are present.
  if (!isset($info['uri callback'])) {
    return FALSE;
  }

  $callback = $info['uri callback'];
  $uri = $callback($entity);
  $path = $uri['path'];

  // Delete existing aliases.
  path_delete(array('source' => $path));

 if (empty($entity->url_alias) {
   return FALSE;
 }

Comments

aspilicious’s picture

Status: Active » Closed (duplicate)