--- a/app/DoctrineMigrations/Version20140129151724.php Tue Feb 04 11:23:12 2014 +0100
+++ b/app/DoctrineMigrations/Version20140129151724.php Wed Apr 02 14:35:17 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);