| version 1.14, 2023/01/05 19:45:21 |
version 1.15, 2023/12/14 00:21:13 |
|
|
| * 2007-03-09 - created |
* 2007-03-09 - created |
| * 2017-09-12 - implemented new SK-NIC-EPP/CentralNic export |
* 2017-09-12 - implemented new SK-NIC-EPP/CentralNic export |
| * 2017-10-07 - added import of expired domains (droplist) |
* 2017-10-07 - added import of expired domains (droplist) |
| |
* 2023-12-13 - implemented --debug option |
| */ |
*/ |
| |
|
| /* $Platon: scripts/php/sk-nic/sk-nic.php,v 1.13 2017/10/07 09:33:42 nepto Exp $ */ |
/* $Platon: scripts/php/sk-nic/sk-nic.php,v 1.14 2023/01/05 19:45:21 nepto Exp $ */ |
| |
|
| error_reporting(E_ALL); |
error_reporting(E_ALL); |
| ini_set('mysqli.allow_local_infile', true); // probably has no effect |
ini_set('mysqli.allow_local_infile', true); // probably has no effect |
| |
|
| $filename = @$_SERVER['argv'][1]; |
$DO_DEBUG = false; |
| |
$FILENAME = @$_SERVER['argv'][1]; |
| |
if ($FILENAME == '--debug') { |
| |
$DO_DEBUG = true; |
| |
$FILENAME = @$_SERVER['argv'][2]; |
| |
} |
| |
|
| if (strlen($filename) <= 0) { |
if (strlen($FILENAME) <= 0) { |
| printf('Usage: %s filename'."\n", $_SERVER['argv'][0]); |
printf('Usage: %s [ --debug ] <filename>'."\n", $_SERVER['argv'][0]); |
| exit; |
exit; |
| } |
} |
| if (! file_exists($filename)) { |
if (! file_exists($FILENAME)) { |
| die("ERROR: file does not exist: $filename\n"); |
die("ERROR: file does not exist: $FILENAME\n"); |
| } |
} |
| if (! is_readable($filename)) { |
if (! is_readable($FILENAME)) { |
| die("ERROR: file is not readable: $filename\n"); |
die("ERROR: file is not readable: $FILENAME\n"); |
| } |
} |
| |
|
| $dsn = 'mysql://test:test@localhost/test'; |
$dsn = 'mysql://test:test@localhost/test'; |
| Line 44 require_once dirname(__FILE__).'/SK-NIC. |
|
| Line 50 require_once dirname(__FILE__).'/SK-NIC. |
|
| # http://www.php.net/manual/en/mysql.constants.php |
# http://www.php.net/manual/en/mysql.constants.php |
| $dsn .= '?client_flags=128'; |
$dsn .= '?client_flags=128'; |
| $sk_nic = new SK_NIC($dsn); |
$sk_nic = new SK_NIC($dsn); |
| $sk_nic->setContextFromFilename($filename); |
$sk_nic->setContextFromFilename($FILENAME); |
| if (! $sk_nic->doImport($filename)) { |
if (! $sk_nic->doImport($FILENAME)) { |
| fprintf(STDERR, "ERROR: imported file is too old; already imported?\n"); |
fprintf(STDERR, "ERROR: file is too old: $FILENAME\n"); |
| |
fprintf(STDERR, " was this file already imported?\n"); |
| exit(2); |
exit(2); |
| } |
} |
| $sk_nic->checkImport(); |
$sk_nic->checkImport(); |
| Line 57 if ($sk_nic->context == 'domain') { |
|
| Line 64 if ($sk_nic->context == 'domain') { |
|
| $sk_nic->writeStats(); |
$sk_nic->writeStats(); |
| } |
} |
| |
|
| $changed_records = $sk_nic->doComparison(); |
$changed_records = $sk_nic->doComparison($DO_DEBUG); |
| if ($sk_nic->context == 'domain') { |
if ($sk_nic->context == 'domain') { |
| if ($changed_records <= 100) { |
if ($changed_records <= 100) { |
| fprintf(STDERR, 'WARNING: too less changed records: %d'."\n", $changed_records); |
fprintf(STDERR, 'WARNING: too less changed domain records: %d'."\n", $changed_records); |
| } elseif ($changed_records >= 50000) { |
} elseif ($changed_records >= 50000) { |
| fprintf(STDERR, 'WARNING: too many changed records: %d'."\n", $changed_records); |
fprintf(STDERR, 'WARNING: too many changed domain records: %d'."\n", $changed_records); |
| } else{ |
} else{ |
| fprintf(STDERR, 'INFO: changed %s records: %d'."\n", $sk_nic->context, $changed_records); |
fprintf(STDERR, 'INFO: changed %s records: %d'."\n", $sk_nic->context, $changed_records); |
| } |
} |