| version 1.16, 2023/12/19 15:35:42 |
version 1.17, 2023/12/23 22:04: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 |
* 2023-12-13 - implemented --debug multi option |
| */ |
*/ |
| |
|
| /* $Platon: scripts/php/sk-nic/sk-nic.php,v 1.15 2023/12/14 00:21:13 nepto Exp $ */ |
/* $Platon: scripts/php/sk-nic/sk-nic.php,v 1.16 2023/12/19 15:35:42 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 |
| |
|
| $DO_DEBUG = false; |
$FILENAME = ''; |
| $FILENAME = @$_SERVER['argv'][1]; |
$DO_DEBUG = 0; |
| if ($FILENAME == '--debug') { |
for ($i = 1; ; $i++) { |
| $DO_DEBUG = true; |
$FILENAME = @$_SERVER['argv'][$i]; |
| $FILENAME = @$_SERVER['argv'][2]; |
if ($FILENAME != '--debug') { |
| |
break; |
| |
} |
| |
$DO_DEBUG++; |
| } |
} |
| |
|
| if (strlen($FILENAME) <= 0) { |
if (strlen($FILENAME) <= 0) { |
| printf('Usage: %s [ --debug ] <filename>'."\n", $_SERVER['argv'][0]); |
printf('Usage: %s [ --debug [ --debug ] ] <filename>'."\n", $_SERVER['argv'][0]); |
| exit; |
exit; |
| } |
} |
| if (! file_exists($FILENAME)) { |
if (! file_exists($FILENAME)) { |
| Line 49 require_once dirname(__FILE__).'/SK-NIC. |
|
| Line 52 require_once dirname(__FILE__).'/SK-NIC. |
|
| # This enables CLIENT_LOCAL_FILES flag, see: |
# This enables CLIENT_LOCAL_FILES flag, see: |
| # 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, $DO_DEBUG); |
| $sk_nic->setContextFromFilename($FILENAME); |
$sk_nic->setContextFromFilename($FILENAME); |
| if (! $sk_nic->doImport($FILENAME)) { |
|
| |
$changed_date = $sk_nic->doImport($FILENAME); |
| |
if (empty($changed_date)) { |
| fprintf(STDERR, "ERROR: file is too old: $FILENAME\n"); |
fprintf(STDERR, "ERROR: file is too old: $FILENAME\n"); |
| fprintf(STDERR, " was this file already imported?\n"); |
fprintf(STDERR, " was this file already imported?\n"); |
| exit(2); |
exit(2); |
| |
} else { |
| |
if ($DO_DEBUG) { |
| |
echo "INFO: using changed_date: $changed_date\n"; |
| |
} |
| |
} |
| |
|
| |
if (! $sk_nic->checkImport()) { |
| |
fprintf(STDERR, "ERROR: imported data are not valid\n"); |
| |
exit(3); |
| } |
} |
| $sk_nic->checkImport(); |
|
| |
|
| // only for domains |
// only for domains |
| if ($sk_nic->context == 'domain') { |
if ($sk_nic->context == 'domain') { |
| Line 65 if ($sk_nic->context == 'domain') { |
|
| Line 78 if ($sk_nic->context == 'domain') { |
|
| $sk_nic->writeStats(); |
$sk_nic->writeStats(); |
| } |
} |
| |
|
| $changed_records = $sk_nic->doComparison($DO_DEBUG); |
$changed_records = $sk_nic->doComparison(); |
| if ($sk_nic->context == 'domain') { |
if ($sk_nic->context == 'domain') { |
| if ($changed_records <= 100) { |
if ($changed_records <= 100) { |
| fprintf(STDERR, 'WARNING: too less changed domain records: %d'."\n", $changed_records); |
fprintf(STDERR, 'WARNING: too less changed domain records: %d'."\n", $changed_records); |