MDL-56830 config_log: Add block plugin visibility changes to config_log.
authorGrzegorz Ziółek <grzesiekz@gmail.com>
Tue, 6 Dec 2016 10:29:02 +0000 (11:29 +0100)
committerGrzegorz Ziółek <grzesiekz@gmail.com>
Tue, 6 Dec 2016 10:29:02 +0000 (11:29 +0100)
admin/blocks.php
lib/blocklib.php

index b31da9e..f3faf4d 100644 (file)
@@ -37,6 +37,7 @@
             print_error('blockdoesnotexist', 'error');
         }
         $DB->set_field('block', 'visible', '0', array('id'=>$block->id));      // Hide block
             print_error('blockdoesnotexist', 'error');
         }
         $DB->set_field('block', 'visible', '0', array('id'=>$block->id));      // Hide block
+        add_to_config_log('block_visibility', $block->visible, '0', $block->name);
         core_plugin_manager::reset_caches();
         admin_get_root(true, false);  // settings not required - only pages
     }
         core_plugin_manager::reset_caches();
         admin_get_root(true, false);  // settings not required - only pages
     }
@@ -46,6 +47,7 @@
             print_error('blockdoesnotexist', 'error');
         }
         $DB->set_field('block', 'visible', '1', array('id'=>$block->id));      // Show block
             print_error('blockdoesnotexist', 'error');
         }
         $DB->set_field('block', 'visible', '1', array('id'=>$block->id));      // Show block
+        add_to_config_log('block_visibility', $block->visible, '1', $block->name);
         core_plugin_manager::reset_caches();
         admin_get_root(true, false);  // settings not required - only pages
     }
         core_plugin_manager::reset_caches();
         admin_get_root(true, false);  // settings not required - only pages
     }
index 2baca98..e01a08f 100644 (file)
@@ -423,6 +423,7 @@ class block_manager {
         if (!in_array($block->name, $undeletableblocktypes)) {
             $undeletableblocktypes[] = $block->name;
             set_config('undeletableblocktypes', implode(',', $undeletableblocktypes));
         if (!in_array($block->name, $undeletableblocktypes)) {
             $undeletableblocktypes[] = $block->name;
             set_config('undeletableblocktypes', implode(',', $undeletableblocktypes));
+            add_to_config_log('block_protect', "0", "1", $block->name);
         }
     }
 
         }
     }
 
@@ -448,6 +449,7 @@ class block_manager {
         if (in_array($block->name, $undeletableblocktypes)) {
             $undeletableblocktypes = array_diff($undeletableblocktypes, array($block->name));
             set_config('undeletableblocktypes', implode(',', $undeletableblocktypes));
         if (in_array($block->name, $undeletableblocktypes)) {
             $undeletableblocktypes = array_diff($undeletableblocktypes, array($block->name));
             set_config('undeletableblocktypes', implode(',', $undeletableblocktypes));
+            add_to_config_log('block_protect', "1", "0", $block->name);
         }
 
     }
         }
 
     }