mirror of
https://github.com/getnamingo/registry.git
synced 2025-05-14 00:27:03 +02:00
Fixed #159
This commit is contained in:
parent
9003766ef6
commit
89ac087a3d
5 changed files with 18 additions and 7 deletions
|
@ -167,11 +167,12 @@ class RegistrarsController extends Controller
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
$registrar_id = $db->getLastInsertId();
|
$registrar_id = $db->getLastInsertId();
|
||||||
|
$prefix = 'R' . str_pad($registrar_id, 4, '0', STR_PAD_LEFT);
|
||||||
|
|
||||||
$db->exec(
|
$db->exec(
|
||||||
'UPDATE registrar SET prefix = ? WHERE id = ?',
|
'UPDATE registrar SET prefix = ? WHERE id = ?',
|
||||||
[
|
[
|
||||||
'R'.$registrar_id,
|
$prefix,
|
||||||
$registrar_id
|
$registrar_id
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
|
@ -105,7 +105,7 @@ CREATE TABLE IF NOT EXISTS `registry`.`registrar` (
|
||||||
`iana_id` int(5) DEFAULT NULL,
|
`iana_id` int(5) DEFAULT NULL,
|
||||||
`clid` varchar(16) NOT NULL,
|
`clid` varchar(16) NOT NULL,
|
||||||
`pw` varchar(256) NOT NULL,
|
`pw` varchar(256) NOT NULL,
|
||||||
`prefix` char(2) NOT NULL,
|
`prefix` char(5) NOT NULL,
|
||||||
`email` varchar(255) NOT NULL,
|
`email` varchar(255) NOT NULL,
|
||||||
`whois_server` varchar(255) NOT NULL,
|
`whois_server` varchar(255) NOT NULL,
|
||||||
`rdap_server` varchar(255) NOT NULL,
|
`rdap_server` varchar(255) NOT NULL,
|
||||||
|
|
|
@ -102,7 +102,7 @@ CREATE TABLE registrar (
|
||||||
"iana_id" int DEFAULT NULL,
|
"iana_id" int DEFAULT NULL,
|
||||||
"clid" varchar(16) NOT NULL,
|
"clid" varchar(16) NOT NULL,
|
||||||
"pw" varchar(256) NOT NULL,
|
"pw" varchar(256) NOT NULL,
|
||||||
"prefix" char(2) NOT NULL,
|
"prefix" char(5) NOT NULL,
|
||||||
"email" varchar(255) NOT NULL,
|
"email" varchar(255) NOT NULL,
|
||||||
"whois_server" varchar(255) NOT NULL,
|
"whois_server" varchar(255) NOT NULL,
|
||||||
"rdap_server" varchar(255) NOT NULL,
|
"rdap_server" varchar(255) NOT NULL,
|
||||||
|
|
|
@ -111,7 +111,7 @@ CREATE TABLE IF NOT EXISTS registrar (
|
||||||
iana_id INTEGER DEFAULT NULL,
|
iana_id INTEGER DEFAULT NULL,
|
||||||
clid VARCHAR(16) NOT NULL,
|
clid VARCHAR(16) NOT NULL,
|
||||||
pw VARCHAR(256) NOT NULL,
|
pw VARCHAR(256) NOT NULL,
|
||||||
prefix CHAR(2) NOT NULL,
|
prefix CHAR(5) NOT NULL,
|
||||||
email VARCHAR(255) NOT NULL,
|
email VARCHAR(255) NOT NULL,
|
||||||
whois_server VARCHAR(255) NOT NULL,
|
whois_server VARCHAR(255) NOT NULL,
|
||||||
rdap_server VARCHAR(255) NOT NULL,
|
rdap_server VARCHAR(255) NOT NULL,
|
||||||
|
|
|
@ -156,10 +156,20 @@ else
|
||||||
echo "New error_log table created successfully."
|
echo "New error_log table created successfully."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Modify column prefix from CHAR(2) to CHAR(5) in registrar table
|
||||||
|
echo "Updating prefix column in registrar table..."
|
||||||
|
mysql -u$DB_USER -p$DB_PASS $DB_NAME -e "ALTER TABLE registrar MODIFY prefix CHAR(5) NOT NULL;"
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "Warning: Failed to update prefix column in registrar table."
|
||||||
|
else
|
||||||
|
echo "Prefix column updated successfully."
|
||||||
|
fi
|
||||||
|
|
||||||
CONFIG_FILE="/opt/registry/automation/config.php"
|
CONFIG_FILE="/opt/registry/automation/config.php"
|
||||||
|
|
||||||
# Define the content to insert
|
# Define the content to insert
|
||||||
INSERT_CONTENT="\n // Registry Admin Email\n 'admin_email' => 'admin@example.com', // Receives system notifications\n\n // Exchange Rate Configuration\n 'exchange_rate_api_key' => "", // Your exchangerate.host API key\n 'exchange_rate_base_currency' => "USD",\n 'exchange_rate_currencies' => [\"EUR\", \"GBP\", \"JPY\", \"CAD\", \"AUD\"], // Configurable list\n"
|
INSERT_CONTENT="\n // Registry Admin Email\n 'admin_email' => 'admin@example.com', // Receives system notifications\n\n // Exchange Rate Configuration\n 'exchange_rate_api_key' => \"\", // Your exchangerate.host API key\n 'exchange_rate_base_currency' => 'USD',\n 'exchange_rate_currencies' => [\"EUR\", \"GBP\", \"JPY\", \"CAD\", \"AUD\"], // Configurable list\n"
|
||||||
|
|
||||||
# Check if 'admin_email' exists and insert only if it does not exist
|
# Check if 'admin_email' exists and insert only if it does not exist
|
||||||
if ! grep -q "'admin_email' => 'admin@example.com'" "$CONFIG_FILE"; then
|
if ! grep -q "'admin_email' => 'admin@example.com'" "$CONFIG_FILE"; then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue