equal
deleted
inserted
replaced
84 $match_exists = true; |
84 $match_exists = true; |
85 break; |
85 break; |
86 } |
86 } |
87 } |
87 } |
88 if($match_exists==false) { |
88 if($match_exists==false) { |
89 $wp_response = WikiTagUtils::getWikipediaInfo($tag_label_normalized); |
89 try { |
|
90 $wp_response = WikiTagUtils::getWikipediaInfo($tag_label_normalized); |
|
91 } |
|
92 catch (\Exception $e){ |
|
93 throw new \Exception($e->getMessage()); |
|
94 } |
90 $status = $wp_response['status']; |
95 $status = $wp_response['status']; |
91 if($status==Tag::$TAG_URL_STATUS_DICT['match']) { |
96 if($status==Tag::$TAG_URL_STATUS_DICT['match']) { |
92 $tag = new Tag(); |
97 $tag = new Tag(); |
93 $tag->setLabel($tag_label_normalized); |
98 $tag->setLabel($tag_label_normalized); |
94 $tag->setOriginalLabel($tag_label); |
99 $tag->setOriginalLabel($tag_label); |
101 |
106 |
102 // We request Wikipedia if the tag is created |
107 // We request Wikipedia if the tag is created |
103 if($created==true) { |
108 if($created==true) { |
104 |
109 |
105 if($wp_request_done==false) { |
110 if($wp_request_done==false) { |
106 $wp_response = WikiTagUtils::getWikipediaInfo($tag_label_normalized); |
111 try { |
|
112 $wp_response = WikiTagUtils::getWikipediaInfo($tag_label_normalized); |
|
113 } |
|
114 catch (\Exception $e){ |
|
115 throw new \Exception($e->getMessage()); |
|
116 } |
107 } |
117 } |
108 |
118 |
109 $tag->setWikipediaInfo($wp_response); |
119 $tag->setWikipediaInfo($wp_response); |
110 |
120 |
111 // Save datas. |
121 // Save datas. |
115 |
125 |
116 $wikipedia_revision_id = $wp_response['revision_id']; |
126 $wikipedia_revision_id = $wp_response['revision_id']; |
117 |
127 |
118 } |
128 } |
119 else if($tag!=null && $tag->getWikipediaPageId()!=null) { |
129 else if($tag!=null && $tag->getWikipediaPageId()!=null) { |
120 |
130 try { |
121 $wp_response = WikiTagUtils::getWikipediaInfo(null, $tag->getWikipediaPageId()); |
131 $wp_response = WikiTagUtils::getWikipediaInfo(null, $tag->getWikipediaPageId()); |
|
132 } |
|
133 catch (\Exception $e){ |
|
134 throw new \Exception($e->getMessage()); |
|
135 } |
122 $wikipedia_revision_id = $wp_response['revision_id']; |
136 $wikipedia_revision_id = $wp_response['revision_id']; |
123 } |
137 } |
124 else { |
138 else { |
125 $wikipedia_revision_id = null; |
139 $wikipedia_revision_id = null; |
126 } |
140 } |