18 require_once SQ_INCLUDE_PATH.
'/asset_management.inc';
42 $this->vars[
'paint_with'] = Array(
48 $this->vars[
'additional_get'] = Array(
49 'type' =>
'serialise',
54 $this->vars[
'dynamic_nest_get'] = Array(
73 if (!parent::_upgrade($current_version))
return FALSE;
75 $asset_name = strtoupper($this->_pm->getTypeInfo($this->getAssetType(),
'name'));
77 if (version_compare($current_version,
'0.3',
'<') &&
78 (version_compare($current_version,
'0.1',
'<=') ||
79 version_compare($current_version,
'0.2',
'>=')) ) {
81 pre_echo(
'STARTING '.$asset_name.
' UPGRADE - TO VERSION 0.3');
84 $content_type_nested_content_ids = $GLOBALS[
'SQ_SYSTEM']->am->getTypeAssetIds($this->
getAssetType(), FALSE);
85 pre_echo(
'Upgrading '.count($content_type_nested_content_ids).
' assets...');
86 foreach ($content_type_nested_content_ids as $assetid) {
87 $content_type_nested_content_asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($assetid);
90 if (is_null($content_type_nested_content_asset)) {
91 pre_echo(
'Could get asset #'.$assetid);
96 $parent_container_ids = $GLOBALS[
'SQ_SYSTEM']->am->getDependantParents($content_type_nested_content_asset->id,
'bodycopy_div');
97 if (!empty($parent_container_ids)) {
98 foreach ($parent_container_ids as $container_id) {
99 $container = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($container_id);
101 $container_edit_fns = $container->getEditFns();
102 if (!$container_edit_fns->generateContentFile($container)) {
103 pre_echo(
'Could not generate content file for container asset #'.$assetid);
105 unset($container_edit_fns);
107 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($container);
110 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($content_type_nested_content_asset);
112 pre_echo($asset_name.
' UPGRADE COMPLETE - FROM VERSION '.$current_version.
' TO 0.3');