Ask users if they wish to send statistics to SNI, default is off.

Users may not know about this setting and are unaware they are sending stats.
This allows them to make that decision.
This commit is contained in:
Eric Helgeson 2009-11-11 18:45:21 -05:00
parent 59e8896212
commit 7efea1115f
2 changed files with 12 additions and 5 deletions

View File

@ -1,4 +1,3 @@
<?php
/**
* StatusNet - the distributed open-source microblogging tool
@ -26,7 +25,7 @@
* @author Brion Vibber <brion@pobox.com>
* @author CiaranG <ciaran@ciarang.com>
* @author Craig Andrews <candrews@integralblue.com>
* @author Eric Helgeson <helfire@Erics-MBP.local>
* @author Eric Helgeson <erichelgeson@gmail.com>
* @author Evan Prodromou <evan@status.net>
* @author Robin Millette <millette@controlyourself.ca>
* @author Sarven Capadisli <csarven@status.net>
@ -500,6 +499,10 @@ function showForm()
<input type="password" id="password" name="password" />
<p class="form_guide">Database password (optional)</p>
</li>
<li>
<label for="snapshot">Send stats to StatusNet Inc?</label>
<input type="checkbox" id="snapshot" name="snapshot" checked />
<p class="form_guide">Periodically send information about your site to StatusNet Inc</p>
</ul>
<input type="submit" name="submit" class="submit" value="Submit" />
</fieldset>
@ -521,6 +524,7 @@ function handlePost()
$username = $_POST['username'];
$password = $_POST['password'];
$sitename = $_POST['sitename'];
$snapshot = $_POST['snapshot'];
$fancy = !empty($_POST['fancy']);
$server = $_SERVER['HTTP_HOST'];
$path = substr(dirname($_SERVER['PHP_SELF']), 1);
@ -567,7 +571,7 @@ STR;
}
updateStatus("Writing config file...");
$res = writeConf($sitename, $server, $path, $fancy, $db);
$res = writeConf($sitename, $server, $path, $fancy, $db, $snapshot);
if (!$res) {
updateStatus("Can't write config file.", true);
@ -688,7 +692,7 @@ function Mysql_Db_installer($host, $database, $username, $password)
return $db;
}
function writeConf($sitename, $server, $path, $fancy, $db)
function writeConf($sitename, $server, $path, $fancy, $db, $snapshot)
{
// assemble configuration file in a string
$cfg = "<?php\n".
@ -704,6 +708,9 @@ function writeConf($sitename, $server, $path, $fancy, $db)
// checks if fancy URLs are enabled
($fancy ? "\$config['site']['fancy'] = true;\n\n":'').
// send site stats to SNI
($snapshot ? "\$config['snapshot']['run'] = 'web';\n\n":'').
// database
"\$config['db']['database'] = '{$db['database']}';\n\n".
($db['type'] == 'pgsql' ? "\$config['db']['quote_identifiers'] = true;\n\n":'').

View File

@ -159,7 +159,7 @@ $default =
array('default' => null,
'welcome' => null),
'snapshot' =>
array('run' => 'web',
array('run' => 'never',
'frequency' => 10000,
'reporturl' => 'http://status.net/stats/report'),
'attachments' =>