public static function next()
    {
        $queuedProcess = eZPersistentObject::fetchObjectList( eZPerfLoggerContentPublishingProcess::definition(),
            null,
            array( 'status' => ezpContentPublishingProcess::STATUS_PENDING ),
            array( 'created' => 'desc' ),
            array( 'offset' => 0, 'length' => 1 )
        );

        if ( count( $queuedProcess ) == 0 )
            return false;
        else
        {
            // check if another instance is being published of the same object
            $db = eZDB::instance();
            $processing = $db->arrayQuery( "SELECT count(*) AS other" .
                "FROM ezpublishingqueueprocesses p, ezcontentobject_version v " .
                "WHERE p.ezcontentobject_version_id = v.id AND p.status = 1 AND v.contentobject_id IN ( " .
                "SELECT contentobject_id FROM ezcontentobject_version v2 WHERE id = " . $queuedProcess[0]->attribute('ezcontentobject_version_id') . " )"
            );
            if ( $processing[0]['other'] )
            {
                return false;
            }
            return $queuedProcess[0];
        }
    }