1<?php 2 3function upgrade_20130513_convert_tracker_field_parameters_tiki($installer) 4{ 5 // Using an old version of the definition could be critical here, so making sure 6 // a fresh one is used 7 $cachelib = TikiLib::lib('cache'); 8 $oldCache = $cachelib->replaceImplementation(new CacheLibNoCache); 9 10 $fields = $installer->fetchAll('SELECT fieldId, type, options FROM tiki_tracker_fields'); 11 $factory = new Tracker_Field_Factory; 12 $table = $installer->table('tiki_tracker_fields'); 13 14 foreach ($fields as $field) { 15 $info = $factory->getFieldInfo($field['type']); 16 $options = Tracker_Options::fromString($field['options'], $info); 17 18 $table->update( 19 [ 20 'options' => $options->serialize(), 21 ], 22 [ 23 'fieldId' => $field['fieldId'] 24 ] 25 ); 26 } 27 28 $cachelib->replaceImplementation($oldCache); 29} 30