From be321242d3191e7bc2159275c904400e51e2901b Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sat, 27 Aug 2011 12:14:41 -0700 Subject: [PATCH 1/3] Add "Single User" to installer's site profile form --- install.php | 1 + 1 file changed, 1 insertion(+) diff --git a/install.php b/install.php index 054be3d8d7..190941c5ab 100644 --- a/install.php +++ b/install.php @@ -257,6 +257,7 @@ class WebInstaller extends Installer +

Initial access settings for your site

From 32fa6dd7a22a09ecef7be3056e10f912cc25c91b Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sat, 27 Aug 2011 12:42:09 -0700 Subject: [PATCH 2/3] Fix logging level in log msg --- classes/User.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/classes/User.php b/classes/User.php index 93340f021d..7289a17b69 100644 --- a/classes/User.php +++ b/classes/User.php @@ -981,7 +981,7 @@ class User extends Managed_DataObject return $user->nickname; } catch (Exception $e) { if (common_config('singleuser', 'enabled') && common_config('singleuser', 'nickname')) { - common_log(LOG_WARN, "Warning: code attempting to pull single-user nickname when the account does not exist. If this is not setup time, this is probably a bug."); + common_log(LOG_WARNING, "Warning: code attempting to pull single-user nickname when the account does not exist. If this is not setup time, this is probably a bug."); return common_config('singleuser', 'nickname'); } throw $e; From 7f5080d5e3fa9a11156b02db7a450722884b5583 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sat, 27 Aug 2011 14:25:12 -0700 Subject: [PATCH 3/3] * Allow setting single user site profile * Fix site profile array munging --- lib/installer.php | 11 +++++-- lib/siteprofile.php | 72 +++++++++++++++++++++++++++------------------ lib/statusnet.php | 2 +- 3 files changed, 53 insertions(+), 32 deletions(-) diff --git a/lib/installer.php b/lib/installer.php index 0f6af02378..35f5d591b4 100644 --- a/lib/installer.php +++ b/lib/installer.php @@ -414,7 +414,8 @@ abstract class Installer 'path' => $this->path, 'db_database' => $this->db['database'], 'db_type' => $this->db['type'], - 'site_profile' => $this->siteProfile + 'site_profile' => $this->siteProfile, + 'nickname' => $this->adminNick )); // assemble configuration file in a string @@ -437,7 +438,13 @@ abstract class Installer "\$config['db']['type'] = {$vals['db_type']};\n\n". // site profile - "\$config['site']['profile'] = {$vals['site_profile']};\n\n"; + "\$config['site']['profile'] = {$vals['site_profile']};\n"; + + if ($this->siteProfile == "singleuser") { + $cfg .= "\$config['singleuser']['nickname'] = {$vals['nickname']};\n\n"; + } else { + $cfg .= "\n"; + } // Normalize line endings for Windows servers $cfg = str_replace("\n", PHP_EOL, $cfg); diff --git a/lib/siteprofile.php b/lib/siteprofile.php index 53e6482aae..c294d24569 100644 --- a/lib/siteprofile.php +++ b/lib/siteprofile.php @@ -87,11 +87,16 @@ class PublicSite extends SiteProfileSettings * @return type array an array of settings */ static function getSettings() { + global $config; return array( - 'site' => array( - 'inviteonly' => false, - 'private' => false - ), + // We only want to change these values, not replace entire 'site' array + 'site' => array_replace( + $config['site'], array( + 'inviteonly' => false, + 'private' => false, + 'closed' => false + ) + ), 'plugins' => array( 'default' => array( 'Activity' => null, @@ -109,10 +114,9 @@ class PublicSite extends SiteProfileSettings 'SearchSub' => null, 'StrictTransportSecurity' => null, 'TagSub' => null - ), - 'discovery' => - array('cors' => true) // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.) - ) + ) + ), + 'discovery' => array('cors' => true) // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.) ); } } @@ -130,11 +134,15 @@ class PrivateSite extends SiteProfileSettings * @return type array an array of settings */ static function getSettings() { + global $config; return array( - 'site' => array( - 'inviteonly' => true, - 'private' => true - ), + // We only want to change these values, not replace entire 'site' array + 'site' => array_replace( + $config['site'], array( + 'inviteonly' => true, + 'private' => true, + ) + ), 'plugins' => array( 'default' => array( 'Activity' => null, @@ -189,11 +197,15 @@ class CommunitySite extends SiteProfileSettings * @return type array an array of settings */ static function getSettings() { + global $config; return array( - 'site' => array( - 'inviteonly' => true, - 'private' => false - ), + // We only want to change these values, not replace entire 'site' array + 'site' => array_replace( + $config['site'], array( + 'private' => false, + 'closed' => false + ) + ), 'plugins' => array( 'default' => array( 'Activity' => null, @@ -210,10 +222,9 @@ class CommunitySite extends SiteProfileSettings 'SearchSub' => null, 'StrictTransportSecurity' => null, 'TagSub' => null - ), - 'discovery' => - array('cors' => true) // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.) - ) + ) + ), + 'discovery' => array('cors' => true) // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.) ); } @@ -230,12 +241,16 @@ class SingleuserSite extends SiteProfileSettings * @return type array an array of settings */ static function getSettings() { + global $config; return array( 'singleuser' => array('enabled' => true), - 'site' => array( - 'private' => false, - 'closed' => true, - ), + // We only want to change these values, not replace entire 'site' array + 'site' => array_replace( + $config['site'], array( + 'private' => false, + 'closed' => true, + ) + ), 'plugins' => array( 'default' => array( 'Activity' => null, @@ -253,11 +268,10 @@ class SingleuserSite extends SiteProfileSettings 'StrictTransportSecurity' => null, 'TagSub' => null, 'TwitterBridge' => null, - 'FacebookBridge' => null - ), - 'discovery' => - array('cors' => true) // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.) - ) + 'FacebookBridge' => null, + ) + ), + 'discovery' => array('cors' => true) // Allow Cross-Origin Resource Sharing for service discovery (host-meta, XRD, etc.) ); } diff --git a/lib/statusnet.php b/lib/statusnet.php index 846d525c38..e4fb60ec7c 100644 --- a/lib/statusnet.php +++ b/lib/statusnet.php @@ -310,7 +310,7 @@ class StatusNet { global $config; $settings = SiteProfile::getSettings($name); - $config = array_replace_recursive($config, $settings); + $config = array_replace($config, $settings); } protected function _sn_to_path($sn)