Work on dashboard speed

This commit is contained in:
Pinga 2025-04-19 15:05:25 +03:00
parent f61672d691
commit 347e20757a
4 changed files with 29 additions and 18 deletions

View file

@ -934,6 +934,10 @@ INSERT INTO `registry`.`settings` (`name`, `value`) VALUES
('rdap_server', 'https://rdap.example.com'), ('rdap_server', 'https://rdap.example.com'),
('currency', 'USD'); ('currency', 'USD');
CREATE INDEX idx_domain_crdate ON domain (crdate DESC);
CREATE INDEX idx_domain_exdate ON domain (exdate);
CREATE INDEX idx_support_tickets_date_created ON support_tickets (date_created);
CREATE DATABASE IF NOT EXISTS `registryTransaction`; CREATE DATABASE IF NOT EXISTS `registryTransaction`;
CREATE TABLE IF NOT EXISTS `registryTransaction`.`transaction_identifier` ( CREATE TABLE IF NOT EXISTS `registryTransaction`.`transaction_identifier` (

View file

@ -912,4 +912,8 @@ ALTER TABLE premium_domain_pricing ADD FOREIGN KEY ("category_id") REFERENCES pr
ALTER TABLE support_tickets ADD FOREIGN KEY ("user_id") REFERENCES users(id); ALTER TABLE support_tickets ADD FOREIGN KEY ("user_id") REFERENCES users(id);
ALTER TABLE users_audit ADD FOREIGN KEY ("user_id") REFERENCES users(id); ALTER TABLE users_audit ADD FOREIGN KEY ("user_id") REFERENCES users(id);
ALTER TABLE support_tickets ADD FOREIGN KEY ("category_id") REFERENCES ticket_categories(id); ALTER TABLE support_tickets ADD FOREIGN KEY ("category_id") REFERENCES ticket_categories(id);
ALTER TABLE ticket_responses ADD FOREIGN KEY ("ticket_id") REFERENCES support_tickets(id); ALTER TABLE ticket_responses ADD FOREIGN KEY ("ticket_id") REFERENCES support_tickets(id);
CREATE INDEX idx_domain_crdate ON domain (crdate DESC);
CREATE INDEX idx_domain_exdate ON domain (exdate);
CREATE INDEX idx_support_tickets_date_created ON support_tickets (date_created);

View file

@ -375,6 +375,9 @@ CREATE TABLE IF NOT EXISTS domain (
FOREIGN KEY (acid) REFERENCES registrar(id), FOREIGN KEY (acid) REFERENCES registrar(id),
FOREIGN KEY (tldid) REFERENCES domain_tld(id) FOREIGN KEY (tldid) REFERENCES domain_tld(id)
); );
CREATE INDEX idx_domain_crdate ON domain (crdate);
CREATE INDEX idx_domain_exdate ON domain (exdate);
CREATE INDEX idx_support_tickets_date_created ON support_tickets (date_created);
-- application -- application
CREATE TABLE IF NOT EXISTS application ( CREATE TABLE IF NOT EXISTS application (

View file

@ -116,24 +116,24 @@ composer_update "/opt/registry/whois/port43"
composer_update "/opt/registry/rdap" composer_update "/opt/registry/rdap"
composer_update "/opt/registry/epp" composer_update "/opt/registry/epp"
# Function to ensure a setting is present, uncommented, and correctly set CONFIG_FILE="/opt/registry/rdap/config.php"
set_php_ini_value() {
local ini_file=$1
local key=$2
local value=$3
# Escape slashes for sed compatibility # Extract database credentials from the config file
local escaped_value DB_NAME=$(grep "'db_database'" "$CONFIG_FILE" | awk -F "=> " '{print $2}' | tr -d "',")
escaped_value=$(printf '%s\n' "$value" | sed 's/[\/&]/\\&/g') DB_USER=$(grep "'db_username'" "$CONFIG_FILE" | awk -F "=> " '{print $2}' | tr -d "',")
DB_PASS=$(grep "'db_password'" "$CONFIG_FILE" | awk -F "=> " '{print $2}' | tr -d "',")
if grep -Eq "^\s*[;#]?\s*${key}\s*=" "$ini_file"; then # Add indexes for performance improvements
# Update the existing line, uncomment it and set correct value echo "Creating index idx_domain_crdate..."
sed -i -E "s|^\s*[;#]?\s*(${key})\s*=.*|\1 = ${escaped_value}|" "$ini_file" mysql -u$DB_USER -p$DB_PASS $DB_NAME -e "CREATE INDEX idx_domain_crdate ON domain (crdate DESC);"
else
# Add new line if key doesn't exist echo "Creating index idx_domain_exdate..."
echo "${key} = ${value}" >> "$ini_file" mysql -u$DB_USER -p$DB_PASS $DB_NAME -e "CREATE INDEX idx_domain_exdate ON domain (exdate);"
fi
} echo "Creating index idx_support_tickets_date_created..."
mysql -u$DB_USER -p$DB_PASS $DB_NAME -e "CREATE INDEX idx_support_tickets_date_created ON support_tickets (date_created);"
echo "Database structure updated successfully."
# Check the Linux distribution and version # Check the Linux distribution and version
if [[ -e /etc/os-release ]]; then if [[ -e /etc/os-release ]]; then
@ -196,7 +196,7 @@ apt update
# Install MariaDB and PHP MySQL module # Install MariaDB and PHP MySQL module
apt install -y mariadb-client mariadb-server ${PHP_VERSION}-mysql apt install -y mariadb-client mariadb-server ${PHP_VERSION}-mysql
systemctl restart mariadb
echo "MariaDB updated..." echo "MariaDB updated..."
# Restart PHP-FPM service # Restart PHP-FPM service