diff options
author | Fabio Comuni <fabrix.xm@gmail.com> | 2011-07-20 10:01:12 +0200 |
---|---|---|
committer | Fabio Comuni <fabrix.xm@gmail.com> | 2011-07-20 10:01:12 +0200 |
commit | 020deefba613327a1d8875ba7f2cf9a750be42dd (patch) | |
tree | f5989c7f45b512c81cc4bec025e7c7137419d516 /update.php | |
parent | 1c9ed08620578bebc8af16e003a2ecef2b8a1f37 (diff) | |
parent | b27d68633be6219c3f65d830178e3dc96c1c91e9 (diff) | |
download | volse-hubzilla-020deefba613327a1d8875ba7f2cf9a750be42dd.tar.gz volse-hubzilla-020deefba613327a1d8875ba7f2cf9a750be42dd.tar.bz2 volse-hubzilla-020deefba613327a1d8875ba7f2cf9a750be42dd.zip |
Merge remote-tracking branch 'friendika/master' into newacl
Diffstat (limited to 'update.php')
-rw-r--r-- | update.php | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/update.php b/update.php index f2cd5573f..9c55f15cf 100644 --- a/update.php +++ b/update.php @@ -1,6 +1,6 @@ <?php -define( 'UPDATE_VERSION' , 1075 ); +define( 'UPDATE_VERSION' , 1076 ); /** * @@ -601,3 +601,26 @@ function update_1074() { } q("ALTER TABLE `profile` DROP `hidewall`"); } + +function update_1075() { + q("ALTER TABLE `user` ADD `guid` CHAR( 16 ) NOT NULL AFTER `uid` "); + $r = q("SELECT `uid` FROM `user` WHERE 1"); + if(count($r)) { + foreach($r as $rr) { + $found = true; + do { + $guid = substr(random_string(),0,16); + $x = q("SELECT `uid` FROM `user` WHERE `guid` = '%s' LIMIT 1", + dbesc($guid) + ); + if(! count($x)) + $found = false; + } while ($found == true ); + + q("UPDATE `user` SET `guid` = '%s' WHERE `uid` = %d LIMIT 1", + dbesc($guid), + intval($rr['uid']) + ); + } + } +}
\ No newline at end of file |