You are here

function pathauto_path_delete_all in Pathauto 7

Same name and namespace in other branches
  1. 6.2 pathauto.module \pathauto_path_delete_all()

Delete an URL alias and any of its sub-paths.

Given a source like 'node/1' this function will delete any alias that have that specific source or any sources that match 'node/1/%'.

Parameters

$source: An string with a source URL path.

4 calls to pathauto_path_delete_all()
PathautoUnitTestCase::testPathDeleteMultiple in ./pathauto.test
Test pathauto_path_delete_multiple().
pathauto_blog_update_alias in ./pathauto.module
Update the blog URL aliases for an individual user account.
pathauto_entity_path_delete_all in ./pathauto.module
Delete an entity URL alias and any of its sub-paths.
pathauto_user_delete in ./pathauto.module
Implements hook_user_delete().

File

./pathauto.module, line 180
Main file for the Pathauto module, which automatically generates aliases for content.

Code

function pathauto_path_delete_all($source) {
  $sql = "SELECT pid FROM {url_alias} WHERE source = :source OR source LIKE :source_wildcard";
  $pids = db_query($sql, array(
    ':source' => $source,
    ':source_wildcard' => $source . '/%',
  ))
    ->fetchCol();
  if ($pids) {
    pathauto_path_delete_multiple($pids);
  }
}