1 path.module path_delete_all_by_source($source)

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 system path.

File

core/modules/path/path.module, line 739
Enables users to customize URLs and provide automatic URL alias patterns.

Code

function path_delete_all_by_source($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) {
    path_delete_multiple($pids);
  }
}