function _node_revision_delete_update_time_max_number_config in Node Revision Delete 7.3
Update the max_number for a config name.
We need to update the max_number in the existing content type configuration if the new value (max_number) is lower than the actual, in this case the new value will be the value for the content type.
Parameters
string $config_name: Config name to update.
int $max_number: The maximum number for $config_name parameter.
3 calls to _node_revision_delete_update_time_max_number_config()
- drush_node_revision_delete_nrd_minimum_age_to_delete_time in ./
node_revision_delete.drush.inc - Callback for the nrd-minimum-age-to-delete-time command.
- drush_node_revision_delete_nrd_when_to_delete_time in ./
node_revision_delete.drush.inc - Callback for the nrd-when-to-delete-time command.
- node_revision_delete_admin_settings_form_submit in ./
node_revision_delete.admin.inc - Form submit handler for the Node Revision Delete administration form.
File
- ./
node_revision_delete.helpers.inc, line 141 - Helper functions.
Code
function _node_revision_delete_update_time_max_number_config($config_name, $max_number) {
$node_revision_delete_track = variable_get('node_revision_delete_track', array());
$changed = FALSE;
// Checking the when_to_delete value for all the configured content types.
foreach ($node_revision_delete_track as $content_type => $content_type_info) {
// If the new defined max_number is smaller than the defined when_to_delete
// value in the config, we need to change the stored config value.
if ($max_number < $content_type_info[$config_name]) {
$node_revision_delete_track[$content_type][$config_name] = $max_number;
$changed = TRUE;
}
}
// Saving only if we have changes.
if ($changed) {
// Saving the values in the config.
variable_set('node_revision_delete_track', $node_revision_delete_track);
}
}