Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions bin/php/updatesearchindexsolr.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ protected function iterate( $count = false )
* @param int $nodeid
* @param int $offset
* @param int $limit
* @return int
*/
protected function forkAndExecute( $nodeID, $offset, $limit )
{
Expand All @@ -363,10 +364,34 @@ protected function forkAndExecute( $nodeID, $offset, $limit )
// Prepare DB-based cluster handler for fork (it will re-connect DB automatically).
eZClusterFileHandler::preFork();

$conns = false;
$ezpKernelContainer = ezpKernel::instance()->getServiceContainer();
if ( $ezpKernelContainer ) // in case we are in pure-legacy mode
{
$conns = $ezpKernelContainer->get('doctrine')->getConnections();
foreach( $conns as $name => $conn )
{
if ( $conn->isConnected() )
{
$conn->close();
}
else
{
unset( $conns[$name] );
}
}
}

$pid = pcntl_fork();

// reinitialize DB after fork
$this->initializeDB();
if ( $conns )
{
foreach( $conns as $conn ) {
$conn->connect();
}
}

if ( $pid == -1 )
{
Expand Down