Created
September 30, 2015 23:45
-
-
Save rfay/eee3670f9fa5238f2bc5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/docroot/modules/user/user.install b/docroot/modules/user/user.install | |
index b573e72..e51a614 100644 | |
--- a/docroot/modules/user/user.install | |
+++ b/docroot/modules/user/user.install | |
@@ -708,207 +708,207 @@ function user_update_7011() { | |
* Add the user's pictures to the {file_managed} table and make them managed | |
* files. | |
*/ | |
-function user_update_7012(&$sandbox) { | |
- | |
- $picture_field = array( | |
- 'type' => 'int', | |
- 'not null' => TRUE, | |
- 'default' => 0, | |
- 'description' => "Foreign key: {file_managed}.fid of user's picture.", | |
- ); | |
- | |
- if (!isset($sandbox['progress'])) { | |
- // Check that the field hasn't been updated in an aborted run of this | |
- // update. | |
- if (!db_field_exists('users', 'picture_fid')) { | |
- // Add a new field for the fid. | |
- db_add_field('users', 'picture_fid', $picture_field); | |
- } | |
- | |
- // Initialize batch update information. | |
- $sandbox['progress'] = 0; | |
- $sandbox['last_user_processed'] = -1; | |
- $sandbox['max'] = db_query("SELECT COUNT(*) FROM {users} WHERE picture <> ''")->fetchField(); | |
- } | |
- | |
- // As a batch operation move the photos into the {file_managed} table and | |
- // update the {users} records. | |
- $limit = 500; | |
- $result = db_query_range("SELECT uid, picture FROM {users} WHERE picture <> '' AND uid > :uid ORDER BY uid", 0, $limit, array(':uid' => $sandbox['last_user_processed'])); | |
- foreach ($result as $user) { | |
- // Don't bother adding files that don't exist. | |
- if (file_exists($user->picture)) { | |
- | |
- // Check if the file already exists. | |
- $files = file_load_multiple(array(), array('uri' => $user->picture)); | |
- if (count($files)) { | |
- $file = reset($files); | |
- } | |
- else { | |
- // Create a file object. | |
- $file = new stdClass(); | |
- $file->uri = $user->picture; | |
- $file->filename = drupal_basename($file->uri); | |
- $file->filemime = file_get_mimetype($file->uri); | |
- $file->uid = $user->uid; | |
- $file->status = FILE_STATUS_PERMANENT; | |
- $file = file_save($file); | |
- } | |
- | |
- db_update('users') | |
- ->fields(array('picture_fid' => $file->fid)) | |
- ->condition('uid', $user->uid) | |
- ->execute(); | |
- } | |
- | |
- // Update our progress information for the batch update. | |
- $sandbox['progress']++; | |
- $sandbox['last_user_processed'] = $user->uid; | |
- } | |
- | |
- // Indicate our current progress to the batch update system. If there's no | |
- // max value then there's nothing to update and we're finished. | |
- $sandbox['#finished'] = empty($sandbox['max']) ? 1 : ($sandbox['progress'] / $sandbox['max']); | |
- | |
- // When we're finished, drop the old picture field and rename the new one to | |
- // replace it. | |
- if (isset($sandbox['#finished']) && $sandbox['#finished'] == 1) { | |
- db_drop_field('users', 'picture'); | |
- db_change_field('users', 'picture_fid', 'picture', $picture_field); | |
- } | |
-} | |
- | |
-/** | |
- * Add user module file usage entries. | |
- */ | |
-function user_update_7013(&$sandbox) { | |
- if (!isset($sandbox['progress'])) { | |
- // Initialize batch update information. | |
- $sandbox['progress'] = 0; | |
- $sandbox['last_uid_processed'] = -1; | |
- $sandbox['max'] = db_query("SELECT COUNT(*) FROM {users} u WHERE u.picture <> 0")->fetchField(); | |
- } | |
- | |
- // Add usage entries for the user picture files. | |
- $limit = 500; | |
- $result = db_query_range('SELECT f.*, u.uid as user_uid FROM {users} u INNER JOIN {file_managed} f ON u.picture = f.fid WHERE u.picture <> 0 AND u.uid > :uid ORDER BY u.uid', 0, $limit, array(':uid' => $sandbox['last_uid_processed']))->fetchAllAssoc('fid', PDO::FETCH_ASSOC); | |
- foreach ($result as $row) { | |
- $uid = $row['user_uid']; | |
- $file = (object) $row; | |
- file_usage_add($file, 'user', 'user', $uid); | |
- | |
- // Update our progress information for the batch update. | |
- $sandbox['progress']++; | |
- $sandbox['last_uid_processed'] = $uid; | |
- } | |
- | |
- // Indicate our current progress to the batch update system. | |
- $sandbox['#finished'] = empty($sandbox['max']) || ($sandbox['progress'] / $sandbox['max']); | |
-} | |
- | |
-/** | |
- * Rename the 'post comments without approval' permission. | |
- * | |
- * In Drupal 7, this permission has been renamed to 'skip comment approval'. | |
- */ | |
-function user_update_7014() { | |
- db_update('role_permission') | |
- ->fields(array('permission' => 'skip comment approval')) | |
- ->condition('permission', 'post comments without approval') | |
- ->execute(); | |
- | |
- return t("Renamed the 'post comments without approval' permission to 'skip comment approval'."); | |
-} | |
- | |
-/** | |
- * Change {users}.signature_format into varchar. | |
- */ | |
-function user_update_7015() { | |
- db_change_field('users', 'signature_format', 'signature_format', array( | |
- 'type' => 'varchar', | |
- 'length' => 255, | |
- 'not null' => FALSE, | |
- 'description' => 'The {filter_format}.format of the signature.', | |
- )); | |
-} | |
- | |
-/** | |
- * @} End of "addtogroup updates-6.x-to-7.x". | |
- */ | |
- | |
-/** | |
- * @addtogroup updates-7.x-extra | |
- * @{ | |
- */ | |
- | |
-/** | |
- * Update the database to match the schema. | |
- */ | |
-function user_update_7016() { | |
- // Add field default. | |
- db_change_field('users', 'uid', 'uid', array( | |
- 'type' => 'int', | |
- 'unsigned' => TRUE, | |
- 'not null' => TRUE, | |
- 'default' => 0, | |
- )); | |
-} | |
- | |
-/** | |
- * Update email templates to use new tokens. | |
- * | |
- * This function upgrades customized email templates from the old !token format | |
- * to the new core tokens format. Additionally, in Drupal 7 we no longer e-mail | |
- * plain text passwords to users, and there is no token for a plain text | |
- * password in the new token system. Therefore, it also modifies any saved | |
- * templates using the old '!password' token such that the token is removed, and | |
- * displays a warning to users that they may need to go and modify the wording | |
- * of their templates. | |
- */ | |
-function user_update_7017() { | |
- $message = ''; | |
- | |
- $tokens = array( | |
- '!site' => '[site:name]', | |
- '!username' => '[user:name]', | |
- '!mailto' => '[user:mail]', | |
- '!login_uri' => '[site:login-url]', | |
- '!uri_brief' => '[site:url-brief]', | |
- '!edit_uri' => '[user:edit-url]', | |
- '!login_url' => '[user:one-time-login-url]', | |
- '!uri' => '[site:url]', | |
- '!date' => '[date:medium]', | |
- '!password' => '', | |
- ); | |
- | |
- $result = db_select('variable', 'v') | |
- ->fields('v', array('name')) | |
- ->condition('name', db_like('user_mail_') . '%', 'LIKE') | |
- ->execute(); | |
- | |
- foreach ($result as $row) { | |
- // Use variable_get() to get the unserialized value for free. | |
- if ($value = variable_get($row->name, FALSE)) { | |
- | |
- if (empty($message) && (strpos($value, '!password') !== FALSE)) { | |
- $message = t('The ability to send users their passwords in plain text has been removed in Drupal 7. Your existing email templates have been modified to remove it. You should <a href="@template-url">review these templates</a> to make sure they read properly.', array('@template-url' => url('admin/config/people/accounts'))); | |
- } | |
- | |
- variable_set($row->name, str_replace(array_keys($tokens), $tokens, $value)); | |
- } | |
- } | |
- | |
- return $message; | |
-} | |
- | |
-/** | |
- * Ensure there is an index on {users}.picture. | |
- */ | |
-function user_update_7018() { | |
- if (!db_index_exists('users', 'picture')) { | |
- db_add_index('users', 'picture', array('picture')); | |
- } | |
-} | |
+//function user_update_7012(&$sandbox) { | |
+// | |
+// $picture_field = array( | |
+// 'type' => 'int', | |
+// 'not null' => TRUE, | |
+// 'default' => 0, | |
+// 'description' => "Foreign key: {file_managed}.fid of user's picture.", | |
+// ); | |
+// | |
+// if (!isset($sandbox['progress'])) { | |
+// // Check that the field hasn't been updated in an aborted run of this | |
+// // update. | |
+// if (!db_field_exists('users', 'picture_fid')) { | |
+// // Add a new field for the fid. | |
+// db_add_field('users', 'picture_fid', $picture_field); | |
+// } | |
+// | |
+// // Initialize batch update information. | |
+// $sandbox['progress'] = 0; | |
+// $sandbox['last_user_processed'] = -1; | |
+// $sandbox['max'] = db_query("SELECT COUNT(*) FROM {users} WHERE picture <> ''")->fetchField(); | |
+// } | |
+// | |
+// // As a batch operation move the photos into the {file_managed} table and | |
+// // update the {users} records. | |
+// $limit = 500; | |
+// $result = db_query_range("SELECT uid, picture FROM {users} WHERE picture <> '' AND uid > :uid ORDER BY uid", 0, $limit, array(':uid' => $sandbox['last_user_processed'])); | |
+// foreach ($result as $user) { | |
+// // Don't bother adding files that don't exist. | |
+// if (file_exists($user->picture)) { | |
+// | |
+// // Check if the file already exists. | |
+// $files = file_load_multiple(array(), array('uri' => $user->picture)); | |
+// if (count($files)) { | |
+// $file = reset($files); | |
+// } | |
+// else { | |
+// // Create a file object. | |
+// $file = new stdClass(); | |
+// $file->uri = $user->picture; | |
+// $file->filename = drupal_basename($file->uri); | |
+// $file->filemime = file_get_mimetype($file->uri); | |
+// $file->uid = $user->uid; | |
+// $file->status = FILE_STATUS_PERMANENT; | |
+// $file = file_save($file); | |
+// } | |
+// | |
+// db_update('users') | |
+// ->fields(array('picture_fid' => $file->fid)) | |
+// ->condition('uid', $user->uid) | |
+// ->execute(); | |
+// } | |
+// | |
+// // Update our progress information for the batch update. | |
+// $sandbox['progress']++; | |
+// $sandbox['last_user_processed'] = $user->uid; | |
+// } | |
+// | |
+// // Indicate our current progress to the batch update system. If there's no | |
+// // max value then there's nothing to update and we're finished. | |
+// $sandbox['#finished'] = empty($sandbox['max']) ? 1 : ($sandbox['progress'] / $sandbox['max']); | |
+// | |
+// // When we're finished, drop the old picture field and rename the new one to | |
+// // replace it. | |
+// if (isset($sandbox['#finished']) && $sandbox['#finished'] == 1) { | |
+// db_drop_field('users', 'picture'); | |
+// db_change_field('users', 'picture_fid', 'picture', $picture_field); | |
+// } | |
+//} | |
+// | |
+///** | |
+// * Add user module file usage entries. | |
+// */ | |
+//function user_update_7013(&$sandbox) { | |
+// if (!isset($sandbox['progress'])) { | |
+// // Initialize batch update information. | |
+// $sandbox['progress'] = 0; | |
+// $sandbox['last_uid_processed'] = -1; | |
+// $sandbox['max'] = db_query("SELECT COUNT(*) FROM {users} u WHERE u.picture <> 0")->fetchField(); | |
+// } | |
+// | |
+// // Add usage entries for the user picture files. | |
+// $limit = 500; | |
+// $result = db_query_range('SELECT f.*, u.uid as user_uid FROM {users} u INNER JOIN {file_managed} f ON u.picture = f.fid WHERE u.picture <> 0 AND u.uid > :uid ORDER BY u.uid', 0, $limit, array(':uid' => $sandbox['last_uid_processed']))->fetchAllAssoc('fid', PDO::FETCH_ASSOC); | |
+// foreach ($result as $row) { | |
+// $uid = $row['user_uid']; | |
+// $file = (object) $row; | |
+// file_usage_add($file, 'user', 'user', $uid); | |
+// | |
+// // Update our progress information for the batch update. | |
+// $sandbox['progress']++; | |
+// $sandbox['last_uid_processed'] = $uid; | |
+// } | |
+// | |
+// // Indicate our current progress to the batch update system. | |
+// $sandbox['#finished'] = empty($sandbox['max']) || ($sandbox['progress'] / $sandbox['max']); | |
+//} | |
+// | |
+///** | |
+// * Rename the 'post comments without approval' permission. | |
+// * | |
+// * In Drupal 7, this permission has been renamed to 'skip comment approval'. | |
+// */ | |
+//function user_update_7014() { | |
+// db_update('role_permission') | |
+// ->fields(array('permission' => 'skip comment approval')) | |
+// ->condition('permission', 'post comments without approval') | |
+// ->execute(); | |
+// | |
+// return t("Renamed the 'post comments without approval' permission to 'skip comment approval'."); | |
+//} | |
+// | |
+///** | |
+// * Change {users}.signature_format into varchar. | |
+// */ | |
+//function user_update_7015() { | |
+// db_change_field('users', 'signature_format', 'signature_format', array( | |
+// 'type' => 'varchar', | |
+// 'length' => 255, | |
+// 'not null' => FALSE, | |
+// 'description' => 'The {filter_format}.format of the signature.', | |
+// )); | |
+//} | |
+// | |
+///** | |
+// * @} End of "addtogroup updates-6.x-to-7.x". | |
+// */ | |
+// | |
+///** | |
+// * @addtogroup updates-7.x-extra | |
+// * @{ | |
+// */ | |
+// | |
+///** | |
+// * Update the database to match the schema. | |
+// */ | |
+//function user_update_7016() { | |
+// // Add field default. | |
+// db_change_field('users', 'uid', 'uid', array( | |
+// 'type' => 'int', | |
+// 'unsigned' => TRUE, | |
+// 'not null' => TRUE, | |
+// 'default' => 0, | |
+// )); | |
+//} | |
+// | |
+///** | |
+// * Update email templates to use new tokens. | |
+// * | |
+// * This function upgrades customized email templates from the old !token format | |
+// * to the new core tokens format. Additionally, in Drupal 7 we no longer e-mail | |
+// * plain text passwords to users, and there is no token for a plain text | |
+// * password in the new token system. Therefore, it also modifies any saved | |
+// * templates using the old '!password' token such that the token is removed, and | |
+// * displays a warning to users that they may need to go and modify the wording | |
+// * of their templates. | |
+// */ | |
+//function user_update_7017() { | |
+// $message = ''; | |
+// | |
+// $tokens = array( | |
+// '!site' => '[site:name]', | |
+// '!username' => '[user:name]', | |
+// '!mailto' => '[user:mail]', | |
+// '!login_uri' => '[site:login-url]', | |
+// '!uri_brief' => '[site:url-brief]', | |
+// '!edit_uri' => '[user:edit-url]', | |
+// '!login_url' => '[user:one-time-login-url]', | |
+// '!uri' => '[site:url]', | |
+// '!date' => '[date:medium]', | |
+// '!password' => '', | |
+// ); | |
+// | |
+// $result = db_select('variable', 'v') | |
+// ->fields('v', array('name')) | |
+// ->condition('name', db_like('user_mail_') . '%', 'LIKE') | |
+// ->execute(); | |
+// | |
+// foreach ($result as $row) { | |
+// // Use variable_get() to get the unserialized value for free. | |
+// if ($value = variable_get($row->name, FALSE)) { | |
+// | |
+// if (empty($message) && (strpos($value, '!password') !== FALSE)) { | |
+// $message = t('The ability to send users their passwords in plain text has been removed in Drupal 7. Your existing email templates have been modified to remove it. You should <a href="@template-url">review these templates</a> to make sure they read properly.', array('@template-url' => url('admin/config/people/accounts'))); | |
+// } | |
+// | |
+// variable_set($row->name, str_replace(array_keys($tokens), $tokens, $value)); | |
+// } | |
+// } | |
+// | |
+// return $message; | |
+//} | |
+// | |
+///** | |
+// * Ensure there is an index on {users}.picture. | |
+// */ | |
+//function user_update_7018() { | |
+// if (!db_index_exists('users', 'picture')) { | |
+// db_add_index('users', 'picture', array('picture')); | |
+// } | |
+//} | |
/** | |
* @} End of "addtogroup updates-7.x-extra". |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment