Skip to content

Commit

Permalink
Fix #12735: Update upgrade script to handle retries in case of timeou…
Browse files Browse the repository at this point in the history
…ts for large databases
  • Loading branch information
vboctor committed Feb 2, 2011
1 parent 8eb95bc commit a8f6d4c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions admin/install_functions.php
Expand Up @@ -121,6 +121,22 @@ function install_date_migrate( $p_data) {
}
$t_new_column = implode( ',', $t_pairs );
$query = "SELECT $t_id_column, $t_old_column FROM $t_table";

$t_first_column = true;

# In order to handle large databases where we may timeout during the upgrade, we don't
# start form the beginning everytime. Here we will only pickup rows where at least one
# of the datetime fields wasn't upgraded yet and upgrade them all.
foreach ( $p_data[3] as $t_new_column_name ) {
if ( $t_first_column ) {
$t_first_column = false;
$query .= ' WHERE ';
} else {
$query .= ' OR ';
}

$query .= "$t_new_column_name = 1";
}
} else {
$t_old_column = $p_data[2];
$t_new_column = $p_data[3] . "=" . db_param();
Expand Down

0 comments on commit a8f6d4c

Please sign in to comment.