# HG changeset patch # User cavaliet # Date 1404485911 -7200 # Node ID a1cf7fac5c2d8e7cb6e6ad26afa9f572a0e5adb8 # Parent c3f9a6086f52242047d9f4ea885a5ae0b240de79 adapt code to be compatible with dinosaur php 5.3 diff -r c3f9a6086f52 -r a1cf7fac5c2d app/DoctrineMigrations/Version20140129151724.php --- a/app/DoctrineMigrations/Version20140129151724.php Fri Jul 04 16:57:59 2014 +0200 +++ b/app/DoctrineMigrations/Version20140129151724.php Fri Jul 04 16:58:31 2014 +0200 @@ -42,29 +42,29 @@ $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); -// $tags = $query->getResult(); -// $i = 1; -// $nb_set = 0; -// echo "\n".count($tags)." tags to search."; -// foreach($tags as $tag){ -// $l = $tag->getLabel(); -// $uri = WikiTagUtils::getDbpediaUri($tag->getWikipediaPageId(), array(), false, "pageid"); -// $tag->setDbpediaUri($uri); -// $em->persist($tag); -// if($uri!=NULL && $uri!=""){ -// $nb_set++; -// } -// if( $i % 50 == 0 ){ -// $em->flush(); -// echo "\n FLUSH"; -// } -// $i++; -// echo "\n$i : $l \t\t: $uri"; -// } -// $em->flush(); -// echo "\nFIRST STEP : $nb_set uris found"; + 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); + $tags = $query->getResult(); + $i = 1; + $nb_set = 0; + echo "\n".count($tags)." tags to search."; + foreach($tags as $tag){ + $l = $tag->getLabel(); + $uri = WikiTagUtils::getDbpediaUri($tag->getWikipediaPageId(), array(), false, "pageid"); + $tag->setDbpediaUri($uri); + $em->persist($tag); + if($uri!=NULL && $uri!=""){ + $nb_set++; + } + if( $i % 50 == 0 ){ + $em->flush(); + echo "\n FLUSH"; + } + $i++; + echo "\n$i : $l \t\t: $uri"; + } + $em->flush(); + echo "\nFIRST STEP : $nb_set uris found"; // Second step : we populate the dbpedia uris not found thanks to the foaf:isPrimaryTopicOf