Browse files

Add 4.0.2 upgrade function.

Enforce changes to how collection theme settings are saved.
  • Loading branch information...
1 parent 7d3ba39 commit e13ecd958d8939f198b618969eca61324340ad08 Michael Sisk committed Nov 6, 2012
Showing with 26 additions and 0 deletions.
  1. +26 −0 -/php/upgrade.php
View
26 -/php/upgrade.php
@@ -15,8 +15,34 @@ class WebcomicUpgrade extends Webcomic {
* @uses Webcomic::$version
*/
public function __construct() {
+ if ( version_compare( self::$config[ 'version' ], '4.0.2', '<' ) ) {
+ $this->_402();
+ }
+
self::$config[ 'version' ] = self::$version;
update_option( 'webcomic_options', self::$config );
+
+ flush_rewrite_rules();
+ }
+
+ /** Upgrade to 4.0.2
+ *
+ * @see github.com/mgsisk/webcomic/commit/73bbd5a1c21ba227c5023374a98f49d8bf05a54b
+ * @see github.com/mgsisk/webcomic/commit/7d3ba3918121fe5c78754a0f012ab3b9d21fd2ae
+ * @uses Webcomic::$config
+ */
+ private function _402() {
+ $themes = wp_get_themes();
+
+ foreach ( self::$config[ 'collections' ] as $k => $v ) {
+ if ( false === strpos( $v[ 'theme' ], '|' ) ) {
+ foreach ( $themes as $theme ) {
+ if ( $theme[ 'Template' ] === $v[ 'theme' ] ) {
+ self::$config[ 'collections' ][ $k ][ 'theme' ] = $theme[ 'Template' ] . '|' . $theme[ 'Stylesheet' ];
+ }
+ }
+ }
+ }
}
}

0 comments on commit e13ecd9

Please sign in to comment.