Index: trunk/extensions/OpenStackManager/OpenStackNovaInstance.php |
— | — | @@ -190,15 +190,12 @@ |
191 | 191 | * @return void |
192 | 192 | */ |
193 | 193 | function editArticle() { |
194 | | - global $wgOpenStackManagerCreateResourcePages; |
195 | 194 | global $wgOpenStackManagerNovaAdminKeys; |
196 | 195 | |
197 | | - if ( ! $wgOpenStackManagerCreateResourcePages ) { |
| 196 | + if ( ! OpenStackNovaArticle::canCreatePages() ) { |
198 | 197 | return; |
199 | 198 | } |
200 | 199 | |
201 | | - $title = Title::newFromText( $this->getInstanceId(), NS_NOVA_RESOURCE ); |
202 | | - $article = new Article( $title ); |
203 | 200 | $format = <<<RESOURCEINFO |
204 | 201 | {{Nova Resource |
205 | 202 | |Resource Type=instance |
— | — | @@ -265,19 +262,11 @@ |
266 | 263 | $puppetclasses, |
267 | 264 | $puppetvars |
268 | 265 | ); |
269 | | - $article->doEdit( $text, '' ); |
| 266 | + OpenStackNovaArticle::editArticle( $this->getInstanceId(), $text ); |
270 | 267 | } |
271 | 268 | |
272 | 269 | function deleteArticle() { |
273 | | - global $wgOpenStackManagerCreateResourcePages; |
274 | | - |
275 | | - if ( ! $wgOpenStackManagerCreateResourcePages ) { |
276 | | - return; |
277 | | - } |
278 | | - |
279 | | - $title = Title::newFromText( $this->getInstanceId(), NS_NOVA_RESOURCE ); |
280 | | - $article = new Article( $title ); |
281 | | - $article->doDeleteArticle( '' ); |
| 270 | + OpenStackNovaArticle::deleteArticle( $this->getInstanceId() ); |
282 | 271 | } |
283 | 272 | |
284 | 273 | } |
Index: trunk/extensions/OpenStackManager/OpenStackNovaArticle.php |
— | — | @@ -14,7 +14,7 @@ |
15 | 15 | |
16 | 16 | public static function editArticle( $titletext, $text ) { |
17 | 17 | $title = Title::newFromText( $titletext, NS_NOVA_RESOURCE ); |
18 | | - $article = new Article( $title ); |
| 18 | + $article = new Article( $title, 0 ); |
19 | 19 | $article->doEdit( $text, '' ); |
20 | 20 | } |
21 | 21 | |
— | — | @@ -23,7 +23,7 @@ |
24 | 24 | return; |
25 | 25 | } |
26 | 26 | $title = Title::newFromText( $titletext, NS_NOVA_RESOURCE ); |
27 | | - $article = new Article( $title ); |
| 27 | + $article = new Article( $title, 0 ); |
28 | 28 | $article->doDeleteArticle( '' ); |
29 | 29 | } |
30 | 30 | |