public static function cleanupRemovedItems()
    {
        $db = eZDB::instance();
        // Find items that have been moved to trash or deleted
        $itemArray = array();
        $offset = 0;
        $limit = 50;
        do
        {
            $items = $db->arrayQuery( 'SELECT node_id FROM ezm_pool', array( 'offset' => $offset, 'limit' => $limit ) );
            if ( empty( $items ) )
                break;

            foreach( $items as $item )
            {
                $rows = $db->arrayQuery( 'SELECT node_id FROM ezcontentobject_tree WHERE node_id = ' . $item['node_id'] );
                if ( empty( $rows ) )
                    $itemArray[] = $item['node_id'];
            }

            $offset += $limit;
        } while ( true );

        // Remove them all from the flow
        $itemArrayCount = count( $itemArray );
        if ( $itemArrayCount > 0 )
        {
            $db->begin();
            $db->query( 'DELETE FROM ezm_pool WHERE ' . $db->generateSQLINStatement( $itemArray, 'node_id' ) );
            $db->commit();
        }

        return $itemArrayCount;
    }
public static function cleanupRemovedItems()
    {
        $db = eZDB::instance();
        // Find items that have been moved to trash or deleted
        $itemArray = array();
        $offset = 0;
        $limit = 50;
        do
        {
            $items = $db->arrayQuery( 'SELECT node_id FROM ezm_pool', array( 'offset' => $offset, 'limit' => $limit ) );
            if ( empty( $items ) )
                break;

            foreach( $items as $item )
            {
                $rows = $db->arrayQuery( 'SELECT node_id FROM ezcontentobject_tree WHERE node_id = ' . $item['node_id'] );
                if ( empty( $rows ) )
                    $itemArray[] = $item['node_id'];
            }

            $offset += $limit;
        } while ( true );

        // Remove them all from the flow
        $itemArrayCount = count( $itemArray );
        if ( $itemArrayCount > 0 )
        {
            $db->begin();
            $db->query( 'DELETE FROM ezm_pool WHERE ' . $db->generateSQLINStatement( $itemArray, 'node_id' ) );
            $db->commit();
        }

        return $itemArrayCount;
    }
public static function cleanupRemovedItems ( ) { $ db = eZDB :: instance ( ) ; // Find items that have been moved to trash or deleted $ itemArray = array ( ) ; $ offset = 0 ; $ limit = 50 ; do { $ items = $ db -> arrayQuery ( 'SELECT node_id FROM ezm_pool' , array ( 'offset' => $ offset , 'limit' => $ limit ) ) ; if ( empty ( $ items ) ) break ; foreach ( $ items as $ item ) { $ rows = $ db -> arrayQuery ( 'SELECT node_id FROM ezcontentobject_tree WHERE node_id = ' . $ item [ 'node_id' ] ) ; if ( empty ( $ rows ) ) $ itemArray [ ] = $ item [ 'node_id' ] ; } $ offset += $ limit ; } while ( true ) ; // Remove them all from the flow $ itemArrayCount = count ( $ itemArray ) ; if ( $ itemArrayCount > 0 ) { $ db -> begin ( ) ; $ db -> query ( 'DELETE FROM ezm_pool WHERE ' . $ db -> generateSQLINStatement ( $ itemArray , 'node_id' ) ) ; $ db -> commit ( ) ; } return $ itemArrayCount ; }
Clean up removed items from pool

@static
@return integer Number of removed items from pool
Clean up removed items from pool