github.com/niedbalski/juju@v0.0.0-20190215020005-8ff100488e47/acceptancetests/repository/charms/wordpress/hooks/upgrade-charm (about)

     1  #!/bin/bash
     2  
     3  # Run the install again!
     4  hooks/install
     5  
     6  wp_install_path="/var/www/"
     7  
     8  if [ -f "$wp_install_path/wp-config.php" ]; then
     9  	chown -R www-data.www-data $wp_install_path
    10  
    11  	hooks/config-changed
    12  
    13  	juju-log "Upgrading WordPress core..."
    14  	wp core update --path=$wp_install_path
    15  
    16  	# Patch to fix old installations that didn't cookie properly
    17  	if [ -f "$wp_install_path/wp-info.php" ] && [ -f .wp-secret ]; then
    18  		secret_key=`cat .wp-secret`
    19  		sed -i -e "s/define('SECRET_KEY',.*/define('SECRET_KEY', '$secret_key')\;/" $wp_install_path/wp-info.php
    20  	fi
    21  fi
    22  
    23  hooks/restart