Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

error logging for insert errors on salsa

  • Loading branch information...
commit d4f8859e1843dc1a88903dcee67b6878118639b3 1 parent 69827ef
@radicaldesigns authored
Showing with 15 additions and 1 deletion.
  1. +15 −1 scripts/migrate.php
View
16 scripts/migrate.php
@@ -17,6 +17,7 @@ function migrate_slice($slice_offset, $limit){
echo "offset: $slice_offset limit: $limit fetched ".count($results)." results";
foreach($results AS $result){
foreach($result AS $field_key => $field_value){
+ if($field_key == "Last_Modified") echo $field_value;
if(in_array($field_key, $table_data['integer'])) $result[$field_key] = (integer) $field_value;
if(in_array($field_key, $table_data['boolean'])) $result[$field_value] = (bool) $field_value;
}
@@ -24,9 +25,22 @@ function migrate_slice($slice_offset, $limit){
$m->db_insert();
}
} catch(Exception $e){
+ global $db;
+ $error_message = $e->getMessage();
// in case of error, recursively fetch all slices around the error slice
echo "offset: $slice_offset limit: $limit error!\n";
- echo $e->getMessage()."\n";
+ echo $error_message."\n";
+ $db->query("
+ INSERT INTO `errors` (
+ `message`,
+ `extra_info`,
+ `timestamp`
+ ) VALUES (
+ '".$db->real_escape_string($error_message)."',
+ 'table: $table offset: $slice_offset limit: $limit error',
+ CURRENT_TIMESTAMP
+ )
+ ");
if($limit > 1){
$slice_1_limit = ceil($limit / 2);
$slice_2_limit = $limit - $slice_1_limit;
Please sign in to comment.
Something went wrong with that request. Please try again.