diff options
author | Owen Winkler <a_github@midnightcircus.com> | 2013-10-05 16:13:46 -0700 |
---|---|---|
committer | Owen Winkler <a_github@midnightcircus.com> | 2013-10-05 16:13:46 -0700 |
commit | 08e1147a6b9146b2b0cc1d234f5b40c0b5e9c4e9 (patch) | |
tree | 6f8a26bd8b3bde717b2ecbe9aca5df0d7e14b5dc | |
parent | 0501a947bc2d11b3494790db1fdef8e71ccc4e83 (diff) | |
parent | 46ca1eb91b3b653b52af408ac0d0047d02f0f798 (diff) | |
download | nextcloud-server-08e1147a6b9146b2b0cc1d234f5b40c0b5e9c4e9.tar.gz nextcloud-server-08e1147a6b9146b2b0cc1d234f5b40c0b5e9c4e9.zip |
Merge pull request #4982 from syncloud/master
Automatic config can set some of parameters or all of them
-rw-r--r-- | core/setup.php | 17 | ||||
-rw-r--r-- | core/templates/installation.php | 11 |
2 files changed, 24 insertions, 4 deletions
diff --git a/core/setup.php b/core/setup.php index 4758c23b045..4026a748453 100644 --- a/core/setup.php +++ b/core/setup.php @@ -5,9 +5,18 @@ $autosetup_file = OC::$SERVERROOT."/config/autoconfig.php"; if( file_exists( $autosetup_file )) { OC_Log::write('core', 'Autoconfig file found, setting up owncloud...', OC_Log::INFO); include $autosetup_file; - $_POST['install'] = 'true'; $_POST = array_merge ($_POST, $AUTOCONFIG); - unlink($autosetup_file); +} + +$dbIsSet = isset($_POST['dbtype']); +$directoryIsSet = isset($_POST['directory']); +$adminAccountIsSet = isset($_POST['adminlogin']); + +if ($dbIsSet AND $directoryIsSet AND $adminAccountIsSet) { + $_POST['install'] = 'true'; + if( file_exists( $autosetup_file )) { + unlink($autosetup_file); + } } OC_Util::addScript('setup'); @@ -21,7 +30,7 @@ $datadir = OC_Config::getValue('datadirectory', OC::$SERVERROOT.'/data'); $vulnerableToNullByte = false; if(@file_exists(__FILE__."\0Nullbyte")) { // Check if the used PHP version is vulnerable to the NULL Byte attack (CVE-2006-7243) $vulnerableToNullByte = true; -} +} // Protect data directory here, so we can test if the protection is working OC_Setup::protectDataDirectory(); @@ -37,6 +46,8 @@ $opts = array( 'htaccessWorking' => OC_Util::isHtAccessWorking(), 'vulnerableToNullByte' => $vulnerableToNullByte, 'errors' => array(), + 'dbIsSet' => $dbIsSet, + 'directoryIsSet' => $directoryIsSet, ); if(isset($_POST['install']) AND $_POST['install']=='true') { diff --git a/core/templates/installation.php b/core/templates/installation.php index 8b3ee8f120f..5a103762269 100644 --- a/core/templates/installation.php +++ b/core/templates/installation.php @@ -61,8 +61,14 @@ </p> </fieldset> - <fieldset id="datadirField"> + <?php if(!$_['directoryIsSet'] OR !$_['dbIsSet']): ?> + <fieldset id="advancedHeader"> <legend><a id="showAdvanced"><?php p($l->t( 'Advanced' )); ?> <img class="svg" src="<?php print_unescaped(image_path('', 'actions/caret.svg')); ?>" /></a></legend> + </fieldset> + <?php endif; ?> + + <?php if(!$_['directoryIsSet']): ?> + <fieldset id="datadirField"> <div id="datadirContent"> <label for="directory"><?php p($l->t( 'Data folder' )); ?></label> <input type="text" name="directory" id="directory" @@ -70,7 +76,9 @@ value="<?php p(OC_Helper::init_var('directory', $_['directory'])); ?>" /> </div> </fieldset> + <?php endif; ?> + <?php if(!$_['dbIsSet']): ?> <fieldset id='databaseField'> <?php if($_['hasMySQL'] or $_['hasPostgreSQL'] or $_['hasOracle'] or $_['hasMSSQL']) $hasOtherDB = true; else $hasOtherDB =false; //other than SQLite ?> @@ -171,6 +179,7 @@ </div> <?php endif; ?> </fieldset> + <?php endif; ?> <div class="buttons"><input type="submit" class="primary" value="<?php p($l->t( 'Finish setup' )); ?>" data-finishing="<?php p($l->t( 'Finishing …' )); ?>" /></div> </form> |