r103277 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103276‎ | r103277 | r103278 >
Date:01:08, 16 November 2011
Author:laner
Status:deferred
Tags:
Comment:
Adding support for adding/deleting articles for project resources. Minor fix for instance ids.
Modified paths:
  • /trunk/extensions/OpenStackManager/OpenStackNovaInstance.php (modified) (history)
  • /trunk/extensions/OpenStackManager/OpenStackNovaProject.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenStackManager/OpenStackNovaInstance.php
@@ -201,7 +201,7 @@
202202 |Resource Type=instance
203203 |Instance Name=%s
204204 |Reservation Id=%s
205 -|Instance Id={{PAGENAME}}
 205+|Instance Id=%s
206206 |Private IP=%s
207207 |Public IP=%s
208208 |Instance State=%s
@@ -243,6 +243,7 @@
244244 $text = sprintf( $format,
245245 $this->getInstanceName(),
246246 $this->getReservationId(),
 247+ $this->getInstanceId(),
247248 $this->getInstancePrivateIP(),
248249 $this->getInstancePublicIP(),
249250 // Since instance state is somewhat dynamic, is this useful?
Index: trunk/extensions/OpenStackManager/OpenStackNovaProject.php
@@ -362,4 +362,31 @@
363363 }
364364 }
365365
 366+ function editArticle() {
 367+ if ( ! OpenStackNovaArticle::canCreatePages() ) {
 368+ return;
 369+ }
 370+
 371+ $format = <<<RESOURCEINFO
 372+{{Nova Resource
 373+|Resource Type=project
 374+|Project Name=%s
 375+|Members=%s}}
 376+RESOURCEINFO;
 377+ $rawmembers = $this->getMembers();
 378+ $members = array();
 379+ foreach ( $rawmembers as $member ) {
 380+ array_push( $members, 'User:' . $member );
 381+ }
 382+ $text = sprintf( $format,
 383+ $this->getProjectName(),
 384+ implode( ',', $members )
 385+ );
 386+ OpenStackNovaArticle::editArticle( $this->getProjectName(), $text );
 387+ }
 388+
 389+ function deleteArticle() {
 390+ OpenStackNovaArticle::deleteArticle( $this->getProjectName() );
 391+ }
 392+
366393 }

Status & tagging log