Index: kernel/db/cat_dbitem.php =================================================================== --- kernel/db/cat_dbitem.php (revision 15331) +++ kernel/db/cat_dbitem.php (working copy) @@ -83,7 +83,7 @@ $this->assignToCategory($this->GetDBField('CategoryId'), true); } - function Update($id=null, $system_update=false) + function Update($id = null, $update_fields = null, $system_update = false) { $this->VirtualFields['ResourceId'] = Array(); @@ -99,7 +99,7 @@ $this->generateFilename(); } - $ret = parent::Update($id, $system_update); + $ret = parent::Update($id, $update_fields, $system_update); if ($ret) { $filename = $this->useFilenames ? (string)$this->GetDBField('Filename') : ''; Index: kernel/db/dbitem.php =================================================================== --- kernel/db/dbitem.php (revision 15331) +++ kernel/db/dbitem.php (working copy) @@ -528,9 +528,10 @@ * * @access public * @param int Primery Key Id to update + * @param bool $system_update * @return bool */ - function Update($id = null, $system_update = false) + function Update($id = null, $update_fields = null, $system_update = false) { if (isset($id)) { $this->setID($id); @@ -556,12 +557,15 @@ } $sql = ''; + $set_fields = isset($update_fields) ? $update_fields : array_keys($this->FieldValues); - foreach ($this->FieldValues as $field_name => $field_value) { + foreach ($set_fields as $field_name) { if ($this->skipField($field_name)) { continue; } + $field_value = $this->FieldValues[$field_name]; + if ( is_null($field_value) ) { if (array_key_exists('not_null', $this->Fields[$field_name]) && $this->Fields[$field_name]['not_null']) { // "kFormatter::Parse" methods converts empty values to NULL and for @@ -590,7 +594,16 @@ $this->saveCustomFields(); $this->raiseEvent('OnAfterItemUpdate'); - $this->OriginalFieldValues = $this->FieldValues; + + if ( !isset($update_fields) ) { + $this->OriginalFieldValues = $this->FieldValues; + } + else { + foreach ($update_fields as $update_field) { + $this->OriginalFieldValues[$update_field] = $this->FieldValues[$update_field]; + } + } + $this->Loaded = true; if ($this->mode != 't') { Index: units/images/image_event_handler.php =================================================================== --- units/images/image_event_handler.php (revision 15331) +++ units/images/image_event_handler.php (working copy) @@ -169,7 +169,7 @@ } } if ( in_array($event->Name, Array('OnAfterClone', 'OnBeforeCopyToLive', 'OnAfterCopyToTemp')) ) { - $object->Update(null, true); + $object->Update(null, null, true); } } Index: units/users/users_item.php =================================================================== --- units/users/users_item.php (revision 15331) +++ units/users/users_item.php (working copy) @@ -92,9 +92,9 @@ } - function Update($id=null, $system_update=false) + function Update($id = null, $update_fields = null, $system_update = false) { - $ret = parent::Update($id, $system_update); + $ret = parent::Update($id, $update_fields, $system_update); if ($ret) { // find out how to syncronize user only when it's copied to live table $sync_manager =& $this->Application->recallObjectP('UsersSyncronizeManager', null, Array(), 'InPortalSyncronize');