init() static public method

static public init ( $add_sample_content = true, $shared = 'true', $theme = 'default', $mkdirmode = 509 )
示例#1
0
文件: setup.php 项目: rsms/gitblog
			
			If git is not installed, please install it. Otherwise you need to update <tt>PATH</tt>.
			Putting something like this in <tt>gb-config.php</tt> would do it:<br/><br/>
			
			<code>$_ENV[\'PATH\'] .= \':/opt/local/bin\';</code><br/><br/>
			
			<tt>/opt/local/bin</tt> being the directory in which git is installed.
			Alternatively edit PATH in your php.ini file.<br/><br/>
			
			<small>(Original error from shell: ' . h($e->getMessage()) . ')</small>';
    }
    # -------------------------------------------------------------------------
    # create repository
    if (!gb::$errors) {
        $add_sample_content = isset($_POST['add-sample-content']) && $_POST['add-sample-content'] === 'true';
        if (!gb::init($add_sample_content)) {
            gb::$errors[] = 'Failed to create and initialize repository at ' . var_export(gb::$site_dir, 1);
        }
    }
    # -------------------------------------------------------------------------
    # commit changes (done by gb::init())
    if (!gb::$errors) {
        try {
            if (!git::commit('gitblog created', trim($_POST['name']) . ' <' . trim($_POST['email']) . '>')) {
                gb::$errors[] = 'failed to commit creation';
            }
        } catch (Exception $e) {
            gb::$errors[] = 'failed to commit creation: ' . nl2br(h(strval($e)));
        }
    }
    # -------------------------------------------------------------------------