Exemplo n.º 1
0
 /**
  * 获取对象实例
  *
  * @return Tudu_Install_Install
  */
 public static function getInstance()
 {
     if (null === self::$_instance) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Exemplo n.º 2
0
    require_once 'Tudu/Install/Install.php';
    /* @var $install Tudu_Install_Install */
    $install = Tudu_Install_Install::getInstance();
    $install->setConfigs($config);
    $configPath = array('www' => realpath(WWW_CONFIG_PATH), 'admin' => realpath(ADMIN_CONFIG_PATH), 'script' => realpath(SCRIPT_CONFIG_PATH));
    $install->setConfigPaths($configPath);
    // 创建配置文件
    try {
        $install->saveConfigFile();
    } catch (Tudu_Install_Exception $e) {
        return $func->json(false, '创建站点配置文件不成功,请重试!');
    }
    $orgParams = array('orgid' => strtolower($_POST['tudu']['orgid']), 'orgname' => $_POST['tudu']['orgname'], 'userid' => strtolower($_POST['tudu']['userid']), 'password' => md5($_POST['tudu']['password']), 'domain' => $_SERVER['HTTP_HOST']);
    $install->setOrgParams($orgParams);
    $install->setDataPath(realpath(DATA_PATH));
    // 创建组织
    try {
        $install->createOrg();
    } catch (Tudu_Install_Exception $e) {
        return $func->json(false, '初始图度云办公系统失败,请重新!');
    }
    return $func->json(true, 'success', array('url' => $url . '?step=4'));
    // 完成安装
} elseif ($method == 'finish') {
    /* @var $install Tudu_Install_Install */
    $install = Tudu_Install_Install::getInstance();
    // 创建安装锁定文件
    $install->setDataPath(realpath(DATA_PATH));
    $install->finish();
    $func->sendTemplate(array('url' => 'http://' . $_SERVER['HTTP_HOST'], 'domain' => $_SERVER['HTTP_HOST']));
}