subscriptions_taxonomy.install in Subscriptions 6
Same filename and directory in other branches
Subscriptions Taxonomy module installation.
File
subscriptions_taxonomy.installView source
<?php
/**
* @file
* Subscriptions Taxonomy module installation.
*/
/**
* Implementation of hook_install().
*/
function subscriptions_taxonomy_install() {
}
/**
* Database update function 2 (replaces update function 1!).
*
* Remove taxonomy subscriptions left over from deleted terms.
*/
function subscriptions_taxonomy_update_2() {
$result = db_query("SELECT s.value AS tid FROM {subscriptions_queue} s LEFT JOIN {term_data} t ON s.value = " . ($GLOBALS['db_type'] == 'pgsql' ? 'CAST(' : '') . "t.tid" . ($GLOBALS['db_type'] == 'pgsql' ? ' AS VARCHAR)' : '') . " WHERE s.module = 'node' AND s.field = 'tid' AND t.tid IS NULL");
while ($orphan = db_fetch_array($result)) {
$orphans[] = $orphan['tid'];
}
if (isset($orphans)) {
db_query("DELETE FROM {subscriptions_queue} WHERE module = 'node' AND field = 'tid' AND value IN (" . db_placeholders($orphans, 'varchar') . ")", $orphans);
$orphans = NULL;
}
$result = db_query("SELECT s.value AS tid FROM {subscriptions} s LEFT JOIN {term_data} t ON s.value = " . ($GLOBALS['db_type'] == 'pgsql' ? 'CAST(' : '') . "t.tid" . ($GLOBALS['db_type'] == 'pgsql' ? ' AS VARCHAR)' : '') . " WHERE s.module = 'node' AND s.field = 'tid' AND t.tid IS NULL");
while ($orphan = db_fetch_array($result)) {
$orphans[] = $orphan['tid'];
}
if (isset($orphans)) {
db_query("DELETE FROM {subscriptions} WHERE module = 'node' AND field = 'tid' AND value IN (" . db_placeholders($orphans, 'varchar') . ")", $orphans);
}
return array();
}
/**
* Implementation of hook_uninstall().
*/
function subscriptions_taxonomy_uninstall() {
}
Functions
Name | Description |
---|---|
subscriptions_taxonomy_install | Implementation of hook_install(). |
subscriptions_taxonomy_uninstall | Implementation of hook_uninstall(). |
subscriptions_taxonomy_update_2 | Database update function 2 (replaces update function 1!). |