This is a utility function which cleans up the variable table, removing entries for node types which no longer exist, and then goes on to set all node types to have revisioning enabled. This code also has a line which disables the default of new nodes to be not Promoted to Front Page , although it is currently commented out. It displays information about what it has done. The first line, a comment, can be used in phpMyAdmin to show what the current settings are for each content type. It is my hope that someday this code might be used as a start for building a full blown module that shows and allows easy editing, and bulk modifications of all settings for all CCK/node types on a site.
function bulk_enable_cck_revisions() {
// select * from variable WHERE name LIKE 'node_options%' # sql to show status of all cck types, use this in phpMyAdmin or similar tool
// first, clean up any old data in the variable table that's not needed any longer.
$result = db_query("select name from variable WHERE name LIKE 'node_options%'"); # quick sql to show status of all cck types
while($name = db_result($result)){
$type = substr($name,13);
$count = db_result(db_query("SELECT COUNT(*) FROM node_type WHERE type = '%s'", $type));
if($count == 0){
drupal_set_message("$type no longer exists. Deleting node_option_$type from variable table");