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