From 70fbf15b69fcb0870abe4f9b08b59fb9d57f1979 Mon Sep 17 00:00:00 2001 From: pieter Date: Fri, 12 Dec 2025 05:25:50 +0000 Subject: [PATCH] =?UTF-8?q?templates/deployment.yaml=20=E3=82=92=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- templates/deployment.yaml | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/templates/deployment.yaml b/templates/deployment.yaml index 1cd368d..0cdf380 100644 --- a/templates/deployment.yaml +++ b/templates/deployment.yaml @@ -74,7 +74,6 @@ spec: define( 'WP_HOME', $protocol . '://' . $_SERVER['HTTP_HOST'] . '/' ); define( 'WP_SITEURL', $protocol . '://' . $_SERVER['HTTP_HOST'] . '/' ); - // Multisite設定 $multisite_enabled = getenv('WORDPRESS_MULTISITE_ENABLED'); if ( $multisite_enabled === 'true' ) { define('WP_ALLOW_MULTISITE', true); @@ -111,15 +110,7 @@ spec: max_attempts=30 attempt=0 while [ $attempt -lt $max_attempts ]; do - if php -r " - \$link = @mysqli_connect('${WORDPRESS_DB_HOST}', '${WORDPRESS_DB_USER}', '${WORDPRESS_DB_PASSWORD}', '${WORDPRESS_DB_NAME}'); - if (\$link) { - echo 'Connected'; - mysqli_close(\$link); - exit(0); - } - exit(1); - " 2>/dev/null; then + if php -r "\$link = @mysqli_connect('${WORDPRESS_DB_HOST}', '${WORDPRESS_DB_USER}', '${WORDPRESS_DB_PASSWORD}', '${WORDPRESS_DB_NAME}'); if (\$link) { echo 'Connected'; mysqli_close(\$link); exit(0); } exit(1);" 2>/dev/null; then echo "Database connection successful" break fi @@ -165,19 +156,17 @@ spec: echo "WordPress is already installed, skipping installation" if [ -f /tmp/wp-cli.phar ]; then echo "Running WordPress core update check..." - CURRENT_VERSION=$(cat /usr/src/wordpress/wp-includes/version.php | grep "wp_version = " | cut -d "'" -f 2 || echo "unknown") - echo "Target WordPress version: $CURRENT_VERSION" /tmp/wp-cli.phar --path=/var/www/html core update-db 2>/dev/null || echo "No database update needed" fi fi - {{- if .Values.wordpress.adsTxt.enabled }} +{{- if .Values.wordpress.adsTxt.enabled }} echo "Deploying ads.txt..." - cat > /var/www/html/ads.txt << 'EOF' - {{ .Values.wordpress.adsTxt.content }} - EOF + cat > /var/www/html/ads.txt << 'EOFADSTXT' +{{ .Values.wordpress.adsTxt.content }} +EOFADSTXT echo "ads.txt deployed" - {{- end }} +{{- end }} echo "=== WordPress Initialization Completed ===" volumeMounts: