templates/deployment.yaml を更新
This commit is contained in:
@@ -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,17 +156,15 @@ 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 }}
|
||||
|
||||
echo "Deploying ads.txt..."
|
||||
cat > /var/www/html/ads.txt << 'EOF'
|
||||
cat > /var/www/html/ads.txt << 'EOFADSTXT'
|
||||
{{ .Values.wordpress.adsTxt.content }}
|
||||
EOF
|
||||
EOFADSTXT
|
||||
echo "ads.txt deployed"
|
||||
{{- end }}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user