Index: kernel/db/cat_dbitem.php =================================================================== --- kernel/db/cat_dbitem.php (revision 15437) +++ kernel/db/cat_dbitem.php (working copy) @@ -84,18 +84,19 @@ * * @access public * @param int $id Primary Key Id to update + * @param Array $update_fields * @param bool $system_update * @return bool * @access public */ - public function Update($id = null, $system_update = false) + public function Update($id = null, $update_fields = null, $system_update = false) { if ( $this->useFilenames ) { $this->checkFilename(); $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 15446) +++ kernel/db/dbitem.php (working copy) @@ -661,11 +661,12 @@ * * @access public * @param int $id Primary Key Id to update + * @param Array $update_fields * @param bool $system_update * @return bool * @access public */ - public function Update($id = null, $system_update = false) + public function Update($id = null, $update_fields = null, $system_update = false) { if ( isset($id) ) { $this->setID($id); @@ -692,11 +693,15 @@ $sql = ''; - foreach ($this->FieldValues as $field_name => $field_value) { + $set_fields = isset($update_fields) ? $update_fields : array_keys($this->FieldValues); + + 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 @@ -726,7 +731,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->IsTempTable() ) { Index: units/images/image_event_handler.php =================================================================== --- units/images/image_event_handler.php (revision 15437) +++ units/images/image_event_handler.php (working copy) @@ -238,7 +238,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 15437) +++ units/users/users_item.php (working copy) @@ -121,13 +121,14 @@ * * @access public * @param int $id Primary Key Id to update + * @param Array $update_fields * @param bool $system_update * @return bool * @access public */ - public function Update($id = null, $system_update = false) + public 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 synchronize user only when it's copied to live table