Changeset 113030 in spip-zone


Ignore:
Timestamp:
Dec 21, 2018, 10:14:50 AM (4 weeks ago)
Author:
cedric@…
Message:

il faut exclure des zombies ceux a qui on a fait aucun envoi car on ne sait pas

File:
1 edited

Legend:

Unmodified
Added
Removed
  • _plugins_/mailsubscribers/trunk/spip-cli/MailsubscribinglistClean.php

    r113028 r113030  
    9393
    9494                // trouver tous les zombies
    95                 $id_mailsubscribers_zombies = sql_allfetsel('id_mailsubscriber', 'spip_mailsubscribers', "statut='valide' AND " . sql_in('id_mailsubscriber', $id_mailsubscribers_alive, 'NOT'));
    96                 $id_mailsubscribers_zombies = array_column($id_mailsubscribers_zombies, 'id_mailsubscriber');
     95                $zombies = sql_allfetsel('id_mailsubscriber, email', 'spip_mailsubscribers', "statut='valide' AND " . sql_in('id_mailsubscriber', $id_mailsubscribers_alive, 'NOT'));
     96                $id_mailsubscribers_zombies = array_column($zombies, 'id_mailsubscriber');
     97
     98                // ceux a qui on a rien envoye depuis from ne sont pas des vrais zombies mais surement des nouveaux inscrits, on les enleve donc
     99                $email_zombies = array_column($zombies, 'email');
     100                $email_vrai_zombies = sql_allfetsel('distinct email', 'spip_mailshots_destinataires', sql_in('statut', array('todo', 'fail'), 'NOT') . ' AND ' .sql_in('email', $email_zombies) . ' AND date>' . sql_quote($from));
     101                $email_vrai_zombies = array_column($email_vrai_zombies, 'email');
     102                $zombies = sql_allfetsel('id_mailsubscriber, email', 'spip_mailsubscribers', "statut='valide' AND " . sql_in('email', $email_vrai_zombies));
     103                $id_mailsubscribers_zombies = array_column($zombies, 'id_mailsubscriber');
     104
     105
    97106                $output->writeln("Mailsubscribers zombies depuis $from : " . count($id_mailsubscribers_zombies));
    98107
Note: See TracChangeset for help on using the changeset viewer.