r85412 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85411‎ | r85412 | r85413 >
Date:01:39, 5 April 2011
Author:laner
Status:deferred (Comments)
Tags:
Comment:
Mode article code reusable for other resources.
Modified paths:
  • /trunk/extensions/OpenStackManager/OpenStackManager.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaArticle.php (added) (history)

Diff [purge]

Index: trunk/extensions/OpenStackManager/OpenStackNovaArticle.php
@@ -0,0 +1,30 @@
 2+<?php
 3+
 4+class OpenStackNovaArticle {
 5+
 6+ public static function canCreatePages() {
 7+ global $wgOpenStackManagerCreateResourcePages;
 8+
 9+ if ( $wgOpenStackManagerCreateResourcePages ) {
 10+ return true;
 11+ } else {
 12+ return false;
 13+ }
 14+ }
 15+
 16+ public static function editArticle( $titletext, $text ) {
 17+ $title = Title::newFromText( $titletext, NS_NOVA_RESOURCE );
 18+ $article = new Article( $title );
 19+ $article->doEdit( $text, '' );
 20+ }
 21+
 22+ public static function deleteArticle( $titletext ) {
 23+ if ( ! OpenStackNovaArticle::canCreatePages() ) {
 24+ return;
 25+ }
 26+ $title = Title::newFromText( $titletext, NS_NOVA_RESOURCE );
 27+ $article = new Article( $title );
 28+ $article->doDeleteArticle( '' );
 29+ }
 30+
 31+}
Property changes on: trunk/extensions/OpenStackManager/OpenStackNovaArticle.php
___________________________________________________________________
Added: svn:eol-style
132 + native
Index: trunk/extensions/OpenStackManager/OpenStackManager.php
@@ -95,6 +95,7 @@
9696 $wgAutoloadClasses['OpenStackNovaRole'] = $dir . 'OpenStackNovaRole.php';
9797 $wgAutoloadClasses['OpenStackNovaVolume'] = $dir . 'OpenStackNovaVolume.php';
9898 $wgAutoloadClasses['OpenStackNovaSudoer'] = $dir . 'OpenStackNovaSudoer.php';
 99+$wgAutoloadClasses['OpenStackNovaArticle'] = $dir . 'OpenStackNovaArticle.php';
99100 $wgAutoloadClasses['SpecialNovaInstance'] = $dir . 'special/SpecialNovaInstance.php';
100101 $wgAutoloadClasses['SpecialNovaKey'] = $dir . 'special/SpecialNovaKey.php';
101102 $wgAutoloadClasses['SpecialNovaProject'] = $dir . 'special/SpecialNovaProject.php';

Follow-up revisions

RevisionCommit summaryAuthorDate
r85423* Fix to article fetching; fetch current revision ID for article. Follow up t...laner06:37, 5 April 2011

Comments

#Comment by Nikerabbit (talk | contribs)   06:25, 5 April 2011

Use new Article( $title, 0 ); unless you want hard to track bugs with wrong articles being acted on.

Status & tagging log