node_revision_delete.install in Node Revision Delete 7.2
Same filename and directory in other branches
Install, update and uninstall functions for the Node Revision module.
File
node_revision_delete.installView source
<?php
/**
* @file
* Install, update and uninstall functions for the Node Revision module.
*/
/**
* Implements hook_install().
*/
function node_revision_delete_install() {
variable_set('node_revision_delete_time', 0);
variable_set('node_revision_delete_last_execute', 0);
}
/**
* Implements hook_uninstall().
*/
function node_revision_delete_uninstall() {
variable_del('node_revision_delete_time');
variable_del('node_revision_delete_last_execute');
variable_del('node_revision_delete_cron');
// Searching the content type machine name.
$results = db_query("SELECT SUBSTR(name, 28) as name\n FROM {variable}\n WHERE name LIKE 'node_revision_delete_track_%'");
// Deleting the variables.
foreach ($results as $result) {
variable_del('node_revision_delete_track_' . $result->name);
variable_del('node_revision_delete_number_' . $result->name);
}
}
/**
* Sets max amount of revisions per content type.
*/
function node_revision_delete_update_7200() {
// If content types were selected, set the global max to each of them.
$content_types = variable_get('node_revision_delete_content_type', '');
if (!empty($content_types)) {
$content_types = explode(',', $content_types);
$max = variable_get('node_revision_delete_number');
if ($max) {
foreach ($content_types as $type) {
variable_set('node_revision_delete_track_' . $type, 1);
variable_set('node_revision_delete_number_' . $type, $max);
}
}
}
variable_del('node_revision_delete_number');
variable_del('node_revision_delete_content_type');
}
/**
* Removes node_revision_delete_time if its values is 0.
*
* It was matching a wrong condition in a switch at hook_cron.
*/
function node_revision_delete_update_7201() {
if (variable_get('node_revision_delete_time') == 0) {
variable_del('node_revision_delete_time');
}
}
Functions
Name![]() |
Description |
---|---|
node_revision_delete_install | Implements hook_install(). |
node_revision_delete_uninstall | Implements hook_uninstall(). |
node_revision_delete_update_7200 | Sets max amount of revisions per content type. |
node_revision_delete_update_7201 | Removes node_revision_delete_time if its values is 0. |