Called from ecrire/genie/optimiser.php, this pipeline is used to supplement the cleaning operations for orphaned items, by deleting such items during standard periodic task scheduling.

$n = pipeline('optimiser_base_disparus', array(
			'attente' => $attente,
			'date' => $mydate),

As parameters, it receives the expected inter-operation delay (attente) as well as the corresponding expiry date. The "data" argument array stores the number of items deleted. The optimiser_sansref() function is used to manage the deletion of the records by providing 3 argument parameters:

  • the table,
  • the primary key,
  • an SQL query result containing only an "id" column listing the identifiers targeted for deletion.


To delete forums that belong to an obsoleted section, the "Forum" plug uses this pipeline as shown below:

function forum_optimiser_base_disparus($flux){
    $n = &$flux['data'];

    # forums linked to a non-existent id_rubrique (section)
    $res = sql_select("forum.id_forum AS id",
            "spip_forum AS forum
                LEFT JOIN spip_rubriques AS rubriques
                  ON forum.id_rubrique=rubriques.id_rubrique",
            "rubriques.id_rubrique IS NULL
                 AND forum.id_rubrique>0");

    $n+= optimiser_sansref('spip_forum', 'id_forum', $res);

    // [...]

    return $flux;

Author Mark Baber Published : Updated : 12/03/23

Translations : English, français