18 require_once SQ_INCLUDE_PATH.
'/asset_management.inc';
48 'is_contextable'=> TRUE,
52 'type' =>
'serialise',
70 if (!parent::_upgrade($current_version))
return FALSE;
72 if (version_compare($current_version,
'0.2',
'<=')) {
76 pre_echo(
'STARTING SEARCH FOLDER UPGRADE - VERSION 0.2 => 0.3');
78 $children = $GLOBALS[
'SQ_SYSTEM']->am->getTypeAssetids($this->
getAssetType(), FALSE);
79 foreach ($children as $assetid) {
80 $asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($assetid);
81 $settings = $asset->attr(
'settings');
84 if (!isset($settings[
'types']))
continue;
85 $types = $settings[
'types'];
88 if (count($types) == 0)
continue;
92 if (is_bool(reset($types)))
continue;
96 $types = array_flip($types);
97 foreach ($types as $type_code => $value) {
98 $types[$type_code] = TRUE;
101 $settings[
'types'] = $types;
102 $asset->setAttrValue(
'settings', $settings);
104 if (!$asset->saveAttributes()) {
105 trigger_localised_error(
'SCH0009', E_USER_WARNING);
109 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($asset);
112 pre_echo(
'SEARCH FOLDER UPGRADE COMPLETE - VERSION 0.2 => 0.3');
116 if (version_compare($current_version,
'0.3',
'<=')) {
120 pre_echo(
'STARTING SEARCH FOLDER UPGRADE - VERSION 0.3 => 0.4');
122 $children = $GLOBALS[
'SQ_SYSTEM']->am->getTypeAssetids($this->
getAssetType(), FALSE);
123 foreach ($children as $assetid) {
124 $asset = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($assetid);
125 $settings = $asset->attr(
'settings');
128 if (!is_array($settings[
'root'])) {
129 $settings[
'root'] = (empty($settings[
'root'])) ? Array() : Array($settings[
'root']);
130 $asset->setAttrValue(
'settings', $settings);
132 if (!$asset->saveAttributes()) {
133 trigger_localised_error(
'SCH0009', E_USER_WARNING);
138 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($asset);
142 pre_echo(
'SEARCH FOLDER UPGRADE COMPLETE - VERSION 0.3 => 0.4');