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 |
1 | 32 | + native |
Index: trunk/extensions/OpenStackManager/OpenStackManager.php |
— | — | @@ -95,6 +95,7 @@ |
96 | 96 | $wgAutoloadClasses['OpenStackNovaRole'] = $dir . 'OpenStackNovaRole.php'; |
97 | 97 | $wgAutoloadClasses['OpenStackNovaVolume'] = $dir . 'OpenStackNovaVolume.php'; |
98 | 98 | $wgAutoloadClasses['OpenStackNovaSudoer'] = $dir . 'OpenStackNovaSudoer.php'; |
| 99 | +$wgAutoloadClasses['OpenStackNovaArticle'] = $dir . 'OpenStackNovaArticle.php'; |
99 | 100 | $wgAutoloadClasses['SpecialNovaInstance'] = $dir . 'special/SpecialNovaInstance.php'; |
100 | 101 | $wgAutoloadClasses['SpecialNovaKey'] = $dir . 'special/SpecialNovaKey.php'; |
101 | 102 | $wgAutoloadClasses['SpecialNovaProject'] = $dir . 'special/SpecialNovaProject.php'; |