Maintenance mode flag variable should be always 0 or 1 (not FALSE or TRUE)

Variable maintenance_mode originally has value 0 or 1. In update scripts, it has values FALSE or TRUE, which causes error with using Features module: after running Drupal update maintenance mode variable is always overridden and can't be reset back by Features.
Additional check added to the user_role_grant_permissions

Without this check module that use Features can fail to update permissions, as module can be disabled, but permissions exist in feature.
Minor fix: ensuring that $entity is object (for some weird reasons, sometimes it's not)
Minor fix: menu item weight sometimes can be undefined, causing warnings
Using vocabulary machine name instead of id to create permissions

Very important patch. WIthout it, for permissions will be used vocabulary id (vid), what will cause problems working with Features module
CDD.txt file added
Global $environment variable added to override $conf

Global $environment variable can be used in settings.php to override $conf (Drupal variables) values.