diff --git a/install.php b/install.php index 7193e7ce..bce78272 100644 --- a/install.php +++ b/install.php @@ -60,6 +60,19 @@ if (!isset($_GET['finish']) && file_exists(__TYPECHO_ROOT_DIR__ . '/config.inc.p exit; } +/** + * 检测是否为应用引擎 + * + * @access protected + * @return void + */ +function _engine() +{ + return !empty($_SERVER['HTTP_APPNAME']) // SAE + || !!getenv('HTTP_BAE_ENV_APPID') // BAE + || (isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'],'Google App Engine') !== false); // GAE +} + /** * 获取传递参数 * @@ -328,7 +341,7 @@ list($prefixVersion, $suffixVersion) = explode('/', $currentVersion); 'ip' => '127.0.0.1', 'agent' => $options->generator, 'text' => '欢迎加入 Typecho 大家族', 'type' => 'comment', 'status' => 'approved', 'parent' => 0))); /** 初始用户 */ - $password = substr(uniqid(), 7); + $password = empty($config['userPassword']) ? substr(uniqid(), 7) : $config['userPassword']; $installDb->query($installDb->insert('table.users')->rows(array('name' => $config['userName'], 'password' => Typecho_Common::hash($password), 'mail' => $config['userMail'], 'url' => 'http://www.typecho.org', 'screenName' => $config['userName'], 'group' => 'administrator', 'created' => Typecho_Date::gmtTime()))); @@ -463,6 +476,7 @@ list($prefixVersion, $suffixVersion) = explode('/', $currentVersion); Typecho_Cookie::set('__typecho_config', base64_encode(serialize(array_merge(array( 'prefix' => _r('dbPrefix'), 'userName' => _r('userName'), + 'userPassword' => _r('userPassword'), 'userMail' => _r('userMail'), 'adapter' => $adapter, 'siteUrl' => _r('userUrl') @@ -482,7 +496,9 @@ list($prefixVersion, $suffixVersion) = explode('/', $currentVersion); Typecho_Db::set(\$db); "; $contents = implode('', $lines); - @file_put_contents('./config.inc.php', $contents); + if (!_engine()) { + @file_put_contents('./config.inc.php', $contents); + } // 创建一个用于标识的临时文件 $_SESSION['typecho'] = 1; @@ -546,6 +562,11 @@ Typecho_Db::set(\$db);

  • + + +

    +
  • +
  • diff --git a/install/Mysql.php b/install/Mysql.php index c947270f..ab872ee2 100644 --- a/install/Mysql.php +++ b/install/Mysql.php @@ -21,8 +21,8 @@

  • - -

    + +