diff -u b/core/modules/user/user.install b/core/modules/user/user.install --- b/core/modules/user/user.install +++ b/core/modules/user/user.install @@ -401,9 +401,15 @@ /** * Migrate user pictures to Field API. */ -function user_update_8003() { - // @todo Chunk into 20 per batch pass. - $results = db_query('SELECT uid, picture FROM {users} WHERE picture > 0')->fetchAllKeyed(); +function user_update_8003(&$sandbox) { + // Initialize total values to process. + if (!isset($sandbox['total'])) { + $sandbox['total'] = (int) db_query('SELECT COUNT(picture) FROM {users} WHERE picture > 0')->fetchField(); + $sandbox['processed'] = 0; + } + + // Retrieve next 20 rows to migrate. + $results = db_query('SELECT uid, picture FROM {users} WHERE picture > 0 LIMIT 0, 20')->fetchAllKeyed(); if ($uids = array_keys($results)) { // @todo Must not use API functions invoking hooks. $accounts = user_load_multiple($uids); @@ -414,7 +420,15 @@ } } } - db_drop_field('users', 'picture'); + + // Report status. + $sandbox['processed'] += count($results); + $sandbox['#finished'] = 1 - $sandbox['processed'] / $sandbox['total']; + + // Delete {users}.picture after processing all values. + if ($sandbox['#finished'] == 1) { + db_drop_field('users', 'picture'); + } } /** diff -u b/core/modules/user/user.test b/core/modules/user/user.test --- b/core/modules/user/user.test +++ b/core/modules/user/user.test @@ -957,28 +957,6 @@ } /** - * Test HTTP schema working with user pictures. - * - * @todo OINK? - */ - function DISABLEDtestExternalPicture() { - $this->drupalLogin($this->web_user); - // Set the default picture to an URI with a HTTP schema. - $images = $this->drupalGetTestFiles('image'); - $image = $images[0]; - $pic_path = file_create_url($image->uri); - variable_set('user_picture_default', $pic_path); - - // Check if image is displayed in user's profile page. - $this->drupalGet('user'); - - // Get the user picture image via xpath. - $elements = $this->xpath('//div[@class="user-picture"]/img'); - $this->assertEqual(count($elements), 1, t("There is exactly one user picture on the user's profile page")); - $this->assertEqual($pic_path, (string) $elements[0]['src'], t("User picture source is correct: " . $pic_path . " " . print_r($elements, TRUE))); - } - - /** * Tests creation, display, and deletion of user pictures. */ function testCreateDeletePicture() {