Skip to content

Commit

Permalink
fixes to upgrade api to ensure that version is bumped on success
Browse files Browse the repository at this point in the history
  • Loading branch information
MrMaz committed Jun 8, 2015
1 parent c7d1266 commit 0c2b4f9
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/engine/ICE/components/options/policy.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,5 @@ function ice_register_option( $args, $defaults = array() )
*/
function ice_rename_options( $list )
{
ICE_Policy::options()->registry()->rename_theme_mods( $list );
return ICE_Policy::options()->registry()->rename_theme_mods( $list );
}
8 changes: 3 additions & 5 deletions src/engine/ICE/utils/mod.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function refresh( $force = false )
/**
* Saves all modifications to database.
*
* @return boolean
* @return true
*/
public function save()
{
Expand All @@ -115,12 +115,10 @@ public function save()
set_theme_mod( $this->name, $this->mods );
// no longer stale
$this->stale = false;
// success
return true;
}

// no save occurred
return false;
// always return true
return true;
}

/**
Expand Down
12 changes: 11 additions & 1 deletion src/engine/ICE/utils/upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ final public function __construct( $mod_key, $default_version = '1.0' )
}
}

/**
* Return currently stored version.
*
* @return string
*/
final public function get_version()
{
return $this->version;
}

/**
* Returns true if comparison of saved version to given version using given operator is successful.
*
Expand Down Expand Up @@ -168,7 +178,7 @@ public function run()
*/
private function import_options()
{
ice_rename_options( array(
return ice_rename_options( array(
// core options
'infinity-core-options.text-color' => 'core.text-color',
'infinity-core-options.link-color' => 'core.link-color',
Expand Down

0 comments on commit 0c2b4f9

Please sign in to comment.