All pastes #19984 Raw Edit

Untitled

public text v1 · immutable
#19984 ·published 2005-08-14 04:41 UTC
rendered paste body
    /**
     * @see GalleryTheme::upgrade
     */
    function upgrade($installedVersion) {
	if (version_compare($installedVersion, '0.9.7', '<')) {
	    /* Older than the big theme changeover.  Set some default blocks */
	    foreach (array(
			 'sidebarBlocks' => serialize(
			     array(
				 array('search.SearchBlock', array('showAdvancedLink' => true)),
				 array('core.ItemLinks', array('useDropdown' => false)),
				 array('core.PeerList', array()),
				 array('imageblock.ImageBlock', array()))),
			 'albumBlocks' => serialize(
			     array(array('comment.ViewComments', array()))),
			 'photoBlocks' => serialize(
			     array(
				 array('exif.ExifInfo', array()),
				 array('comment.ViewComments', array()))))
		     as $key => $value) {
		$ret = $this->setParameter($key, $value);
		if ($ret->isError()) {
		    return $ret->wrap(__FILE__, __LINE__);
		}
	    }
	    $installedVersion = '0.9.7';
	}

	switch ($installedVersion) {
	case '0.9.7':
	    $ret = $this->setParameter('colorpack', '');
	    if ($ret->isError()) {
		return $ret->wrap(__FILE__, __LINE__);
	    }

	case 'end of upgrade path':
	    break;

	default:
	    return GalleryStatus::error(ERROR_BAD_PLUGIN, __FILE__, __LINE__,
					sprintf('Unknown theme version %s', $installedVersion));
	}

	return GalleryStatus::success();
    }
}