/** * Database and option update check, for installing new versions * * @since 0.30 * * @return void */ private static function _version_upgrade() { $current_version = MLAOptions::mla_get_option(MLAOptions::MLA_VERSION_OPTION); if (version_compare('.30', $current_version, '>')) { /* * Convert attachment_category and _tag to taxonomy_support; * change the default if either option is unchecked */ $category_option = MLAOptions::mla_get_option('attachment_category'); $tag_option = MLAOptions::mla_get_option('attachment_tag'); if (!('checked' == $category_option && 'checked' == $tag_option)) { $tax_option = MLAOptions::mla_get_option(MLAOptions::MLA_TAXONOMY_SUPPORT); if ('checked' != $category_option) { if (isset($tax_option['tax_support']['attachment_category'])) { unset($tax_option['tax_support']['attachment_category']); } } if ('checked' != $tag_option) { if (isset($tax_option['tax_support']['attachment_tag'])) { unset($tax_option['tax_support']['attachment_tag']); } } MLAOptions::mla_taxonomy_option_handler('update', 'taxonomy_support', MLAOptions::$mla_option_definitions['taxonomy_support'], $tax_option); } // one or both options unchecked MLAOptions::mla_delete_option('attachment_category'); MLAOptions::mla_delete_option('attachment_tag'); } // version is less than .30 if (version_compare('1.13', $current_version, '>')) { /* * Add quick_edit and bulk_edit values to custom field mapping rules */ $new_values = array(); foreach (MLAOptions::mla_get_option('custom_field_mapping') as $key => $value) { $value['quick_edit'] = isset($value['quick_edit']) && $value['quick_edit'] ? true : false; $value['bulk_edit'] = isset($value['bulk_edit']) && $value['bulk_edit'] ? true : false; $new_values[$key] = $value; } MLAOptions::mla_update_option('custom_field_mapping', $new_values); } // version is less than 1.13 if (version_compare('1.30', $current_version, '>')) { /* * Add metadata values to custom field mapping rules */ $new_values = array(); foreach (MLAOptions::mla_get_option('custom_field_mapping') as $key => $value) { $value['meta_name'] = isset($value['meta_name']) ? $value['meta_name'] : ''; $value['meta_single'] = isset($value['meta_single']) && $value['meta_single'] ? true : false; $value['meta_export'] = isset($value['meta_export']) && $value['meta_export'] ? true : false; $new_values[$key] = $value; } MLAOptions::mla_update_option('custom_field_mapping', $new_values); } // version is less than 1.30 if (version_compare('1.40', $current_version, '>')) { /* * Add metadata values to custom field mapping rules */ $new_values = array(); foreach (MLAOptions::mla_get_option('custom_field_mapping') as $key => $value) { $value['no_null'] = isset($value['no_null']) && $value['no_null'] ? true : false; if (isset($value['meta_single']) && $value['meta_single']) { $value['option'] = 'single'; } elseif (isset($value['meta_export']) && $value['meta_export']) { $value['option'] = 'export'; } else { $value['option'] = 'text'; } unset($value['meta_single']); unset($value['meta_export']); $new_values[$key] = $value; } MLAOptions::mla_update_option('custom_field_mapping', $new_values); } // version is less than 1.40 if (version_compare('1.60', $current_version, '>')) { /* * Add delimiters values to taxonomy mapping rules */ $option_value = MLAOptions::mla_get_option('iptc_exif_mapping'); $new_values = array(); foreach ($option_value['taxonomy'] as $key => $value) { $value['delimiters'] = isset($value['delimiters']) ? $value['delimiters'] : ''; $new_values[$key] = $value; } $option_value['taxonomy'] = $new_values; MLAOptions::mla_update_option('iptc_exif_mapping', $option_value); } // version is less than 1.60 if (version_compare('1.72', $current_version, '>')) { /* * Strip default descriptions from the options table */ MLAMime::mla_update_upload_mime(); } // version is less than 1.72 if (version_compare('2.13', $current_version, '>')) { /* * Add format, option and no_null to IPTC/EXIF custom mapping rules */ $option_value = MLAOptions::mla_get_option('iptc_exif_mapping'); $new_values = array(); foreach ($option_value['custom'] as $key => $value) { $value['format'] = isset($value['format']) ? $value['format'] : 'native'; $value['option'] = isset($value['option']) ? $value['option'] : 'text'; $value['no_null'] = isset($value['no_null']) ? $value['no_null'] : false; $new_values[$key] = $value; } $option_value['custom'] = $new_values; MLAOptions::mla_update_option('iptc_exif_mapping', $option_value); } // version is less than 2.13 MLAOptions::mla_update_option(MLAOptions::MLA_VERSION_OPTION, MLA::CURRENT_MLA_VERSION); }
/** * Database and option update check, for installing new versions * * @since 0.30 * * @return void */ private static function _version_upgrade() { $current_version = MLAOptions::mla_get_option(MLAOptions::MLA_VERSION_OPTION); if ((double) '.30' > (double) $current_version) { /* * Convert attachment_category and _tag to taxonomy_support; * change the default if either option is unchecked */ $category_option = MLAOptions::mla_get_option('attachment_category'); $tag_option = MLAOptions::mla_get_option('attachment_tag'); if (!('checked' == $category_option && 'checked' == $tag_option)) { $tax_option = MLAOptions::mla_get_option(MLAOptions::MLA_TAXONOMY_SUPPORT); if ('checked' != $category_option) { if (isset($tax_option['tax_support']['attachment_category'])) { unset($tax_option['tax_support']['attachment_category']); } } if ('checked' != $tag_option) { if (isset($tax_option['tax_support']['attachment_tag'])) { unset($tax_option['tax_support']['attachment_tag']); } } MLAOptions::mla_taxonomy_option_handler('update', 'taxonomy_support', MLAOptions::$mla_option_definitions['taxonomy_support'], $tax_option); } // one or both options unchecked MLAOptions::mla_delete_option('attachment_category'); MLAOptions::mla_delete_option('attachment_tag'); } // version is less than .30 if ((double) '1.13' > (double) $current_version) { /* * Add quick_edit and bulk_edit values to custom field mapping rules */ $new_values = array(); foreach (MLAOptions::mla_get_option('custom_field_mapping') as $key => $value) { $value['quick_edit'] = isset($value['quick_edit']) && $value['quick_edit'] ? true : false; $value['bulk_edit'] = isset($value['bulk_edit']) && $value['bulk_edit'] ? true : false; $new_values[$key] = $value; } MLAOptions::mla_update_option('custom_field_mapping', $new_values); } // version is less than 1.13 if ((double) '1.30' > (double) $current_version) { /* * Add metadata values to custom field mapping rules */ $new_values = array(); foreach (MLAOptions::mla_get_option('custom_field_mapping') as $key => $value) { $value['meta_name'] = isset($value['meta_name']) ? $value['meta_name'] : ''; $value['meta_single'] = isset($value['meta_single']) && $value['meta_single'] ? true : false; $value['meta_export'] = isset($value['meta_export']) && $value['meta_export'] ? true : false; $new_values[$key] = $value; } MLAOptions::mla_update_option('custom_field_mapping', $new_values); } // version is less than 1.30 if ((double) '1.40' > (double) $current_version) { /* * Add metadata values to custom field mapping rules */ $new_values = array(); foreach (MLAOptions::mla_get_option('custom_field_mapping') as $key => $value) { $value['no_null'] = isset($value['no_null']) && $value['no_null'] ? true : false; if (isset($value['meta_single']) && $value['meta_single']) { $value['option'] = 'single'; } elseif (isset($value['meta_export']) && $value['meta_export']) { $value['option'] = 'export'; } else { $value['option'] = 'text'; } unset($value['meta_single']); unset($value['meta_export']); $new_values[$key] = $value; } MLAOptions::mla_update_option('custom_field_mapping', $new_values); } // version is less than 1.40 MLAOptions::mla_update_option(MLAOptions::MLA_VERSION_OPTION, MLA::CURRENT_MLA_VERSION); }