diff options
| author | Nathaniel Guse <nathaniel.guse@gmail.com> | 2012-11-10 05:59:01 -0600 |
|---|---|---|
| committer | Nathan Guse <nathaniel.guse@gmail.com> | 2013-01-09 16:42:44 -0600 |
| commit | 2a7985c26fcf558c30fa316262344307ffc99e9e (patch) | |
| tree | da1a3d2c554c07ab0b8a77849520699afd0277bf /phpBB/includes/db/migration/v307rc2.php | |
| parent | e7389e4c32f031fc6025880adf22b40d7d195f27 (diff) | |
| download | forums-2a7985c26fcf558c30fa316262344307ffc99e9e.tar forums-2a7985c26fcf558c30fa316262344307ffc99e9e.tar.gz forums-2a7985c26fcf558c30fa316262344307ffc99e9e.tar.bz2 forums-2a7985c26fcf558c30fa316262344307ffc99e9e.tar.xz forums-2a7985c26fcf558c30fa316262344307ffc99e9e.zip | |
[feature/migrations] Migrations back through 3.0.6
PHPBB3-9737
Diffstat (limited to 'phpBB/includes/db/migration/v307rc2.php')
| -rw-r--r-- | phpBB/includes/db/migration/v307rc2.php | 29 |
1 files changed, 23 insertions, 6 deletions
diff --git a/phpBB/includes/db/migration/v307rc2.php b/phpBB/includes/db/migration/v307rc2.php index f9492f3d1c..438ebfb8c2 100644 --- a/phpBB/includes/db/migration/v307rc2.php +++ b/phpBB/includes/db/migration/v307rc2.php @@ -21,15 +21,26 @@ class phpbb_db_migration_v307rc2 extends phpbb_db_migration function update_data() { + return array( + array('custom', array(array(&$this, 'update_email_hash'))), + ); + } + + function update_email_hash($start = 0) + { + $limit = 1000; + $sql = 'SELECT user_id, user_email, user_email_hash FROM ' . USERS_TABLE . ' WHERE user_type <> ' . USER_IGNORE . " AND user_email <> ''"; - $result = $db->sql_query($sql); + $result = $this->db->sql_query_limit($sql, $limit, $start); $i = 0; - while ($row = $db->sql_fetchrow($result)) + while ($row = $this->db->sql_fetchrow($result)) { + $i++; + // Snapshot of the phpbb_email_hash() function // We cannot call it directly because the auto updater updates the DB first. :/ $user_email_hash = sprintf('%u', crc32(strtolower($row['user_email']))) . strlen($row['user_email']); @@ -41,13 +52,19 @@ class phpbb_db_migration_v307rc2 extends phpbb_db_migration ); $sql = 'UPDATE ' . USERS_TABLE . ' - SET ' . $db->sql_build_array('UPDATE', $sql_ary) . ' + SET ' . $this->db->sql_build_array('UPDATE', $sql_ary) . ' WHERE user_id = ' . (int) $row['user_id']; - _sql($sql, $errored, $error_ary, ($i % 100 == 0)); - - ++$i; + $this->sql_query($sql); } } $db->sql_freeresult($result); + + if ($i < $limit) + { + // Completed + return false; + } + + return $start + $limit; } } |
