equal
deleted
inserted
replaced
81 |
81 |
82 // We request Wikipedia if the tag is created or if this is a null result |
82 // We request Wikipedia if the tag is created or if this is a null result |
83 if($created==true || $tag->getUrlStatus()===Tag::$TAG_URL_STATUS_DICT['null_result']) { |
83 if($created==true || $tag->getUrlStatus()===Tag::$TAG_URL_STATUS_DICT['null_result']) { |
84 |
84 |
85 if($wp_request_done==false) { |
85 if($wp_request_done==false) { |
86 try { |
86 $wp_response = WikiTagUtils::getWikipediaInfo($tag_label_normalized); |
87 $wp_response = WikiTagUtils::getWikipediaInfo($tag_label_normalized); |
|
88 } |
|
89 catch (\Exception $e){ |
|
90 throw new \Exception($e->getMessage()); |
|
91 } |
|
92 } |
87 } |
93 |
88 |
94 $tag->setWikipediaInfo($wp_response); |
89 $tag->setWikipediaInfo($wp_response); |
95 |
90 |
96 // Save datas. |
91 // Save datas. |
99 $em->flush(); |
94 $em->flush(); |
100 |
95 |
101 $wikipedia_revision_id = $wp_response['revision_id']; |
96 $wikipedia_revision_id = $wp_response['revision_id']; |
102 |
97 |
103 } |
98 } |
104 else if($tag!=null && $tag->getWikipediaPageId()!=null) { |
99 elseif($tag!=null && $tag->getWikipediaPageId()!=null) { |
105 try { |
100 $wp_response = WikiTagUtils::getWikipediaInfo(null, $tag->getWikipediaPageId()); |
106 $wp_response = WikiTagUtils::getWikipediaInfo(null, $tag->getWikipediaPageId()); |
|
107 } |
|
108 catch (\Exception $e){ |
|
109 throw new \Exception($e->getMessage()); |
|
110 } |
|
111 $wikipedia_revision_id = $wp_response['revision_id']; |
101 $wikipedia_revision_id = $wp_response['revision_id']; |
112 } |
102 } |
113 else { |
103 else { |
114 $wikipedia_revision_id = null; |
104 $wikipedia_revision_id = null; |
115 } |
105 } |