Changeset 9572 for extensions/ContestResults/maintain.inc.php
- Timestamp:
- Mar 8, 2011, 1:19:06 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/ContestResults/maintain.inc.php
r9333 r9572 3 3 4 4 // Configuration par défaut 5 define('default_config' 5 define('default_config', serialize(array( 6 6 'menubar_mode' => array( 7 7 'link' => 0, … … 26 26 `date_begin` DATE NOT NULL , 27 27 `date_end` DATE NOT NULL , 28 `status` VARCHAR( 255 ) NOT NULL ,29 28 `visible` TINYINT(1) NOT NULL , 30 29 `logo` VARCHAR( 255 ) NULL , 31 30 `banner` VARCHAR( 255 ) NULL , 32 `summary` TEXT NULL , 33 `presentation` TEXT NULL , 34 `rules` TEXT NULL , 35 `prices` TEXT NULL , 36 `final` TEXT NULL , 31 `description` TEXT NULL , 37 32 PRIMARY KEY ( `id` ) 38 33 );"); … … 62 57 $field = pwg_query("SHOW COLUMNS FROM `" . $prefixeTable . "contests` LIKE 'presentation_display'"); 63 58 if (pwg_db_num_rows($field)) { 64 pwg_query("ALTER TABLE `" . $prefixeTable . "contests` DROP `presentation_display`"); 65 pwg_query("ALTER TABLE `" . $prefixeTable . "contests` DROP `rules_display`"); 66 pwg_query("ALTER TABLE `" . $prefixeTable . "contests` DROP `prices_display`"); 67 pwg_query("ALTER TABLE `" . $prefixeTable . "contests` DROP `final_display`"); 59 pwg_query("ALTER TABLE `" . $prefixeTable . "contests` 60 DROP `presentation_display`, 61 DROP `rules_display`, 62 DROP `prices_display`, 63 DROP `final_display`;" 64 ); 68 65 } 66 67 // compatibilité avec les versions < 1.3 (suppression option status, regroupement des champs de description) 68 $field = pwg_query("SHOW COLUMNS FROM `" . $prefixeTable . "contests` LIKE 'status'"); 69 if (pwg_db_num_rows($field)) { 70 pwg_query("ALTER TABLE `" . $prefixeTable . "contests` DROP `status`"); 71 pwg_query("ALTER TABLE `" . $prefixeTable . "contests` ADD `description` TEXT NULL"); 72 73 $contests = pwg_query("SELECT * FROM `" . $prefixeTable . "contests`"); 74 while ($contest = pwg_db_fetch_assoc($contests)) { 75 $new_description = array(); 76 if (!empty($contest['presentation'])) { 77 $new_description[] = array( 78 'name' => 'Presentation[lang=fr]Présentation[/lang][lang=es]Presentación[/lang][lang=lv]Prezentacija[/lang]', 79 'content' => $contest['presentation'], 80 ); 81 } 82 if (!empty($contest['rules'])) { 83 $new_description[] = array( 84 'name' => 'Rules[lang=fr]Règles[/lang][lang=es]Restricciones[/lang][lang=lv]Noteikumi[/lang]', 85 'content' => $contest['rules'], 86 ); 87 } 88 if (!empty($contest['prices'])) { 89 $new_description[] = array( 90 'name' => 'Prices[lang=fr]Prix[/lang][lang=es]Precios[/lang][lang=lv]Cenas[/lang]', 91 'content' => $contest['prices'], 92 ); 93 } 94 if (!empty($contest['final'])) { 95 $new_description[] = array( 96 'name' => 'Conclusion[lang=fr]Conclusion[/lang][lang=es]Conclusión[/lang][lang=lv]Beigsana[/lang]', 97 'content' => $contest['final'], 98 ); 99 } 100 101 $new_description = base64_encode(serialize($new_description)); 102 pwg_query("UPDATE `" . $prefixeTable . "contests` 103 SET description = '". $new_description ."' 104 WHERE id = ". $contest['id'] .";" 105 ); 106 } 107 108 pwg_query("ALTER TABLE `" . $prefixeTable . "contests` 109 DROP `presentation`, 110 DROP `rules`, 111 DROP `prices`, 112 DROP `final`;" 113 ); 114 } 115 69 116 } 70 117
Note: See TracChangeset
for help on using the changeset viewer.