Added SSL option to web and cli installers
This commit is contained in:
parent
f11d157b8b
commit
20bad68845
21
install.php
21
install.php
@ -27,6 +27,7 @@
|
|||||||
* @author Craig Andrews <candrews@integralblue.com>
|
* @author Craig Andrews <candrews@integralblue.com>
|
||||||
* @author Eric Helgeson <helfire@Erics-MBP.local>
|
* @author Eric Helgeson <helfire@Erics-MBP.local>
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @author Evan Prodromou <evan@status.net>
|
||||||
|
* @author Mikael Nordfeldth <mmn@hethane.se>
|
||||||
* @author Robin Millette <millette@controlyourself.ca>
|
* @author Robin Millette <millette@controlyourself.ca>
|
||||||
* @author Sarven Capadisli <csarven@status.net>
|
* @author Sarven Capadisli <csarven@status.net>
|
||||||
* @author Tom Adams <tom@holizz.com>
|
* @author Tom Adams <tom@holizz.com>
|
||||||
@ -168,6 +169,13 @@ class WebInstaller extends Installer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$ssl = array('always'=>null, 'never'=>null);
|
||||||
|
if (!empty($_SERVER['HTTPS'])) {
|
||||||
|
$ssl['always'] = 'checked="checked"';
|
||||||
|
} else {
|
||||||
|
$ssl['never'] = 'checked="checked"';
|
||||||
|
}
|
||||||
|
|
||||||
echo<<<E_O_T
|
echo<<<E_O_T
|
||||||
<form method="post" action="install.php" class="form_settings" id="form_install">
|
<form method="post" action="install.php" class="form_settings" id="form_install">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
@ -185,6 +193,12 @@ class WebInstaller extends Installer
|
|||||||
<input type="radio" name="fancy" id="fancy-disable" value="" /> disable<br />
|
<input type="radio" name="fancy" id="fancy-disable" value="" /> disable<br />
|
||||||
<p class="form_guide" id='fancy-form_guide'>Enable fancy (pretty) URLs. Auto-detection failed, it depends on Javascript.</p>
|
<p class="form_guide" id='fancy-form_guide'>Enable fancy (pretty) URLs. Auto-detection failed, it depends on Javascript.</p>
|
||||||
</li>
|
</li>
|
||||||
|
<li>
|
||||||
|
<label for="ssl">Server SSL</label>
|
||||||
|
<input type="radio" name="ssl" id="ssl-always" value="always" {$ssl['always']} /> enable<br />
|
||||||
|
<input type="radio" name="ssl" id="ssl-never" value="never" {$ssl['never']} /> disable<br />
|
||||||
|
<p class="form_guide" id="ssl-form_guide">Enabling SSL (https://) requires extra webserver configuration and certificate generation not offered by this installation.</p>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
@ -321,6 +335,8 @@ STR;
|
|||||||
|
|
||||||
$this->siteProfile = $post->string('site_profile');
|
$this->siteProfile = $post->string('site_profile');
|
||||||
|
|
||||||
|
$this->ssl = $post->string('ssl');
|
||||||
|
|
||||||
$this->server = $_SERVER['HTTP_HOST'];
|
$this->server = $_SERVER['HTTP_HOST'];
|
||||||
$this->path = substr(dirname($_SERVER['PHP_SELF']), 1);
|
$this->path = substr(dirname($_SERVER['PHP_SELF']), 1);
|
||||||
|
|
||||||
@ -338,6 +354,11 @@ STR;
|
|||||||
$fail = true;
|
$fail = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!in_array($this->ssl, array('never', 'sometimes', 'always'))) {
|
||||||
|
$this->updateStatus("Bad value for server SSL enabling.");
|
||||||
|
$fail = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!$this->validateSiteProfile()) {
|
if (!$this->validateSiteProfile()) {
|
||||||
$fail = true;
|
$fail = true;
|
||||||
}
|
}
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
* @author Craig Andrews <candrews@integralblue.com>
|
* @author Craig Andrews <candrews@integralblue.com>
|
||||||
* @author Eric Helgeson <helfire@Erics-MBP.local>
|
* @author Eric Helgeson <helfire@Erics-MBP.local>
|
||||||
* @author Evan Prodromou <evan@status.net>
|
* @author Evan Prodromou <evan@status.net>
|
||||||
|
* @author Mikael Nordfeldth <mmn@hethane.se>
|
||||||
* @author Robin Millette <millette@controlyourself.ca>
|
* @author Robin Millette <millette@controlyourself.ca>
|
||||||
* @author Sarven Capadisli <csarven@status.net>
|
* @author Sarven Capadisli <csarven@status.net>
|
||||||
* @author Tom Adams <tom@holizz.com>
|
* @author Tom Adams <tom@holizz.com>
|
||||||
@ -42,7 +43,7 @@
|
|||||||
abstract class Installer
|
abstract class Installer
|
||||||
{
|
{
|
||||||
/** Web site info */
|
/** Web site info */
|
||||||
public $sitename, $server, $path, $fancy, $siteProfile;
|
public $sitename, $server, $path, $fancy, $siteProfile, $ssl;
|
||||||
/** DB info */
|
/** DB info */
|
||||||
public $host, $database, $dbtype, $username, $password, $db;
|
public $host, $database, $dbtype, $username, $password, $db;
|
||||||
/** Administrator info */
|
/** Administrator info */
|
||||||
@ -412,6 +413,9 @@ abstract class Installer
|
|||||||
'sitename' => $this->sitename,
|
'sitename' => $this->sitename,
|
||||||
'server' => $this->server,
|
'server' => $this->server,
|
||||||
'path' => $this->path,
|
'path' => $this->path,
|
||||||
|
'ssl' => in_array($this->ssl, array('never', 'sometimes', 'always'))
|
||||||
|
? $this->ssl
|
||||||
|
: 'never',
|
||||||
'db_database' => $this->db['database'],
|
'db_database' => $this->db['database'],
|
||||||
'db_type' => $this->db['type']
|
'db_type' => $this->db['type']
|
||||||
));
|
));
|
||||||
@ -426,6 +430,7 @@ abstract class Installer
|
|||||||
// site location
|
// site location
|
||||||
"\$config['site']['server'] = {$vals['server']};\n".
|
"\$config['site']['server'] = {$vals['server']};\n".
|
||||||
"\$config['site']['path'] = {$vals['path']}; \n\n".
|
"\$config['site']['path'] = {$vals['path']}; \n\n".
|
||||||
|
"\$config['site']['ssl'] = {$vals['ssl']}; \n\n".
|
||||||
|
|
||||||
// checks if fancy URLs are enabled
|
// checks if fancy URLs are enabled
|
||||||
($this->fancy ? "\$config['site']['fancy'] = true;\n\n":'').
|
($this->fancy ? "\$config['site']['fancy'] = true;\n\n":'').
|
||||||
|
@ -21,8 +21,9 @@
|
|||||||
* @package Installation
|
* @package Installation
|
||||||
*
|
*
|
||||||
* @author Brion Vibber <brion@status.net>
|
* @author Brion Vibber <brion@status.net>
|
||||||
|
* @author Mikael Nordfeldth <mmn@hethane.se>
|
||||||
* @license GNU Affero General Public License http://www.gnu.org/licenses/
|
* @license GNU Affero General Public License http://www.gnu.org/licenses/
|
||||||
* @version 0.9.x
|
* @version 1.1.x
|
||||||
* @link http://status.net
|
* @link http://status.net
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -72,6 +73,7 @@ class CliInstaller extends Installer
|
|||||||
'--path' => 'path',
|
'--path' => 'path',
|
||||||
'--sitename' => 'sitename',
|
'--sitename' => 'sitename',
|
||||||
'--fancy' => 'fancy',
|
'--fancy' => 'fancy',
|
||||||
|
'--ssl' => 'ssl',
|
||||||
|
|
||||||
'--dbtype' => 'dbtype',
|
'--dbtype' => 'dbtype',
|
||||||
'--host' => 'host',
|
'--host' => 'host',
|
||||||
@ -106,6 +108,7 @@ class CliInstaller extends Installer
|
|||||||
$this->dbtype = 'mysql';
|
$this->dbtype = 'mysql';
|
||||||
$this->adminUpdates = true;
|
$this->adminUpdates = true;
|
||||||
$this->verbose = true;
|
$this->verbose = true;
|
||||||
|
// ssl is defaulted in lib/installer.php
|
||||||
|
|
||||||
foreach ($options as $option) {
|
foreach ($options as $option) {
|
||||||
$arg = $option[0];
|
$arg = $option[0];
|
||||||
@ -159,6 +162,8 @@ install_cli.php - StatusNet command-line installer
|
|||||||
-p --path=<path> Use <path> as path name
|
-p --path=<path> Use <path> as path name
|
||||||
--sitename User-friendly site name (required)
|
--sitename User-friendly site name (required)
|
||||||
--fancy Whether to use fancy URLs (default no)
|
--fancy Whether to use fancy URLs (default no)
|
||||||
|
--ssl Server SSL enabled (default never),
|
||||||
|
[never | sometimes | always]
|
||||||
|
|
||||||
--dbtype 'mysql' (default) or 'pgsql'
|
--dbtype 'mysql' (default) or 'pgsql'
|
||||||
--host Database hostname (required)
|
--host Database hostname (required)
|
||||||
|
Loading…
Reference in New Issue
Block a user