Skip to content

Commit

Permalink
Disable query logging (if enabled) during potentially long processes …
Browse files Browse the repository at this point in the history
…to avoid out of memory errors (due to constructing large arrays in database_api of queries)
  • Loading branch information
mantis committed May 17, 2009
1 parent fcf225e commit e2b4fee
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions admin/install_functions.php
Expand Up @@ -27,10 +27,18 @@
* Migrate the legacy category data to the new category_id-based schema.
*/
function install_category_migrate() {
global $g_db_log_queries;

$t_bug_table = db_get_table( 'mantis_bug_table' );
$t_category_table = db_get_table( 'mantis_category_table' );
$t_project_category_table = db_get_table( 'mantis_project_category_table' );

// disable query logging (even if it's enabled in config for this)
if( $g_db_log_queries !== 0) {
$t_log_queries = $g_db_log_queries;
$g_db_log_queries = 0;
}

$query = "SELECT project_id, category FROM $t_project_category_table ORDER BY project_id, category";
$t_category_result = db_query_bound( $query );

Expand Down Expand Up @@ -74,13 +82,25 @@ function install_category_migrate() {
}
}

// re-enabled query logging if we disabled it
if( $t_log_queries !== null) {
$g_db_log_queries = $t_log_queries;
}

# return 2 because that's what ADOdb/DataDict does when things happen properly
return 2;
}

function install_date_migrate( $p_data) {
// $p_data[0] = tablename, [1] id column, [2] = old column, [3] = new column
global $g_db_log_queries;

// disable query logging (even if it's enabled in config for this)
if( $g_db_log_queries !== 0) {
$t_log_queries = $g_db_log_queries;
$g_db_log_queries = 0;
}

$t_table = db_get_table( $p_data[0] );
$t_id_column = $p_data[1];
$t_old_column = $p_data[2];
Expand All @@ -104,6 +124,11 @@ function install_date_migrate( $p_data) {
db_query_bound( $query, array( $t_new_value, $t_id ) );
}

// re-enabled query logging if we disabled it
if( $t_log_queries !== null) {
$g_db_log_queries = $t_log_queries;
}

# return 2 because that's what ADOdb/DataDict does when things happen properly
return 2;

Expand Down

0 comments on commit e2b4fee

Please sign in to comment.