# HG changeset patch # User cavaliet # Date 1404485879 -7200 # Node ID c3f9a6086f52242047d9f4ea885a5ae0b240de79 # Parent ebcd5b67995e42b57b13c14f5ee8d3957afd4885 adapt code to be compatible with dinosaur php 5.3 diff -r ebcd5b67995e -r c3f9a6086f52 app/DoctrineMigrations/Version20140129151724.php --- a/app/DoctrineMigrations/Version20140129151724.php Tue Apr 08 13:14:32 2014 +0200 +++ b/app/DoctrineMigrations/Version20140129151724.php Fri Jul 04 16:57:59 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(), [], 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 @@ -76,7 +76,7 @@ echo "\n".count($tags)." tags to search."; foreach($tags as $tag){ $l = $tag->getLabel(); - $uri = WikiTagUtils::getDbpediaUri($tag->getWikipediaUrl(), [], false, "wikiurl"); + $uri = WikiTagUtils::getDbpediaUri($tag->getWikipediaUrl(), array(), false, "wikiurl"); $tag->setDbpediaUri($uri); $em->persist($tag); if($uri!=NULL && $uri!=""){ @@ -102,7 +102,7 @@ echo "\n".count($tags)." tags to search."; foreach($tags as $tag){ $l = $tag->getLabel(); - $uri = WikiTagUtils::getDbpediaUri($tag->getLabel(), [], false); + $uri = WikiTagUtils::getDbpediaUri($tag->getLabel(), array(), false); $tag->setDbpediaUri($uri); $em->persist($tag); if($uri!=NULL && $uri!=""){