12 Commits ec504ec4df ... ec98fd0c43

Author SHA1 Message Date
  Mikael Nordfeldth ec98fd0c43 Merge remote-tracking branch 'gnuio/master' into nightly 6 years ago
  mmn 67a9c0415c Merge branch 'cache-html-sanitizer' into 'master' 6 years ago
  mmn a1ea335140 Merge branch 'cli-install' into 'master' 6 years ago
  mmn 69bb81556f Merge branch 'master' into 'master' 6 years ago
  nee 0b9a2fdf3a allow the cmd installer to load the config file from '/etc/gnusocial/config.d/'.$_server.'.php' 6 years ago
  nee 3b5fabbe97 set the html sanitizer cache directory to ['cache']['dir'] from the config file; 6 years ago
  nee fdd3d63098 Don't write the config file when --skip-config flag is given to the installer. 6 years ago
  Sebastian a6e33bdd6a Fixed code so that GNU social can receive Mastodon boosts (from GNU social nightly commit: https://git.gnu.io/gnu/gnu-social/commit/c741d1a52a8256336632d090fa5ffd7d2cf549a9) 6 years ago
  mmn 50f9f23ff1 Merge branch 'xmpphp-fix' into 'master' 6 years ago
  mmn 34bd4e6441 Merge branch 'patch-1' into 'master' 6 years ago
  Florian Schmaus e615032331 Fix PHP incompatibilities in XMPPHP 6 years ago
  Danial Behzadi 16e7b5af12 Update INSTALL 6 years ago
5 changed files with 27 additions and 21 deletions
  1. 7 0
      CONFIGURE
  2. 4 14
      INSTALL
  3. 11 6
      lib/installer.php
  4. 4 0
      lib/util.php
  5. 1 1
      scripts/install_cli.php

+ 7 - 0
CONFIGURE

@@ -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
       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
 ---------
 

+ 4 - 14
INSTALL

@@ -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
    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-
-   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
+4. Create a database to hold your site data. Something like this
    should work (you will be prompted for your database password):
 
        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
    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
    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
    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
 
@@ -167,7 +157,7 @@ especially if you've previously installed PHP/MariaDB packages.
    install program will configure your site and install the initial,
    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
    now register new user, post some notices, edit your profile, etc.
 

+ 11 - 6
lib/installer.php

@@ -85,7 +85,7 @@ abstract class Installer
         $pass = true;
 
         $config = INSTALLDIR.'/config.php';
-        if (file_exists($config)) {
+        if (!$this->skipConfig && file_exists($config)) {
             if (!is_writable($config) || filesize($config) > 0) {
                 if (filesize($config) == 0) {
                     $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
-        if (!is_writable(INSTALLDIR)) {
+        if (!$this->skipConfig && !is_writable(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));
             $pass = false;
         }
 
         // 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) {
             $fileFullPath = INSTALLDIR."/$fileSubdir";
             if (!file_exists($fileFullPath)) {
@@ -148,7 +150,7 @@ abstract class Installer
                 $pass = false;
             }
         }
-
+        }
         return $pass;
     }
 
@@ -515,6 +517,9 @@ abstract class Installer
      */
     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';
 
         $data = array('nickname' => $this->adminNick,
@@ -580,10 +585,10 @@ abstract class Installer
             return false;
         }
 
+        if (!$this->skipConfig) {
         // Make sure we can write to the file twice
         $oldUmask = umask(000); 
 
-        if (!$this->skipConfig) {
             $this->updateStatus("Writing config file...");
             $res = $this->writeConf();
 
@@ -616,12 +621,12 @@ abstract class Installer
                 $this->updateStatus("Can't write to config file.", true);
                 return false;
             }
-        }
 
         // Restore original umask
         umask($oldUmask);
         // Set permissions back to something decent
         chmod(INSTALLDIR.'/config.php', 0644);
+        }
         
         $scheme = $this->ssl === 'always' ? 'https' : 'http';
         $link = "{$scheme}://{$this->server}/{$this->path}";

+ 4 - 0
lib/util.php

@@ -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.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) {
         $cfg->set($key, $val);
     }

+ 1 - 1
scripts/install_cli.php

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