-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9a28705
commit 24b0cf6
Showing
11 changed files
with
270 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export AWS_DEFAULT_PROFILE=prof | ||
export AWS_ACCESS_KEY='access_key' | ||
export AWS_SECRET_ACCESS_KEY='access_key_secret' | ||
export AWS_EC2_KEYPAIR='keyname_of_ec2' | ||
export AWS_EC2_KEYPASS='path/to/key' | ||
export AWS_REGION='ap-northeast-1' | ||
export PRODUCT_VERSION='3.0.2-1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
184 changes: 184 additions & 0 deletions
184
site-cookbooks/lw1_moodle/files/default/lw1_tasks/install_amiage.php.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,184 @@ | ||
<?php | ||
// Sanity check. | ||
if ( false ) { | ||
?> | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<title>Error: PHP is not running</title> | ||
</head> | ||
<body class="wp-core-ui"> | ||
<h1 id="logo"><a href="http://amiage.com/" tabindex="-1">AMIMOTO AMI</a></h1> | ||
<h2>Error: PHP is not running</h2> | ||
<p>WordPress requires that your web server is running PHP. Your server does not have PHP installed, or PHP is turned off.</p> | ||
</body> | ||
</html> | ||
<?php | ||
} | ||
|
||
function wp_check_invalid_utf8( $string, $strip = false ) { | ||
$string = (string) $string; | ||
|
||
if ( 0 === strlen( $string ) ) { | ||
return ''; | ||
} | ||
|
||
// Check for support for utf8 in the installed PCRE library once and store the result in a static | ||
$utf8_pcre = @preg_match( '/^./u', 'a' ); | ||
// We can't demand utf8 in the PCRE installation, so just return the string in those cases | ||
if ( !$utf8_pcre ) { | ||
return $string; | ||
} | ||
|
||
// preg_match fails when it encounters invalid UTF8 in $string | ||
if ( 1 === @preg_match( '/^./us', $string ) ) { | ||
return $string; | ||
} | ||
|
||
// Attempt to strip the bad chars if requested (not recommended) | ||
if ( $strip && function_exists( 'iconv' ) ) { | ||
return iconv( 'utf-8', 'utf-8', $string ); | ||
} | ||
|
||
return ''; | ||
} | ||
|
||
function _wp_specialchars( $string, $quote_style = ENT_NOQUOTES, $charset = 'UTF-8' ) { | ||
$string = (string) $string; | ||
|
||
if ( 0 === strlen( $string ) ) | ||
return ''; | ||
|
||
// Don't bother if there are no specialchars - saves some processing | ||
if ( ! preg_match( '/[&<>"\']/', $string ) ) | ||
return $string; | ||
|
||
// Account for the previous behaviour of the function when the $quote_style is not an accepted value | ||
if ( empty( $quote_style ) ) | ||
$quote_style = ENT_NOQUOTES; | ||
elseif ( ! in_array( $quote_style, array( 0, 2, 3, 'single', 'double' ), true ) ) | ||
$quote_style = ENT_QUOTES; | ||
|
||
// Store the site charset as a static to avoid multiple calls to wp_load_alloptions() | ||
if ( in_array( $charset, array( 'utf8', 'utf-8', 'UTF8' ) ) ) | ||
$charset = 'UTF-8'; | ||
|
||
$_quote_style = $quote_style; | ||
|
||
if ( $quote_style === 'double' ) { | ||
$quote_style = ENT_COMPAT; | ||
$_quote_style = ENT_COMPAT; | ||
} elseif ( $quote_style === 'single' ) { | ||
$quote_style = ENT_NOQUOTES; | ||
} | ||
|
||
// Handle double encoding ourselves | ||
$string = @htmlspecialchars( $string, $quote_style, $charset ); | ||
|
||
// Backwards compatibility | ||
if ( 'single' === $_quote_style ) | ||
$string = str_replace( "'", ''', $string ); | ||
|
||
return $string; | ||
} | ||
|
||
function esc_attr( $text ) { | ||
$safe_text = wp_check_invalid_utf8( $text ); | ||
$safe_text = _wp_specialchars( $safe_text, ENT_QUOTES ); | ||
return $safe_text; | ||
} | ||
|
||
$instance_id = trim(isset($_POST['instance_id']) ? $_POST['instance_id'] : ''); | ||
$err_msg = ''; | ||
$nfs_client = false; | ||
if (isset($_POST['instance_id'])) { | ||
//$valid_instance_ids = array(file_get_contents('http://169.254.169.254/latest/meta-data/instance-id')); | ||
$valid_instance_ids = array('<%= @instance_id %>'); | ||
if ( file_exists('/opt/aws/cloud_formation.json') ) { | ||
$data = json_decode(file_get_contents('/opt/aws/cloud_formation.json'), true); | ||
if ( isset($data['nfs']) ) { | ||
$valid_instance_ids[] = trim($data['nfs']['server']['instance-id']); | ||
$nfs_client = true; | ||
} | ||
unset($data); | ||
} | ||
if ( in_array($instance_id,$valid_instance_ids) ) { | ||
$host_name = esc_attr($_SERVER['SERVER_NAME']); | ||
// file_put_contents(dirname(dirname(__FILE__)).'/.valid.'.$host_name, 'valid'); | ||
unlink(__FILE__); | ||
header('Location: /'); | ||
} else { | ||
$err_msg = 'Sorry, that isn’t a valid instance ID.'; | ||
} | ||
} | ||
|
||
?> | ||
<!DOCTYPE html> | ||
<html xmlns="http://www.w3.org/1999/xhtml"> | ||
<head> | ||
<meta name="viewport" content="width=device-width" /> | ||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | ||
<title>Installation</title> | ||
<link rel='stylesheet' id='buttons-css' href='//amimoto-ami.com/wp-includes/css/buttons.min.css?ver=4.1' type='text/css' media='all' /> | ||
<link rel='stylesheet' id='open-sans-css' href='//fonts.googleapis.com/css?family=Open+Sans%3A300italic%2C400italic%2C600italic%2C300%2C400%2C600&subset=latin%2Clatin-ext&ver=4.1' type='text/css' media='all' /> | ||
<link rel='stylesheet' id='install-css' href='//amimoto-ami.com/wp-admin/css/install.min.css?ver=4.1' type='text/css' media='all' /> | ||
<style type="text/css"> | ||
#logo a { | ||
background: url(//amiage.com/wp-content/themes/amiage.com/images/site-title.png) no-repeat !important; | ||
margin: -150px auto 25px; | ||
width: 175px; | ||
height: 104px; | ||
background-size: 104px auto; | ||
} | ||
</style> | ||
</head> | ||
<body class="wp-core-ui"> | ||
<h1 id="logo"><a href="http://amiage.com/" tabindex="-1">AMIMOTO AMI</a></h1> | ||
|
||
<h1>Welcome to AMIAGE AMI</h1> | ||
|
||
<p>Please enter your Instance ID to continue installation.</p> | ||
|
||
<?php | ||
if ( !empty($err_msg) ) { | ||
printf('<p class="message">%s</p>'."\n", $err_msg); | ||
} | ||
?> | ||
<form id="setup" method="post" action="install_amiage.php" novalidate="novalidate"> | ||
<table class="form-table"> | ||
<tr> | ||
<th scope="row"><label for="instance_id"><?php echo $nfs_client ? 'Your NFS Server Instance ID' : 'Your Instance ID'; ?></label></th> | ||
<td> | ||
<input name="instance_id" type="text" id="instance_id" size="25" value="<?php echo esc_attr($instance_id); ?>" /> | ||
</tr> | ||
</table> | ||
<p class="step"><input type="submit" name="Submit" value="Next Step" class="button button-large" /></p> | ||
<input type="hidden" name="language" value="" /> | ||
</form> | ||
<script type="text/javascript">var t = document.getElementById('weblog_title'); if (t){ t.focus(); }</script> | ||
<script type='text/javascript' src='//amimoto-ami.com/wp-includes/js/jquery/jquery.js?ver=1.11.1'></script> | ||
<script type='text/javascript' src='//amimoto-ami.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'></script> | ||
<script type='text/javascript'> | ||
/* <![CDATA[ */ | ||
var _zxcvbnSettings = {"src":"\/\/amimoto-ami.com\/wp-includes\/js\/zxcvbn.min.js"}; | ||
/* ]]> */ | ||
</script> | ||
<script type='text/javascript' src='//amimoto-ami.com/wp-includes/js/zxcvbn-async.min.js?ver=1.0'></script> | ||
<script type='text/javascript'> | ||
/* <![CDATA[ */ | ||
var pwsL10n = {"empty":"\u5f37\u5ea6\u8868\u793a\u5668","short":"\u975e\u5e38\u306b\u5f31\u3044","bad":"\u5f31\u3044","good":"\u666e\u901a","strong":"\u5f37\u529b","mismatch":"\u4e0d\u4e00\u81f4"}; | ||
/* ]]> */ | ||
</script> | ||
<script type='text/javascript' src='//amimoto-ami.com/wp-admin/js/password-strength-meter.min.js?ver=4.1'></script> | ||
<script type='text/javascript' src='//amimoto-ami.com/wp-includes/js/underscore.min.js?ver=1.6.0'></script> | ||
<script type='text/javascript'> | ||
/* <![CDATA[ */ | ||
var _wpUtilSettings = {"ajax":{"url":"\/wp-admin\/admin-ajax.php"}}; | ||
/* ]]> */ | ||
</script> | ||
<script type='text/javascript' src='//amimoto-ami.com/wp-includes/js/wp-util.min.js?ver=4.1'></script> | ||
<script type='text/javascript' src='//amimoto-ami.com/wp-admin/js/user-profile.min.js?ver=4.1'></script> | ||
<script type='text/javascript' src='//amimoto-ami.com/wp-admin/js/language-chooser.min.js?ver=4.1'></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<Directory "/var/www/html"> | ||
## InstanceID Checker >>> | ||
# You can remove this lines after registration. | ||
RewriteEngine On | ||
RewriteOptions InheritBefore | ||
RewriteCond /var/www/html/install_amiage.php -f | ||
RewriteCond %{REQUEST_URI} !^/install_amiage.php [NC] | ||
RewriteRule .* /install_amiage.php [R=302,L] | ||
## << InstanceID Checker | ||
|
||
Require all granted | ||
AllowOverride All | ||
Order allow,deny | ||
Allow from all | ||
</Directory> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters