r53857 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53856‎ | r53857 | r53858 >
Date:05:43, 28 July 2009
Author:tstarling
Status:deferred
Tags:
Comment:
* Don't include GPG keys in a jump dump
* Fixed dump.php usage message
Modified paths:
  • /trunk/extensions/SecurePoll/cli/dump.php (modified) (history)
  • /trunk/extensions/SecurePoll/includes/Election.php (modified) (history)
  • /trunk/extensions/SecurePoll/includes/Entity.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SecurePoll/includes/Election.php
@@ -358,6 +358,21 @@
359359 }
360360
361361 /**
 362+ * Get property names which aren't included in an XML dump
 363+ */
 364+ function getPropertyDumpBlacklist( $options = array() ) {
 365+ if ( !empty( $options['jump'] ) ) {
 366+ return array(
 367+ 'gpg-encrypt-key',
 368+ 'gpg-sign-key',
 369+ 'gpg-decrypt-key'
 370+ );
 371+ } else {
 372+ return array();
 373+ }
 374+ }
 375+
 376+ /**
362377 * Tally the valid votes for this election.
363378 * Returns a Status object. On success, the value property will contain a
364379 * SecurePoll_ElectionTallier object.
Index: trunk/extensions/SecurePoll/includes/Entity.php
@@ -220,8 +220,11 @@
221221 */
222222 function getConfXmlEntityStuff( $options = array() ) {
223223 $s = Xml::element( 'id', array(), $this->getId() ) . "\n";
 224+ $blacklist = $this->getPropertyDumpBlacklist( $options );
224225 foreach ( $this->getAllProperties() as $name => $value ) {
225 - $s .= Xml::element( 'property', array( 'name' => $name ), $value ) . "\n";
 226+ if ( !in_array( $name, $blacklist ) ) {
 227+ $s .= Xml::element( 'property', array( 'name' => $name ), $value ) . "\n";
 228+ }
226229 }
227230 if ( isset( $options['langs'] ) ) {
228231 $langs = $options['langs'];
@@ -243,4 +246,12 @@
244247 return $s;
245248 }
246249
 250+ /**
 251+ * Get property names which aren't included in an XML dump.
 252+ * Overloaded by Election.
 253+ */
 254+ function getPropertyDumpBlacklist( $options = array() ) {
 255+ return array();
 256+ }
 257+
247258 }
Index: trunk/extensions/SecurePoll/cli/dump.php
@@ -13,12 +13,12 @@
1414 Options:
1515 -o <outfile> Output to the specified file
1616 --votes Include vote records
17 - --all-langs Include messages for all languages instead of just the primary
 17+ --all-langs Include messages for all languages instead of just the primary
1818 --jump Produce a configuration dump suitable for setting up a jump wiki
1919 EOT;
2020
2121 if ( !isset( $args[0] ) ) {
22 - spFatal( "Usage: php dump.php [-o <outfile>] <election name>" );
 22+ spFatal( $usage );
2323 }
2424
2525 $context = new SecurePoll_Context;

Status & tagging log