- Timestamp:
- Sep 22, 2012, 5:39:31 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/UserAdvManager/branches/2.40/include/upgradedb.inc.php
r14730 r18160 137 137 // Create missing table 138 138 // -------------------- 139 $query = "140 ALTER TABLE ".USER_CONFIRM_MAIL_TABLE."141 ADD reminder ENUM( 'true', 'false') NULL DEFAULT NULL142 ; ";139 $query = ' 140 ALTER TABLE '.USER_CONFIRM_MAIL_TABLE.' 141 ADD reminder ENUM("true", "false") NULL DEFAULT NULL 142 ;'; 143 143 144 144 pwg_query($query); … … 623 623 conf_update_param('UserAdvManager', pwg_db_real_escape_string($update_conf)); 624 624 } 625 626 627 /* upgrade from 2.40.x to 2.40.6 */ 628 /* ***************************** */ 629 function upgrade_2400_2406() 630 { 631 global $conf; 632 $conf_UAM = unserialize($conf['UserAdvManager']); 633 634 // Piwigo's native tables modifications for validation status - Add UAM_validated column 635 // ------------------------------------------------------------------------------------- 636 $query = ' 637 SHOW COLUMNS FROM '.USERS_TABLE.' 638 LIKE "UAM_validated" 639 ;'; 640 641 $result = pwg_query($query); 642 643 if(!pwg_db_fetch_row($result)) 644 { 645 $q = ' 646 ALTER TABLE '.USERS_TABLE.' 647 ADD UAM_validated enum("true","false") 648 ;'; 649 pwg_query($q); 650 } 651 652 // Fill UAM_validated column with correct information for registered and validated users 653 // -------------------------------------------------------------------------------------- 654 655 // It goes for everybody registered in the gallery except for Guest and AC users (16 and 18) 656 $query = ' 657 SELECT DISTINCT u.id AS id, u.username AS username 658 FROM '.USERS_TABLE.' AS u 659 INNER JOIN '.USER_INFOS_TABLE.' AS ui 660 ON u.id = ui.user_id 661 LEFT JOIN '.USER_GROUP_TABLE.' AS ug 662 ON u.id = ug.user_id 663 WHERE u.id != 2 664 AND u.username != \'16\' 665 AND u.username != \'18\''; 666 667 if ($conf_UAM[3] <> '-1' and $conf_UAM[4] == '-1') 668 { 669 $query.= ' 670 AND ug.group_id = '.$conf_UAM[3]; 671 } 672 if ($conf_UAM[3] == '-1' and $conf_UAM[4] <> '-1') 673 { 674 $query.= ' 675 AND ui.status = \''.$conf_UAM[4]."'"; 676 } 677 if ($conf_UAM[3] <> '-1' and $conf_UAM[4] <> '-1') 678 { 679 $query.= ' 680 AND ug.group_id = '.$conf_UAM[3]; 681 } 682 $query.= ';'; 683 684 $result = pwg_query($query); 685 686 while($row = mysql_fetch_array($result)) 687 { 688 $query = ' 689 UPDATE '.USERS_TABLE.' 690 SET UAM_validated=true 691 WHERE id = '.$row['id'].' 692 ;'; 693 pwg_query($query); 694 } 695 696 // It goes to Webmaster too 697 $query = ' 698 UPDATE '.USERS_TABLE.' 699 SET UAM_validated=true 700 WHERE id = 1 701 ;'; 702 pwg_query($query); 703 } 625 704 ?>
Note: See TracChangeset
for help on using the changeset viewer.