--- ip2cc.install[1].bak 2007-02-21 08:41:44.000000000 +0100 +++ ip2cc.install 2007-02-24 17:21:16.729763300 +0100 @@ -33,10 +33,15 @@ ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */ ;"); - ip2cc_insert_batch('iso3166.mysql'); -/* - ip2cc_insert_batch('ipdb.mysql'); -*/ + ip2cc_batch_insert('iso3166.mysql'); + if (!ini_get('safe_mode')) { + set_time_limit(0); + ip2cc_batch_insert('ipdb.mysql'); + } + else { + drupal_set_message(t('Since you are in safe_mode, please manually import IP database by small range at update page to prevent execution timeout issue.')); + } + break; } } @@ -48,11 +53,12 @@ } */ -function ip2cc_insert_batch($filename) { +function ip2cc_batch_insert($filename) { if ($fd = fopen(drupal_get_path('module','ip2cc').'/'.$filename, 'r')) { while (!feof($fd)) { - $line = fgets($fd); - _db_query(db_prefix_tables($line)); + if ($line = fgets($fd)) { + _db_query(db_prefix_tables($line)); + } $line = NULL; } fclose($fd);