You are here

function pathauto_path_delete_all in Pathauto 6.2

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

Delete an URL alias and any 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.

See also

path_set_alias()

5 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_nodeapi in ./pathauto.module
Implements hook_nodeapi().
pathauto_taxonomy in ./pathauto.module
Implements hook_taxonomy().
pathauto_user in ./pathauto.module
Implements hook_user().

File

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

Code

function pathauto_path_delete_all($source) {
  $source = urldecode($source);

  // Delete the source path.
  db_query("DELETE FROM {url_alias} WHERE src = '%s'", $source);

  // Delete any sub-paths.
  db_query("DELETE FROM {url_alias} WHERE src LIKE '%s'", $source . '/%%');
  drupal_clear_path_cache();
}