增加GAE支持

This commit is contained in:
joyqi
2013-10-18 11:54:19 +08:00
parent ee60c7e01f
commit a0cb9d64f6
5 changed files with 81 additions and 43 deletions

View File

@@ -2,7 +2,7 @@
<?php if (defined('SAE_MYSQL_DB')): ?>
<!-- SAE -->
<h3><?php _e('系统将为自动匹配 %s 环境的安装选项', 'SAE'); ?></h3>
<h3><?php _e('系统将为自动匹配 %s 环境的安装选项', 'SAE'); ?></h3>
<input type="hidden" name="config" value="array (
'host' => SAE_MYSQL_HOST_M,
'user' => SAE_MYSQL_USER,
@@ -18,10 +18,10 @@
<input type="hidden" name="dbDatabase" value="<?php echo SAE_MYSQL_DB; ?>" />
<?php elseif (!!getenv('HTTP_BAE_ENV_ADDR_SQL_IP')): ?>
<!-- BAE -->
<h3><?php _e('系统将为自动匹配 %s 环境的安装选项', 'BAE'); ?></h3>
<h3><?php _e('系统将为自动匹配 %s 环境的安装选项', 'BAE'); ?></h3>
<li>
<label class="typecho-label"><?php _e('数据库名'); ?></label>
<input type="text" class="text" name="dbDatabase" value="<?php _v('dbDatabase', 'typecho'); ?>" />
<label class="typecho-label" for="dbDatabase"><?php _e('数据库名'); ?></label>
<input type="text" class="text" id="dbDatabase" name="dbDatabase" value="<?php _v('dbDatabase', 'typecho'); ?>" />
<p class="description"><?php _e('请您指定数据库名称'); ?></p>
</li>
<input type="hidden" name="config" value="array (
@@ -36,29 +36,66 @@
<input type="hidden" name="dbPort" value="<?php echo getenv('HTTP_BAE_ENV_ADDR_SQL_PORT'); ?>" />
<input type="hidden" name="dbUser" value="<?php echo getenv('HTTP_BAE_ENV_AK'); ?>" />
<input type="hidden" name="dbPassword" value="<?php echo getenv('HTTP_BAE_ENV_SK'); ?>" />
<?php elseif (isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'],'Google App Engine') !== false): ?>
<!-- GAE -->
<h3><?php _e('系统将为您自动匹配 %s 环境的安装选项', 'GAE'); ?></h3>
<li>
<label class="typecho-label" for="dbPort"><?php _e('数据库实例名'); ?></label>
<input type="text" class="text" name="dbPort" id="dbPort" value="<?php _v('dbPort'); ?>"/>
<p class="description"><?php _e('请填入您在Cloud SQL面板中创建的数据库实例名称'); ?></p>
</li>
<li>
<label class="typecho-label" for="dbUser"><?php _e('数据库用户名'); ?></label>
<input type="text" class="text" name="dbUser" id="dbUser" value="<?php _v('dbUser'); ?>" />
</li>
<li>
<label class="typecho-label" for="dbPassword"><?php _e('数据库密码'); ?></label>
<input type="password" class="text" name="dbPassword" id="dbPassword" value="<?php _v('dbPassword'); ?>" />
</li>
<li>
<label class="typecho-label" for="dbDatabase"><?php _e('数据库名'); ?></label>
<input type="text" class="text" name="dbDatabase" id="dbDatabase" value="<?php _v('dbDatabase', 'typecho'); ?>" />
<p class="description"><?php _e('请填入您在Cloud SQL的实例中创建的数据库名称'); ?></p>
</li>
<?php if (0 === strpos($adapter, 'Pdo_')): ?>
<input type="hidden" name="config" value="array (
'dsn' => 'mysql:dbname={database};unix_socket=/cloudsql/{host}:{port};charset=<?php _e('utf8'); ?>',
'user' => '{user}',
'password' => '{password}'
)" />
<?php else: ?>
<input type="hidden" name="config" value="array (
'host' => ':/cloudsql/{host}:{port}',
'database' => '{database}',
'user' => '{user}',
'password' => '{password}'
)" />
<?php endif; ?>
<input type="hidden" name="dbHost" value="<?php echo $_SERVER['APPLICATION_ID'] ?>" />
<?php else: ?>
<li>
<label class="typecho-label"><?php _e('数据库地址'); ?></label>
<input type="text" class="text" name="dbHost" value="<?php _v('dbHost', 'localhost'); ?>"/>
<label class="typecho-label" for="dbHost"><?php _e('数据库地址'); ?></label>
<input type="text" class="text" name="dbHost" id="dbHost" value="<?php _v('dbHost', 'localhost'); ?>"/>
<p class="description"><?php _e('您可能会使用 "localhost"'); ?></p>
</li>
<li>
<label class="typecho-label"><?php _e('数据库端口'); ?></label>
<input type="text" class="text" name="dbPort" value="<?php _v('dbPort', '3306'); ?>"/>
<label class="typecho-label" for="dbPort"><?php _e('数据库端口'); ?></label>
<input type="text" class="text" name="dbPort" id="dbPort" value="<?php _v('dbPort', '3306'); ?>"/>
<p class="description"><?php _e('如果您不知道此选项的意义, 请保留默认设置'); ?></p>
</li>
<li>
<label class="typecho-label"><?php _e('数据库用户名'); ?></label>
<input type="text" class="text" name="dbUser" value="<?php _v('dbUser', 'root'); ?>" />
<label class="typecho-label" for="dbUser"><?php _e('数据库用户名'); ?></label>
<input type="text" class="text" name="dbUser" id="dbUser" value="<?php _v('dbUser', 'root'); ?>" />
<p class="description"><?php _e('您可能会使用 "root"'); ?></p>
</li>
<li>
<label class="typecho-label"><?php _e('数据库密码'); ?></label>
<input type="password" class="text" name="dbPassword" value="<?php _v('dbPassword'); ?>" />
<label class="typecho-label" for="dbPassword"><?php _e('数据库密码'); ?></label>
<input type="password" class="text" name="dbPassword" id="dbPassword" value="<?php _v('dbPassword'); ?>" />
</li>
<li>
<label class="typecho-label"><?php _e('数据库名'); ?></label>
<input type="text" class="text" name="dbDatabase" value="<?php _v('dbDatabase', 'typecho'); ?>" />
<label class="typecho-label" for="dbDatabase"><?php _e('数据库名'); ?></label>
<input type="text" class="text" name="dbDatabase" id="dbDatabase" value="<?php _v('dbDatabase', 'typecho'); ?>" />
<p class="description"><?php _e('请您指定数据库名称'); ?></p>
</li>

View File

@@ -1,26 +1,26 @@
<?php if(!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<li>
<label class="typecho-label"><?php _e('数据库地址'); ?></label>
<input type="text" class="text" name="dbHost" value="<?php _v('dbHost', 'localhost'); ?>"/>
<label class="typecho-label" for="dbHost"><?php _e('数据库地址'); ?></label>
<input type="text" class="text" name="dbHost" id="dbHost" value="<?php _v('dbHost', 'localhost'); ?>"/>
<p class="description"><?php _e('您可能会使用 "localhost"'); ?></p>
</li>
<li>
<label class="typecho-label"><?php _e('数据库端口'); ?></label>
<input type="text" class="text" name="dbPort" value="<?php _v('dbPort', '5432'); ?>"/>
<label class="typecho-label" for="dbPort"><?php _e('数据库端口'); ?></label>
<input type="text" class="text" name="dbPort" id="dbPort" value="<?php _v('dbPort', '5432'); ?>"/>
<p class="description"><?php _e('如果您不知道此选项的意义, 请保留默认设置'); ?></p>
</li>
<li>
<label class="typecho-label"><?php _e('数据库用户名'); ?></label>
<input type="text" class="text" name="dbUser" value="<?php _v('dbUser', 'postgres'); ?>" />
<label class="typecho-label" for="dbUser"><?php _e('数据库用户名'); ?></label>
<input type="text" class="text" name="dbUser" id="dbUser" value="<?php _v('dbUser', 'postgres'); ?>" />
<p class="description"><?php _e('您可能会使用 "postgres"'); ?></p>
</li>
<li>
<label class="typecho-label"><?php _e('数据库密码'); ?></label>
<input type="password" class="text" name="dbPassword" value="<?php _v('dbPassword'); ?>" />
<label class="typecho-label" for="dbPassword"><?php _e('数据库密码'); ?></label>
<input type="password" class="text" name="dbPassword" id="dbPassword" value="<?php _v('dbPassword'); ?>" />
</li>
<li>
<label class="typecho-label"><?php _e('数据库名'); ?></label>
<input type="text" class="text" name="dbDatabase" value="<?php _v('dbDatabase', 'typecho'); ?>" />
<label class="typecho-label" for="dbDatabase"><?php _e('数据库名'); ?></label>
<input type="text" class="text" name="dbDatabase" id="dbDatabase" value="<?php _v('dbDatabase', 'typecho'); ?>" />
<p class="description"><?php _e('请您指定数据库名称'); ?></p>
</li>
<input type="hidden" name="dbCharset" value="<?php _e('utf8'); ?>" />

View File

@@ -1,7 +1,7 @@
<?php if(!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
<?php $defaultDir = dirname($_SERVER['SCRIPT_FILENAME']) . '/usr/' . uniqid() . '.db'; ?>
<li>
<label class="typecho-label"><?php _e('数据库文件路径'); ?></label>
<input type="text" class="text" name="dbFile" value="<?php _v('dbFile', $defaultDir); ?>"/>
<label class="typecho-label" for="dbFile"><?php _e('数据库文件路径'); ?></label>
<input type="text" class="text" name="dbFile" id="dbFile" value="<?php _v('dbFile', $defaultDir); ?>"/>
<p class="description"><?php _e('"%s" 是我们为您自动生成的地址', $defaultDir); ?></p>
</li>