Skip to content

Instantly share code, notes, and snippets.

@heddn
Created March 12, 2014 14:48
Show Gist options
  • Select an option

  • Save heddn/9508436 to your computer and use it in GitHub Desktop.

Select an option

Save heddn/9508436 to your computer and use it in GitHub Desktop.
/**
* Removes group_2 content.
*/
function pfizer_pro_tikosyn_education_update_7001() {
$query = db_select('url_alias', 'a')
->fields('a', array('source'))
->condition('alias', 'hcp/tikosyn_education%', 'LIKE');
$result = $query->execute()->fetchCol();
// The result set from url_alias includes 'node/123'. We need to remove node/.
node_delete_multiple(array_map(function ($value) { return substr($value, 5); }, $result));
$query = db_select('node', 'n')
->fields('n', array('nid'))
->condition('title', '/tikosyn_education%', 'LIKE');
$result = $query->execute()->fetchCol();
node_delete_multiple($result);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment