Skip to content

Commit

Permalink
Add location addition, removal, and change of main location to the au…
Browse files Browse the repository at this point in the history
…dit log
  • Loading branch information
thiago2509 committed Feb 23, 2017
1 parent 79c8393 commit 1c3c5e1
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
23 changes: 22 additions & 1 deletion kernel/content/ezcontentoperationcollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,11 @@ static public function addAssignment( $nodeID, $objectID, $selectedNodeIDArray )
}
if ( $locationAdded )
{

eZAudit::writeAudit( 'location-assign', array( 'Main Node ID' => $object->attribute( 'main_node_id' ),
'Content object ID' => $object->attribute( 'id' ),
'Content object name' => $object->attribute( 'name' ),
'New Locations Parent Node ID Array' => implode( ', ' , $selectedNodeIDArray ),
'Comment' => 'Assigned new locations to the current node: eZContentOperationCollection::addAssignment()' ) );
//call appropriate method from search engine
eZSearch::addNodeAssignment( $nodeID, $objectID, $selectedNodeIDArray );

Expand Down Expand Up @@ -860,6 +864,13 @@ static public function removeNodes( array $removeNodeIdList )
}
}

eZAudit::writeAudit( 'location-remove', array( 'Removed Node ID' => $nodeId,
'Parent Node ID' => $node->attribute( 'parent_node_id' ),
'Content object ID' => $objectId,
'Content object name' => $node->attribute( 'name' ),
'Was main node' => ( $nodeId == $node->attribute( 'main_node_id' ) ? 'Yes' : 'No' )
) );

if ( $nodeId == $node->attribute( 'main_node_id' ) )
$mainNodeChanged[$objectId] = 1;
$node->removeThis();
Expand All @@ -877,6 +888,11 @@ static public function removeNodes( array $removeNodeIdList )
if ( isset( $allNodes[0] ) )
{
$mainNodeChanged[$objectId] = $allNodes[0];
eZAudit::writeAudit( 'main-node-update', array( 'Content object ID' => $objectId,
'New Main Node ID' => $allNodes[0]->attribute( 'node_id' ),
'New Parent Node ID' => $allNodes[0]->attribute( 'parent_node_id' ),
'Comment' => 'Updated the main location of the current object: eZContentOperationCollection::removeNodes()' )
);
eZContentObjectTreeNode::updateMainNodeID( $allNodes[0]->attribute( 'node_id' ), $objectId, false, $allNodes[0]->attribute( 'parent_node_id' ) );
}
}
Expand Down Expand Up @@ -1244,6 +1260,11 @@ static public function updatePriority( $parentNodeID, $priorityArray = array(),
*/
static public function updateMainAssignment( $mainAssignmentID, $ObjectID, $mainAssignmentParentID )
{
eZAudit::writeAudit( 'main-node-update', array( 'Content object ID' => $ObjectID,
'New Main Node ID' => $mainAssignmentID,
'New Parent Node ID' => $mainAssignmentParentID,
'Comment' => 'Updated the main location of the current object: eZContentOperationCollection::updateMainAssignment'
) );
eZContentObjectTreeNode::updateMainNodeID( $mainAssignmentID, $ObjectID, false, $mainAssignmentParentID );
eZContentCacheManager::clearContentCacheIfNeeded( $ObjectID );
eZContentOperationCollection::registerSearchObject( $ObjectID );
Expand Down
8 changes: 8 additions & 0 deletions settings/audit.ini
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,11 @@ AuditFileNames[section-assign]=section_assign.log
# Who deleted which order in shop (user / order id)
AuditFileNames[order-delete]=order_delete.log

# Who assigned new locations to a node
AuditFileNames[location-assign]=location_assign.log

# Who removed a location of a node
AuditFileNames[location-remove]=location_remove.log

# Who updated the main node
AuditFileNames[main-node-update]=location_main_update.log

0 comments on commit 1c3c5e1

Please sign in to comment.