function _calendar_systems_patches_pm_delete in Calendar Systems 6.2
Internal helper to remove a patch_manager.module patch record.
Parameters
$patches: Optional array of patches to get un-introduced!
See also
http://drupal.org/project/patch_manager
2 calls to _calendar_systems_patches_pm_delete()
- calendar_systems_uninstall in ./
calendar_systems.install - Implements hook_uninstall().
- _calendar_systems_patches_pm_insert in ./
calendar_systems.patch.inc - Internal helper to create patch records for the lazy patch_manager project.
File
- ./
calendar_systems.patch.inc, line 247 - A collection of internal helpers around the compatibility patches.
Code
function _calendar_systems_patches_pm_delete($patches = FALSE) {
if (module_exists('patch_manager')) {
// Get all available patches, if not passed.
if (!$patches) {
$patches = _calendar_systems_patches();
}
// Delete all corresponding "patch" typed nodes.
foreach ($patches as $identifier => $patch) {
// Remember that we copied the patch into files directory.
$path = file_directory_path() . '/' . $patch['name'];
$query = "SELECT ctp.nid\n FROM {files} f\n LEFT JOIN {content_type_patch} ctp ON f.fid = ctp.field_patch_fid\n WHERE f.filepath = '%s'";
// Delete patch's corresponding node, if any.
if ($nid = db_result(db_query($query, $path))) {
node_delete($nid);
}
}
}
}