mirror of
https://github.com/typecho/typecho.git
synced 2025-04-21 18:21:53 +02:00
增加ACE适配
This commit is contained in:
parent
273900d806
commit
72f95bb428
@ -1,9 +1,26 @@
|
||||
<?php if(!defined('__TYPECHO_ROOT_DIR__')) exit; ?>
|
||||
|
||||
<?php if (defined('SAE_MYSQL_DB')): ?>
|
||||
<?php
|
||||
$engine = '';
|
||||
|
||||
if (defined('SAE_MYSQL_DB')) {
|
||||
$engine = 'SAE';
|
||||
} else if (!!getenv('HTTP_BAE_ENV_ADDR_SQL_IP')) {
|
||||
$engine = 'BAE';
|
||||
} else if (ini_get('acl.app_url')) {
|
||||
$engine = 'ACE';
|
||||
} else if (isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'],'Google App Engine') !== false) {
|
||||
$engine = 'GAE';
|
||||
}
|
||||
?>
|
||||
|
||||
<?php if (!empty($engine)): ?>
|
||||
<h3 class="warning"><?php _e('系统将为您自动匹配 %s 环境的安装选项', $engine); ?></h3>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ('SAE' == $engine): ?>
|
||||
<!-- SAE -->
|
||||
<h3 class="warning"><?php _e('系统将为您自动匹配 %s 环境的安装选项', 'SAE'); ?></h3>
|
||||
<input type="hidden" name="config" value="array (
|
||||
<input type="hidden" name="config" value="array (
|
||||
'host' => SAE_MYSQL_HOST_M,
|
||||
'user' => SAE_MYSQL_USER,
|
||||
'password' => SAE_MYSQL_PASS,
|
||||
@ -11,42 +28,40 @@
|
||||
'port' => SAE_MYSQL_PORT,
|
||||
'database' => SAE_MYSQL_DB
|
||||
)" />
|
||||
<input type="hidden" name="dbHost" value="<?php echo SAE_MYSQL_HOST_M; ?>" />
|
||||
<input type="hidden" name="dbPort" value="<?php echo SAE_MYSQL_PORT; ?>" />
|
||||
<input type="hidden" name="dbUser" value="<?php echo SAE_MYSQL_USER; ?>" />
|
||||
<input type="hidden" name="dbPassword" value="<?php echo SAE_MYSQL_PASS; ?>" />
|
||||
<input type="hidden" name="dbDatabase" value="<?php echo SAE_MYSQL_DB; ?>" />
|
||||
<?php elseif (!!getenv('HTTP_BAE_ENV_ADDR_SQL_IP')): ?>
|
||||
<!-- BAE -->
|
||||
<?php
|
||||
<input type="hidden" name="dbHost" value="<?php echo SAE_MYSQL_HOST_M; ?>" />
|
||||
<input type="hidden" name="dbPort" value="<?php echo SAE_MYSQL_PORT; ?>" />
|
||||
<input type="hidden" name="dbUser" value="<?php echo SAE_MYSQL_USER; ?>" />
|
||||
<input type="hidden" name="dbPassword" value="<?php echo SAE_MYSQL_PASS; ?>" />
|
||||
<input type="hidden" name="dbDatabase" value="<?php echo SAE_MYSQL_DB; ?>" />
|
||||
<?php elseif ('BAE' == $engine):
|
||||
$baeDbUser = "getenv('HTTP_BAE_ENV_AK')";
|
||||
$baeDbPassword = "getenv('HTTP_BAE_ENV_SK')";
|
||||
?>
|
||||
<h3 class="warning"><?php _e('系统将为您自动匹配 %s 环境的安装选项', 'BAE'); ?></h3>
|
||||
<?php if (!getenv('HTTP_BAE_ENV_AK')): $baeDbUser = "'{user}'"; ?>
|
||||
<li>
|
||||
<label class="typecho-label" for="dbUser"><?php _e('应用API Key'); ?></label>
|
||||
<input type="text" class="text" name="dbUser" id="dbUser" value="<?php _v('dbUser'); ?>" />
|
||||
</li>
|
||||
<?php else: ?>
|
||||
<input type="hidden" name="dbUser" value="<?php echo getenv('HTTP_BAE_ENV_AK'); ?>" />
|
||||
<?php endif; ?>
|
||||
<!-- BAE -->
|
||||
<?php if (!getenv('HTTP_BAE_ENV_AK')): $baeDbUser = "'{user}'"; ?>
|
||||
<li>
|
||||
<label class="typecho-label" for="dbUser"><?php _e('应用API Key'); ?></label>
|
||||
<input type="text" class="text" name="dbUser" id="dbUser" value="<?php _v('dbUser'); ?>" />
|
||||
</li>
|
||||
<?php else: ?>
|
||||
<input type="hidden" name="dbUser" value="<?php echo getenv('HTTP_BAE_ENV_AK'); ?>" />
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!getenv('HTTP_BAE_ENV_SK')): $baeDbPassword = "'{password}'"; ?>
|
||||
<li>
|
||||
<label class="typecho-label" for="dbPassword"><?php _e('应用Secret Key'); ?></label>
|
||||
<input type="text" class="text" name="dbPassword" id="dbPassword" value="<?php _v('dbPassword'); ?>" />
|
||||
</li>
|
||||
<?php else: ?>
|
||||
<input type="hidden" name="dbPassword" value="<?php echo getenv('HTTP_BAE_ENV_SK'); ?>" />
|
||||
<?php endif; ?>
|
||||
<?php if (!getenv('HTTP_BAE_ENV_SK')): $baeDbPassword = "'{password}'"; ?>
|
||||
<li>
|
||||
<label class="typecho-label" for="dbPassword"><?php _e('应用Secret Key'); ?></label>
|
||||
<input type="text" class="text" name="dbPassword" id="dbPassword" value="<?php _v('dbPassword'); ?>" />
|
||||
</li>
|
||||
<?php else: ?>
|
||||
<input type="hidden" name="dbPassword" value="<?php echo getenv('HTTP_BAE_ENV_SK'); ?>" />
|
||||
<?php endif; ?>
|
||||
|
||||
<li>
|
||||
<label class="typecho-label" for="dbDatabase"><?php _e('数据库名'); ?></label>
|
||||
<input type="text" class="text" id="dbDatabase" name="dbDatabase" value="<?php _v('dbDatabase'); ?>" />
|
||||
<p class="description"><?php _e('可以在MySQL服务的管理页面看到您创建的数据库名称'); ?></p>
|
||||
</li>
|
||||
<input type="hidden" name="config" value="array (
|
||||
<li>
|
||||
<label class="typecho-label" for="dbDatabase"><?php _e('数据库名'); ?></label>
|
||||
<input type="text" class="text" id="dbDatabase" name="dbDatabase" value="<?php _v('dbDatabase'); ?>" />
|
||||
<p class="description"><?php _e('可以在MySQL服务的管理页面看到您创建的数据库名称'); ?></p>
|
||||
</li>
|
||||
<input type="hidden" name="config" value="array (
|
||||
'host' => getenv('HTTP_BAE_ENV_ADDR_SQL_IP'),
|
||||
'user' => <?php echo $baeDbUser; ?>,
|
||||
'password' => <?php echo $baeDbPassword; ?>,
|
||||
@ -54,70 +69,95 @@ $baeDbPassword = "getenv('HTTP_BAE_ENV_SK')";
|
||||
'port' => getenv('HTTP_BAE_ENV_ADDR_SQL_PORT'),
|
||||
'database' => '{database}'
|
||||
)" />
|
||||
<input type="hidden" name="dbHost" value="<?php echo getenv('HTTP_BAE_ENV_ADDR_SQL_IP'); ?>" />
|
||||
<input type="hidden" name="dbPort" value="<?php echo getenv('HTTP_BAE_ENV_ADDR_SQL_PORT'); ?>" />
|
||||
<?php elseif (isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'],'Google App Engine') !== false): ?>
|
||||
<input type="hidden" name="dbHost" value="<?php echo getenv('HTTP_BAE_ENV_ADDR_SQL_IP'); ?>" />
|
||||
<input type="hidden" name="dbPort" value="<?php echo getenv('HTTP_BAE_ENV_ADDR_SQL_PORT'); ?>" />
|
||||
<?php elseif ('ACE' == $engine): ?>
|
||||
<!-- ACE -->
|
||||
|
||||
<li>
|
||||
<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('您可以访问 RDS 控制台获取详细信息'); ?></p>
|
||||
</li>
|
||||
<li>
|
||||
<label class="typecho-label" for="dbPort"><?php _e('数据库端口'); ?></label>
|
||||
<input type="text" class="text" name="dbPort" id="dbPort" value="<?php _v('dbPort', 3306); ?>"/>
|
||||
</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'); ?>" />
|
||||
</li>
|
||||
|
||||
<?php elseif ('GAE' == $engine): ?>
|
||||
<!-- GAE -->
|
||||
<h3 class="warning"><?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>
|
||||
<h3 class="warning"><?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 (
|
||||
<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 (
|
||||
<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'] ?>" />
|
||||
<input type="hidden" name="dbHost" value="<?php echo $_SERVER['APPLICATION_ID'] ?>" />
|
||||
<?php else: ?>
|
||||
<li>
|
||||
<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('您可能会使用 "%s"', 'localhost'); ?></p>
|
||||
</li>
|
||||
<li>
|
||||
<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" for="dbUser"><?php _e('数据库用户名'); ?></label>
|
||||
<input type="text" class="text" name="dbUser" id="dbUser" value="<?php _v('dbUser', 'root'); ?>" />
|
||||
<p class="description"><?php _e('您可能会使用 "%s"', 'root'); ?></p>
|
||||
</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('请您指定数据库名称'); ?></p>
|
||||
</li>
|
||||
<li>
|
||||
<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('您可能会使用 "%s"', 'localhost'); ?></p>
|
||||
</li>
|
||||
<li>
|
||||
<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" for="dbUser"><?php _e('数据库用户名'); ?></label>
|
||||
<input type="text" class="text" name="dbUser" id="dbUser" value="<?php _v('dbUser', 'root'); ?>" />
|
||||
<p class="description"><?php _e('您可能会使用 "%s"', 'root'); ?></p>
|
||||
</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('请您指定数据库名称'); ?></p>
|
||||
</li>
|
||||
|
||||
<?php endif; ?>
|
||||
<input type="hidden" name="dbCharset" value="<?php _e('utf8'); ?>" />
|
||||
|
@ -64,7 +64,7 @@ class Widget_Contents_Post_Admin extends Widget_Abstract_Contents
|
||||
->where('table.contents.parent = ? AND (table.contents.type = ? OR table.contents.type = ?)',
|
||||
$this->cid, 'post_draft', 'page_draft')
|
||||
->limit(1));
|
||||
|
||||
|
||||
if ($savedPost) {
|
||||
$this->modified = $savedPost['modified'];
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user