Permalink
Browse files

EZP-29379: Option to skip search engine indexing inside eZContentOper…

…ationCollection::updateSection (#1381)

Followup for #1378 (0afc0ae)
  • Loading branch information...
mateuszbieniek authored and andrerom committed Aug 22, 2018
1 parent 6321a92 commit c9af39b5b3aff06f25c67fbf6ff7315a4c2fc19b
@@ -2796,7 +2796,7 @@ static function sortArrayBySortFieldAndSortOrder( $sortField, $sortOrder )
\note Transaction unsafe. If you call several transaction unsafe methods you must enclose
the calls within a db transaction; thus within db->begin and db->commit.
*/
static function assignSectionToSubTree( $nodeID, $sectionID, $oldSectionID = false )
static function assignSectionToSubTree( $nodeID, $sectionID, $oldSectionID = false, $updateSearchIndexes = true )
{
$db = eZDB::instance();
$node = eZContentObjectTreeNode::fetch( $nodeID );
@@ -2827,7 +2827,10 @@ static function assignSectionToSubTree( $nodeID, $sectionID, $oldSectionID = fal
foreach ( array_chunk( $objectSimpleIDArray, 100 ) as $pagedObjectIDs )
{
$db->query( "UPDATE ezcontentobject SET section_id='$sectionID' WHERE $filterPart " . $db->generateSQLINStatement( $pagedObjectIDs, 'id', false, true, 'int' ) );
eZSearch::updateObjectsSection( $pagedObjectIDs, $sectionID );
if ( $updateSearchIndexes )
{
eZSearch::updateObjectsSection( $pagedObjectIDs, $sectionID );
}
}
$db->commit();
@@ -240,7 +240,7 @@ public function applyTo( eZContentObject $object )
{
foreach ( $assignedNodes as $node )
{
eZContentOperationCollection::updateSection( $node->attribute( "node_id" ), $sectionID );
eZContentOperationCollection::updateSection( $node->attribute( "node_id" ), $sectionID, false );
}
}
}
@@ -1152,12 +1152,13 @@ static public function swapNode( $nodeID, $selectedNodeID, $nodeIdList = array()
*
* @param int $nodeID
* @param int $selectedSectionID
* @param bool $updateSearchIndexes
*
* @return array An array with operation status, always true
* @return void
*/
static public function updateSection( $nodeID, $selectedSectionID )
static public function updateSection( $nodeID, $selectedSectionID, $updateSearchIndexes = true )
{
eZContentObjectTreeNode::assignSectionToSubTree( $nodeID, $selectedSectionID );
eZContentObjectTreeNode::assignSectionToSubTree( $nodeID, $selectedSectionID, false, $updateSearchIndexes );
}
/**

0 comments on commit c9af39b

Please sign in to comment.