Merge remote-tracking branch 'gnuio/master' into nightly

This commit is contained in:
Mikael Nordfeldth 2017-12-17 18:32:23 +01:00
commit ec98fd0c43
5 changed files with 27 additions and 21 deletions

View File

@ -774,6 +774,13 @@ high: if you need high performance, or if you're seeing bad
performance, set this to true. It will turn off some high-intensity code from performance, set this to true. It will turn off some high-intensity code from
the site. the site.
cache
-----
dir: A string path to a writable directory that will be used as temporary cache
for some functions (currently just the HtmlSanitizer).
If it is not set, the GNU social installation directory will be used.
oldschool oldschool
--------- ---------

18
INSTALL
View File

@ -124,17 +124,7 @@ especially if you've previously installed PHP/MariaDB packages.
that user's default group instead. As a last resort, you can create that user's default group instead. As a last resort, you can create
a new group like "gnusocial" and add the Web server's user to the group. a new group like "gnusocial" and add the Web server's user to the group.
4. You should also take this moment to make your 'avatar' and 'file' sub- 4. Create a database to hold your site data. Something like this
directories writeable by the Web server. The _insecure_ way to do
this is:
chmod a+w /var/www/gnusocial/avatar
chmod a+w /var/www/gnusocial/file
You can also make the avatar, and file directories just writable by
the Web server group, as noted above.
5. Create a database to hold your site data. Something like this
should work (you will be prompted for your database password): should work (you will be prompted for your database password):
mysqladmin -u "root" -p create social mysqladmin -u "root" -p create social
@ -147,7 +137,7 @@ especially if you've previously installed PHP/MariaDB packages.
a tool like phpMyAdmin to create a database. Check your hosting a tool like phpMyAdmin to create a database. Check your hosting
service's documentation for how to create a new MariaDB database.) service's documentation for how to create a new MariaDB database.)
6. Create a new database account that GNU Social will use to access the 5. Create a new database account that GNU Social will use to access the
database. If you have shell access, this will probably work from the database. If you have shell access, this will probably work from the
MariaDB shell: MariaDB shell:
@ -159,7 +149,7 @@ especially if you've previously installed PHP/MariaDB packages.
to your preferred new database username and password. You may want to to your preferred new database username and password. You may want to
test logging in to MariaDB as this new user. test logging in to MariaDB as this new user.
7. In a browser, navigate to the GNU Social install script; something like: 6. In a browser, navigate to the GNU Social install script; something like:
https://social.example.net/install.php https://social.example.net/install.php
@ -167,7 +157,7 @@ especially if you've previously installed PHP/MariaDB packages.
install program will configure your site and install the initial, install program will configure your site and install the initial,
almost-empty database. almost-empty database.
8. You should now be able to navigate to your social site's main directory 7. You should now be able to navigate to your social site's main directory
and see the "Public Timeline", which will probably be empty. You can and see the "Public Timeline", which will probably be empty. You can
now register new user, post some notices, edit your profile, etc. now register new user, post some notices, edit your profile, etc.

View File

@ -85,7 +85,7 @@ abstract class Installer
$pass = true; $pass = true;
$config = INSTALLDIR.'/config.php'; $config = INSTALLDIR.'/config.php';
if (file_exists($config)) { if (!$this->skipConfig && file_exists($config)) {
if (!is_writable($config) || filesize($config) > 0) { if (!is_writable($config) || filesize($config) > 0) {
if (filesize($config) == 0) { if (filesize($config) == 0) {
$this->warning('Config file "config.php" already exists and is empty, but is not writable.'); $this->warning('Config file "config.php" already exists and is empty, but is not writable.');
@ -126,14 +126,16 @@ abstract class Installer
} }
// @fixme this check seems to be insufficient with Windows ACLs // @fixme this check seems to be insufficient with Windows ACLs
if (!is_writable(INSTALLDIR)) { if (!$this->skipConfig && !is_writable(INSTALLDIR)) {
$this->warning(sprintf('Cannot write config file to: <code>%s</code></p>', INSTALLDIR), $this->warning(sprintf('Cannot write config file to: <code>%s</code></p>', INSTALLDIR),
sprintf('On your server, try this command: <code>chmod a+w %s</code>', INSTALLDIR)); sprintf('On your server, try this command: <code>chmod a+w %s</code>', INSTALLDIR));
$pass = false; $pass = false;
} }
// Check the subdirs used for file uploads // Check the subdirs used for file uploads
$fileSubdirs = array('avatar', 'file'); // TODO get another flag for this --skipFileSubdirCreation
if (!$this->skipConfig) {
$fileSubdirs = array($this->avatarDir, $this->fileDir);
foreach ($fileSubdirs as $fileSubdir) { foreach ($fileSubdirs as $fileSubdir) {
$fileFullPath = INSTALLDIR."/$fileSubdir"; $fileFullPath = INSTALLDIR."/$fileSubdir";
if (!file_exists($fileFullPath)) { if (!file_exists($fileFullPath)) {
@ -148,7 +150,7 @@ abstract class Installer
$pass = false; $pass = false;
} }
} }
}
return $pass; return $pass;
} }
@ -515,6 +517,9 @@ abstract class Installer
*/ */
function registerInitialUser() function registerInitialUser()
{ {
// initalize hostname from install arguments, so it can be used to find
// the /etc config file from the commandline installer
$server = $this->server;
require_once INSTALLDIR . '/lib/common.php'; require_once INSTALLDIR . '/lib/common.php';
$data = array('nickname' => $this->adminNick, $data = array('nickname' => $this->adminNick,
@ -580,10 +585,10 @@ abstract class Installer
return false; return false;
} }
if (!$this->skipConfig) {
// Make sure we can write to the file twice // Make sure we can write to the file twice
$oldUmask = umask(000); $oldUmask = umask(000);
if (!$this->skipConfig) {
$this->updateStatus("Writing config file..."); $this->updateStatus("Writing config file...");
$res = $this->writeConf(); $res = $this->writeConf();
@ -616,12 +621,12 @@ abstract class Installer
$this->updateStatus("Can't write to config file.", true); $this->updateStatus("Can't write to config file.", true);
return false; return false;
} }
}
// Restore original umask // Restore original umask
umask($oldUmask); umask($oldUmask);
// Set permissions back to something decent // Set permissions back to something decent
chmod(INSTALLDIR.'/config.php', 0644); chmod(INSTALLDIR.'/config.php', 0644);
}
$scheme = $this->ssl === 'always' ? 'https' : 'http'; $scheme = $this->ssl === 'always' ? 'https' : 'http';
$link = "{$scheme}://{$this->server}/{$this->path}"; $link = "{$scheme}://{$this->server}/{$this->path}";

View File

@ -610,6 +610,10 @@ function common_purify($html, array $args=array())
$cfg->set('URI.Base', $args['URI.Base']); // if null this is like unsetting it I presume $cfg->set('URI.Base', $args['URI.Base']); // if null this is like unsetting it I presume
$cfg->set('URI.MakeAbsolute', !is_null($args['URI.Base'])); // if we have a URI base, convert relative URLs to absolute ones. $cfg->set('URI.MakeAbsolute', !is_null($args['URI.Base'])); // if we have a URI base, convert relative URLs to absolute ones.
} }
if (common_config('cache', 'dir')) {
$cfg->set('Cache.SerializerPath', common_config('cache', 'dir'));
}
// if you don't want to use the default cache dir for htmlpurifier, set it specifically as $config['htmlpurifier']['Cache.SerializerPath'] = '/tmp'; or something.
foreach (common_config('htmlpurifier') as $key=>$val) { foreach (common_config('htmlpurifier') as $key=>$val) {
$cfg->set($key, $val); $cfg->set($key, $val);
} }

View File

@ -47,10 +47,10 @@ class CliInstaller extends Installer
*/ */
function main() function main()
{ {
if ($this->prepare()) {
if (!$this->checkPrereqs()) { if (!$this->checkPrereqs()) {
return false; return false;
} }
if ($this->prepare()) {
return $this->handle(); return $this->handle();
} else { } else {
$this->showHelp(); $this->showHelp();