Index: branches/RC/core/kernel/db/dbitem.php =================================================================== diff -u -N -r10294 -r10334 --- branches/RC/core/kernel/db/dbitem.php (.../dbitem.php) (revision 10294) +++ branches/RC/core/kernel/db/dbitem.php (.../dbitem.php) (revision 10334) @@ -982,10 +982,16 @@ } } + /** + * Determines, that changes made to this item should be written to change log + * + * @return bool + */ function ShouldLogChanges() { - /* @todo Replace true with global LogChanges option */ - return ($this->Application->getUnitOption($this->Prefix, 'LogChanges') || true) && !$this->Application->getUnitOption($this->Prefix, 'ForceDontLogChanges'); + $log_changes = $this->Application->getUnitOption($this->Prefix, 'LogChanges') || $this->Application->ConfigValue('UseChangeLog'); + + return $log_changes && !$this->Application->getUnitOption($this->Prefix, 'ForceDontLogChanges'); } function LogChanges($main_prefix, $mode) Index: branches/RC/core/units/admin/admin_events_handler.php =================================================================== diff -u -N -r10145 -r10334 --- branches/RC/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 10145) +++ branches/RC/core/units/admin/admin_events_handler.php (.../admin_events_handler.php) (revision 10334) @@ -32,7 +32,7 @@ 'OnRebuildThemes', 'OnCheckPrefixConfig', ); - if ($this->Application->isDebugMode() && in_array($event->Name, $system_events)) { + if ($this->Application->isDebugMode(false) && in_array($event->Name, $system_events)) { return true; } Index: branches/RC/core/kernel/utility/unit_config_reader.php =================================================================== diff -u -N -r10134 -r10334 --- branches/RC/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 10134) +++ branches/RC/core/kernel/utility/unit_config_reader.php (.../unit_config_reader.php) (revision 10334) @@ -235,8 +235,14 @@ // if (!$this->ProcessAllConfigs) return ; $this->FinalStage = true; foreach ($this->configData as $prefix => $config) { - if (in_array($prefix, $this->AfterConfigProcessed)) continue; - $this->Application->HandleEvent( new kEvent($prefix.':OnAfterConfigRead') ); + if (in_array($prefix, $this->AfterConfigProcessed)) { + continue; + } + + $event = new kEvent($prefix.':OnAfterConfigRead'); + $event->setEventParam('top_prefix', $this->Application->GetTopmostPrefix($event->Prefix, true)); + $this->Application->HandleEvent($event); + $this->AfterConfigProcessed[] = $prefix; } @@ -307,8 +313,14 @@ // call OnAfterConfigRead for cloned configs $new_clones = array_unique($new_clones); foreach ($new_clones as $prefix) { - if (in_array($prefix, $this->AfterConfigProcessed)) continue; - $this->Application->HandleEvent( new kEvent($prefix.':OnAfterConfigRead') ); + if (in_array($prefix, $this->AfterConfigProcessed)) { + continue; + } + + $event = new kEvent($prefix.':OnAfterConfigRead'); + $event->setEventParam('top_prefix', $this->Application->GetTopmostPrefix($event->Prefix, true)); + $this->Application->HandleEvent($event); + $this->AfterConfigProcessed[] = $prefix; } } @@ -653,7 +665,9 @@ array_unshift($clones, $prefix); $clones = array_unique($clones); foreach ($clones as $a_prefix) { - $this->Application->HandleEvent( new kEvent($a_prefix.':OnAfterConfigRead') ); + $event = new kEvent($a_prefix.':OnAfterConfigRead'); + $event->setEventParam('top_prefix', $this->Application->GetTopmostPrefix($event->Prefix, true)); + $this->Application->HandleEvent($event); } } } Index: branches/RC/core/kernel/application.php =================================================================== diff -u -N -r10274 -r10334 --- branches/RC/core/kernel/application.php (.../application.php) (revision 10274) +++ branches/RC/core/kernel/application.php (.../application.php) (revision 10334) @@ -2226,16 +2226,23 @@ * @access public * @author Kostja / Alex */ - function GetTopmostPrefix($current_prefix, $real_top=false) + function GetTopmostPrefix($current_prefix, $real_top = false) { // 1. get genealogical tree of $current_prefix $prefixes = Array ($current_prefix); while ( $parent_prefix = $this->getUnitOption($current_prefix, 'ParentPrefix') ) { + if (!$this->prefixRegistred($parent_prefix)) { + // stop searching, when parent prefix is not registered + break; + } + $current_prefix = $parent_prefix; array_unshift($prefixes, $current_prefix); } - if ($real_top) return $current_prefix; + if ($real_top) { + return $current_prefix; + } // 2. find what if parent is passed $passed = explode(',', $this->GetVar('all_passed'));