function _pathauto_alias_exists in Pathauto 5.2
Same name and namespace in other branches
- 5 pathauto.module \_pathauto_alias_exists()
- 6.2 pathauto.inc \_pathauto_alias_exists()
- 6 pathauto.inc \_pathauto_alias_exists()
- 7 pathauto.inc \_pathauto_alias_exists()
Check to see if there is already an alias pointing to a different item.
Parameters
$alias: A string alias (i.e. dst).
$src: A string that is the internal path.
Return value
TRUE if an alias exists, FALSE if not.
1 call to _pathauto_alias_exists()
- pathauto_create_alias in ./
pathauto.inc - Apply patterns to create an alias.
File
- ./
pathauto.inc, line 64 - Miscellaneous functions for Pathauto.
Code
function _pathauto_alias_exists($alias, $src) {
$alias_pid = db_result(db_query("SELECT pid FROM {url_alias} WHERE dst = '%s' AND src <> '%s'", $alias, $src, 0, 1));
if (function_exists('path_redirect_delete')) {
// Delete from path_redirect the exact same alias to the same node.
path_redirect_delete($alias, $src);
// If there still is this alias used in path_redirect, then create a different alias
$redirect_rid = db_result(db_query_range("SELECT rid FROM {path_redirect} WHERE path = '%s'", $alias, 0, 1));
}
if ($alias_pid || !empty($redirect_rid)) {
return TRUE;
}
else {
return FALSE;
}
}