# HG changeset patch # User cavaliet # Date 1396442116 -7200 # Node ID d48100e2feadf493b375b3ee21bea41e3bdaf05f # Parent 6fd1ff31882585c5beeff1b2885a32b53518f326 enhance fr.dbpedia migration for production diff -r 6fd1ff318825 -r d48100e2fead DoctrineMigrations/Version20140129151724.php --- a/DoctrineMigrations/Version20140129151724.php Tue Feb 04 11:23:12 2014 +0100 +++ b/DoctrineMigrations/Version20140129151724.php Wed Apr 02 14:35:16 2014 +0200 @@ -4,7 +4,8 @@ use Doctrine\DBAL\Migrations\AbstractMigration, Doctrine\DBAL\Schema\Schema, - IRI\Bundle\WikiTagBundle\Utils\WikiTagUtils; + IRI\Bundle\WikiTagBundle\Utils\WikiTagUtils, + IRI\Bundle\WikiTagBundle\Listener\DocumentListener; /** * Migration for WikiTagBundle <= V00.13 @@ -26,6 +27,20 @@ // Avoid php annoying memory leaks $em->getConnection()->getConfiguration()->setSQLLogger(null); + // remove event listener to avoid useless sql queries. Only WikiTag's Tags are modified + $listenerInst = null; + foreach ($em->getEventManager()->getListeners() as $event => $listeners) { + foreach ($listeners as $hash => $listener) { + if ($listener instanceof DocumentListener) { + $listenerInst = $listener; + break 2; + } + } + } + $listenerInst || die('Listener is not registered in the event manager'); + $evm = $em->getEventManager(); + $evm->removeEventListener(array('onFlush', 'preRemove', 'postPersist', 'postUpdate', 'postRemove'), $listenerInst); + // First step : we populate the dbpedia uris thanks to the dbpedia-owl:wikiPageID echo "\nFIRST STEP"; $query = $em->createQuery('SELECT t FROM WikiTagBundle:Tag t WHERE t.wikipediaPageId IS NOT NULL ORDER BY t.label ASC');//->setMaxResults(240)->setFirstResult(500);