Skip to content

Instantly share code, notes, and snippets.

@pratik60
Last active August 29, 2015 14:13
Show Gist options
  • Save pratik60/8b400b46f303aa19b339 to your computer and use it in GitHub Desktop.
Save pratik60/8b400b46f303aa19b339 to your computer and use it in GitHub Desktop.
Litmus Test
$lang = language_default('language');
$rows = db_query("select * from url_alias where source like '%taxonomy%'")->fetchAll();
$tids = db_select("taxonomy_term_data", "ttd")
->fields("ttd", array("tid", "language"))
->condition("ttd.language",$lang)->execute()->fetchAllKeyed();
$bads = array('-0','-1','-2','-3','/' . $lang);
foreach ($rows as $row) {
$flag = 1;
foreach($bads as $bad) {
$tid = explode('/',$row->source);
if (strpos($row->alias,$bad) !== false && $flag==1) {
dsm($row->alias);
$flag = 0;
}
else if ($tids[$tid[2]]=='ko' && strpos($row->alias,$lang) !== false && $flag==1) {
dsm('DEFINITE ' . $row->alias);
$flag = 0;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment