Index: trunk/extensions/DataCenter/DataCenter.db.php |
— | — | @@ -1715,6 +1715,21 @@ |
1716 | 1716 | ) |
1717 | 1717 | ); |
1718 | 1718 | } |
| 1719 | + |
| 1720 | + public function serialize() { |
| 1721 | + $metaFieldValues = $this->getMetaValues(); |
| 1722 | + $meta = array(); |
| 1723 | + foreach ( $metaFieldValues as $metaFieldValue ) { |
| 1724 | + $meta[$metaFieldValue->get( 'field' )] = |
| 1725 | + $metaFieldValue->get( 'value' ); |
| 1726 | + } |
| 1727 | + return serialize( |
| 1728 | + array( |
| 1729 | + 'row' => $this->get(), |
| 1730 | + 'meta' => $meta |
| 1731 | + ) |
| 1732 | + ); |
| 1733 | + } |
1719 | 1734 | } |
1720 | 1735 | |
1721 | 1736 | /* Asset Rows */ |
— | — | @@ -2227,7 +2242,7 @@ |
2228 | 2243 | 'component_category' => $component->getCategory(), |
2229 | 2244 | 'component_type' => $component->getType(), |
2230 | 2245 | 'component_id' => $component->getId(), |
2231 | | - 'state' => serialize( $component->get() ), |
| 2246 | + 'state' => $component->serialize(), |
2232 | 2247 | ) |
2233 | 2248 | ) |
2234 | 2249 | ); |
Index: trunk/extensions/DataCenter/CLI/Initialize.php |
— | — | @@ -0,0 +1,20 @@ |
| 2 | +<?php |
| 3 | + |
| 4 | +require_once dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . |
| 5 | + "/maintenance/commandLine.inc"; |
| 6 | + |
| 7 | +if ( isset( $options['help'] ) ) { |
| 8 | + echo "Rebuilds database structure for DataCenter.\n"; |
| 9 | + echo "Usage:\n"; |
| 10 | + echo "\tphp extensions/DataCenter/CLI/Initialize.php --confirm=yes \n"; |
| 11 | +} else { |
| 12 | + if ( isset( $options['confirm'] ) && $options['confirm'] == 'yes' ) { |
| 13 | + echo "Rebuilding database structure for DataCenter...\n"; |
| 14 | + // Get a connection |
| 15 | + $dbw = wfGetDB( DB_MASTER ); |
| 16 | + // Runs initialization |
| 17 | + $dbw->sourceFile( dirname( dirname( __FILE__ ) ) . '/DataCenter.sql' ); |
| 18 | + } else { |
| 19 | + echo "Nothing was changed. The --confirm=yes parameter is required.\n"; |
| 20 | + } |
| 21 | +} |