Changeset 1209
- Timestamp:
- Apr 19, 2006, 10:54:13 PM (18 years ago)
- Location:
- branches/branch-1_6
- Files:
-
- 2 added
- 23 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/branch-1_6/doc/README_en.txt
r870 r1209 24 24 25 25 - file "include/mysql.inc.php" 26 - file "include/config_local.inc.php" if you have one 26 27 - directory "galleries" 27 28 - your database (create a dump, using PhpMyAdmin for instance) … … 30 31 the previous listed elements) 31 32 32 3. extract files from the downloaded file (using tar or unzip command, or 33 softwares like 7-zip or winzip) 33 3. extract files from the downloaded file 34 34 35 35 4. upload all the new version files to your website but the previous listed -
branches/branch-1_6/doc/README_fr.txt
r870 r1209 8 8 ============ 9 9 10 1. décompresser à l'aide de winzip par exemple (winrar, winace et beaucoup 11 d'autres le permettent également) le fichier téléchargé. 10 1. décompresser l'archive téléchargée 12 11 13 12 2. placer les fichiers décompressés sur votre serveur web dans le répertoire … … 23 22 24 23 - fichier "include/mysql.inc.php" 24 - fichier "include/config_local.inc.php" s'il existe 25 25 - répertoire "galleries" 26 26 - votre base de données (en créant un dump, avec PhpMyAdmin par exemple) … … 29 29 (sauf les éléments listés ci-dessus) 30 30 31 3. décompresser à l'aide de winzip par exemple (winrar, winace et beaucoup 32 d'autres le permettent également) le fichier téléchargé. 31 3. décompresser l'archive contenant la dernière version 33 32 34 33 4. placer tous les fichiers de la nouvelle version sur votre site web sauf -
branches/branch-1_6/install.php
r1146 r1209 333 333 // make PWG avoid upgrading, we must tell it upgrades have already been 334 334 // made. 335 list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();')); 336 define('CURRENT_DATE', $dbnow); 337 $datas = array(); 335 338 foreach (get_available_upgrade_ids() as $upgrade_id) 336 339 { 337 $query = ' 338 INSERT INTO '.UPGRADE_TABLE.' 339 (id, applied, description) 340 VALUES 341 ('.$upgrade_id.', NOW(), \'upgrade included in installation\') 342 '; 343 mysql_query($query); 344 } 340 array_push( 341 $datas, 342 array( 343 'id' => $upgrade_id, 344 'applied' => CURRENT_DATE, 345 'description' => 'upgrade included in installation', 346 ) 347 ); 348 } 349 mass_inserts( 350 UPGRADE_TABLE, 351 array_keys($datas[0]), 352 $datas 353 ); 345 354 } 346 355 } -
branches/branch-1_6/install/upgrade_1.4.0.php
r911 r1209 189 189 } 190 190 191 $new_time = get_moment();192 echo '<pre>['.get_elapsed_time($last_time, $new_time).']';193 echo ' Basic database structure upgrade done</pre>';194 flush();195 $last_time = $new_time;196 197 191 // user datas migration from phpwebgallery_users to phpwebgallery_user_infos 198 192 $query = ' … … 288 282 } 289 283 290 $infos = array();291 292 284 if ($prefix_thumbnail != 'TN-') 293 285 { 294 286 array_push( 295 $ infos,287 $page['infos'], 296 288 'the thumbnail prefix configuration parameter was moved to configuration 297 289 file, copy config_local.inc.php from "tools" directory to "include" directory … … 300 292 } 301 293 294 // now we upgrade from 1.5.0 to 1.6.0 295 include_once(PHPWG_ROOT_PATH.'install/upgrade_1.5.0.php'); 302 296 ?> -
branches/branch-1_6/install/upgrade_1.5.0.php
r1174 r1209 38 38 } 39 39 40 /** 41 * replace old style #images.keywords by #tags. Requires a big data 42 * migration. 43 * 44 * @return void 45 */ 46 function tag_replace_keywords() 47 { 48 // code taken from upgrades 19 and 22 49 50 $query = ' 51 CREATE TABLE '.PREFIX_TABLE.'tags ( 52 id smallint(5) UNSIGNED NOT NULL auto_increment, 53 name varchar(255) BINARY NOT NULL, 54 url_name varchar(255) BINARY NOT NULL, 55 PRIMARY KEY (id) 56 ) 57 ;'; 58 pwg_query($query); 59 60 $query = ' 61 CREATE TABLE '.PREFIX_TABLE.'image_tag ( 62 image_id mediumint(8) UNSIGNED NOT NULL, 63 tag_id smallint(5) UNSIGNED NOT NULL, 64 PRIMARY KEY (image_id,tag_id) 65 ) 66 ;'; 67 pwg_query($query); 68 69 // 70 // Move keywords to tags 71 // 72 73 // each tag label is associated to a numeric identifier 74 $tag_id = array(); 75 // to each tag id (key) a list of image ids (value) is associated 76 $tag_images = array(); 77 78 $current_id = 1; 79 80 $query = ' 81 SELECT id, keywords 82 FROM '.PREFIX_TABLE.'images 83 WHERE keywords IS NOT NULL 84 ;'; 85 $result = pwg_query($query); 86 while ($row = mysql_fetch_array($result)) 87 { 88 foreach(preg_split('/[,]+/', $row['keywords']) as $keyword) 89 { 90 if (!isset($tag_id[$keyword])) 91 { 92 $tag_id[$keyword] = $current_id++; 93 } 94 95 if (!isset($tag_images[ $tag_id[$keyword] ])) 96 { 97 $tag_images[ $tag_id[$keyword] ] = array(); 98 } 99 100 array_push( 101 $tag_images[ $tag_id[$keyword] ], 102 $row['id'] 103 ); 104 } 105 } 106 107 $datas = array(); 108 foreach ($tag_id as $tag_name => $tag_id) 109 { 110 array_push( 111 $datas, 112 array( 113 'id' => $tag_id, 114 'name' => $tag_name, 115 'url_name' => str2url($tag_name), 116 ) 117 ); 118 } 119 120 if (!empty($datas)) 121 { 122 mass_inserts( 123 PREFIX_TABLE.'tags', 124 array_keys($datas[0]), 125 $datas 126 ); 127 } 128 129 $datas = array(); 130 foreach ($tag_images as $tag_id => $images) 131 { 132 foreach (array_unique($images) as $image_id) 133 { 134 array_push( 135 $datas, 136 array( 137 'tag_id' => $tag_id, 138 'image_id' => $image_id, 139 ) 140 ); 141 } 142 } 143 144 if (!empty($datas)) 145 { 146 mass_inserts( 147 PREFIX_TABLE.'image_tag', 148 array_keys($datas[0]), 149 $datas 150 ); 151 } 152 153 // 154 // Delete images.keywords 155 // 156 $query = ' 157 ALTER TABLE '.PREFIX_TABLE.'images DROP COLUMN keywords 158 ;'; 159 pwg_query($query); 160 161 // 162 // Add useful indexes 163 // 164 $query = ' 165 ALTER TABLE '.PREFIX_TABLE.'tags 166 ADD INDEX tags_i1(url_name) 167 ;'; 168 pwg_query($query); 169 170 171 $query = ' 172 ALTER TABLE '.PREFIX_TABLE.'image_tag 173 ADD INDEX image_tag_i1(tag_id) 174 ;'; 175 pwg_query($query); 176 177 // print_time('tags have replaced keywords'); 178 } 179 40 180 tag_replace_keywords(); 41 181 … … 298 438 pwg_query($query); 299 439 440 // depending on the way the 1.5.0 was installed (from scratch or by upgrade) 441 // the database structure has small differences that should be corrected. 442 443 $query = ' 444 ALTER TABLE '.PREFIX_TABLE.'users 445 CHANGE COLUMN password password varchar(32) default NULL 446 ;'; 447 pwg_query($query); 448 449 $to_keep = array('id', 'username', 'password', 'mail_address'); 450 451 $query = ' 452 DESC '.PREFIX_TABLE.'users 453 ;'; 454 455 $result = pwg_query($query); 456 457 while ($row = mysql_fetch_array($result)) 458 { 459 if (!in_array($row['Field'], $to_keep)) 460 { 461 $query = ' 462 ALTER TABLE '.PREFIX_TABLE.'users 463 DROP COLUMN '.$row['Field'].' 464 ;'; 465 pwg_query($query); 466 } 467 } 468 300 469 ?> -
branches/branch-1_6/upgrade.php
r1174 r1209 132 132 } 133 133 134 /**135 * replace old style #images.keywords by #tags. Requires a big data136 * migration.137 *138 * @return void139 */140 function tag_replace_keywords()141 {142 // code taken from upgrades 19 and 22143 144 $query = '145 CREATE TABLE '.PREFIX_TABLE.'tags (146 id smallint(5) UNSIGNED NOT NULL auto_increment,147 name varchar(255) BINARY NOT NULL,148 url_name varchar(255) BINARY NOT NULL,149 PRIMARY KEY (id)150 )151 ;';152 pwg_query($query);153 154 $query = '155 CREATE TABLE '.PREFIX_TABLE.'image_tag (156 image_id mediumint(8) UNSIGNED NOT NULL,157 tag_id smallint(5) UNSIGNED NOT NULL,158 PRIMARY KEY (image_id,tag_id)159 )160 ;';161 pwg_query($query);162 163 //164 // Move keywords to tags165 //166 167 // each tag label is associated to a numeric identifier168 $tag_id = array();169 // to each tag id (key) a list of image ids (value) is associated170 $tag_images = array();171 172 $current_id = 1;173 174 $query = '175 SELECT id, keywords176 FROM '.PREFIX_TABLE.'images177 WHERE keywords IS NOT NULL178 ;';179 $result = pwg_query($query);180 while ($row = mysql_fetch_array($result))181 {182 foreach(preg_split('/[,]+/', $row['keywords']) as $keyword)183 {184 if (!isset($tag_id[$keyword]))185 {186 $tag_id[$keyword] = $current_id++;187 }188 189 if (!isset($tag_images[ $tag_id[$keyword] ]))190 {191 $tag_images[ $tag_id[$keyword] ] = array();192 }193 194 array_push(195 $tag_images[ $tag_id[$keyword] ],196 $row['id']197 );198 }199 }200 201 $datas = array();202 foreach ($tag_id as $tag_name => $tag_id)203 {204 array_push(205 $datas,206 array(207 'id' => $tag_id,208 'name' => $tag_name,209 'url_name' => str2url($tag_name),210 )211 );212 }213 214 if (!empty($datas))215 {216 mass_inserts(217 PREFIX_TABLE.'tags',218 array_keys($datas[0]),219 $datas220 );221 }222 223 $datas = array();224 foreach ($tag_images as $tag_id => $images)225 {226 foreach (array_unique($images) as $image_id)227 {228 array_push(229 $datas,230 array(231 'tag_id' => $tag_id,232 'image_id' => $image_id,233 )234 );235 }236 }237 238 if (!empty($datas))239 {240 mass_inserts(241 PREFIX_TABLE.'image_tag',242 array_keys($datas[0]),243 $datas244 );245 }246 247 //248 // Delete images.keywords249 //250 $query = '251 ALTER TABLE '.PREFIX_TABLE.'images DROP COLUMN keywords252 ;';253 pwg_query($query);254 255 //256 // Add useful indexes257 //258 $query = '259 ALTER TABLE '.PREFIX_TABLE.'tags260 ADD INDEX tags_i1(url_name)261 ;';262 pwg_query($query);263 264 265 $query = '266 ALTER TABLE '.PREFIX_TABLE.'image_tag267 ADD INDEX image_tag_i1(tag_id)268 ;';269 pwg_query($query);270 271 print_time('tags have replaced keywords');272 }273 274 134 // +-----------------------------------------------------------------------+ 275 135 // | playing zone | … … 278 138 // echo implode('<br>', get_tables()); 279 139 // echo '<pre>'; print_r(get_columns_of(get_tables())); echo '</pre>'; 140 141 // foreach (get_available_upgrade_ids() as $upgrade_id) 142 // { 143 // echo $upgrade_id, '<br>'; 144 // } 280 145 281 146 // +-----------------------------------------------------------------------+ … … 341 206 if (is_file($upgrade_file)) 342 207 { 208 $page['infos'] = array(); 343 209 $page['upgrade_start'] = get_moment(); 344 210 $conf['die_on_sql_error'] = false; 345 211 include($upgrade_file); 212 213 // Available upgrades must be ignored after a fresh installation. To 214 // make PWG avoid upgrading, we must tell it upgrades have already been 215 // made. 216 list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();')); 217 define('CURRENT_DATE', $dbnow); 218 $datas = array(); 219 foreach (get_available_upgrade_ids() as $upgrade_id) 220 { 221 array_push( 222 $datas, 223 array( 224 'id' => $upgrade_id, 225 'applied' => CURRENT_DATE, 226 'description' => 'upgrade included in upgrade', 227 ) 228 ); 229 } 230 mass_inserts( 231 UPGRADE_TABLE, 232 array_keys($datas[0]), 233 $datas 234 ); 235 346 236 $page['upgrade_end'] = get_moment(); 347 237 … … 364 254 ); 365 255 366 if (!isset($infos))367 {368 $infos = array();369 }370 256 array_push( 371 $ infos,257 $page['infos'], 372 258 '[security] delete files "upgrade.php", "install.php" and "install" 373 259 directory' … … 375 261 376 262 array_push( 377 $ infos,263 $page['infos'], 378 264 'in include/mysql.inc.php, remove 379 265 <pre style="background-color:lightgray"> … … 383 269 384 270 array_push( 385 $ infos,271 $page['infos'], 386 272 'Perform a maintenance check in [Administration>General>Maintenance] 387 273 if you encounter any problem.' … … 390 276 $template->assign_block_vars('upgrade.infos', array()); 391 277 392 foreach ($ infosas $info)278 foreach ($page['infos'] as $info) 393 279 { 394 280 $template->assign_block_vars( … … 399 285 ); 400 286 } 401 } 402 else 403 { 404 die('Hacking attempt'); 405 } 406 } 407 408 $query = ' 287 288 $query = ' 409 289 UPDATE '.USER_CACHE_TABLE.' 410 290 SET need_update = \'true\' 411 291 ;'; 412 pwg_query($query); 292 pwg_query($query); 293 } 294 else 295 { 296 die('Hacking attempt'); 297 } 298 } 413 299 414 300 // +-----------------------------------------------------------------------+
Note: See TracChangeset
for help on using the changeset viewer.