update_108

Versions
4.6
update_108()

Code

database/updates.inc, line 1865

<?php
function update_108() {
  $ret = array();
  // This update is needed for 4.5-RC sites, where profile data was not being
  // wiped from the user->data column correctly because update_80() was faulty.
  if (!variable_get('update_80_fix', false)) {
    // The data field needs to be cleared of profile fields.
    $result = db_query("SELECT uid FROM {users} WHERE data LIKE '%profile%'");
    while ($uid = db_fetch_object($result)) {
      $user = user_load(array('uid' => $uid->uid));
      $unset = array();
      foreach ($user as $key => $value) {
        if (substr($key, 0, 8) == 'profile_') {
          // Fields with a NULL value are wiped from the data column.
          $unset[$key] = NULL;
        }
      }
      user_save($user, $unset);
    }
  }
  return $ret;
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.