r85423 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85422‎ | r85423 | r85424 >
Date:06:37, 5 April 2011
Author:laner
Status:deferred
Tags:
Comment:
* Fix to article fetching; fetch current revision ID for article. Follow up to r85412.
* Refactor article editing for instances
Modified paths:
  • /trunk/extensions/OpenStackManager/OpenStackNovaArticle.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaInstance.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenStackManager/OpenStackNovaInstance.php
@@ -190,15 +190,12 @@
191191 * @return void
192192 */
193193 function editArticle() {
194 - global $wgOpenStackManagerCreateResourcePages;
195194 global $wgOpenStackManagerNovaAdminKeys;
196195
197 - if ( ! $wgOpenStackManagerCreateResourcePages ) {
 196+ if ( ! OpenStackNovaArticle::canCreatePages() ) {
198197 return;
199198 }
200199
201 - $title = Title::newFromText( $this->getInstanceId(), NS_NOVA_RESOURCE );
202 - $article = new Article( $title );
203200 $format = <<<RESOURCEINFO
204201 {{Nova Resource
205202 |Resource Type=instance
@@ -265,19 +262,11 @@
266263 $puppetclasses,
267264 $puppetvars
268265 );
269 - $article->doEdit( $text, '' );
 266+ OpenStackNovaArticle::editArticle( $this->getInstanceId(), $text );
270267 }
271268
272269 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() );
282271 }
283272
284273 }
Index: trunk/extensions/OpenStackManager/OpenStackNovaArticle.php
@@ -14,7 +14,7 @@
1515
1616 public static function editArticle( $titletext, $text ) {
1717 $title = Title::newFromText( $titletext, NS_NOVA_RESOURCE );
18 - $article = new Article( $title );
 18+ $article = new Article( $title, 0 );
1919 $article->doEdit( $text, '' );
2020 }
2121
@@ -23,7 +23,7 @@
2424 return;
2525 }
2626 $title = Title::newFromText( $titletext, NS_NOVA_RESOURCE );
27 - $article = new Article( $title );
 27+ $article = new Article( $title, 0 );
2828 $article->doDeleteArticle( '' );
2929 }
3030

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r85412Mode article code reusable for other resources.laner01:39, 5 April 2011

Status & tagging log