Changeset 128

Show
Ignore:
Timestamp:
2008-02-09 17:14:45 (1 year ago)
Author:
hannes
Message:

graceful handling of failure to set file permissions in the installer (ticket #69)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/includes/lang/de.php

    r108 r128  
    386386$LANG['group_memberships_updated'] = 'Ihre Gruppenmitgliedschaften wurden gespeichert.'; 
    387387$LANG['installer_intro'] = 'Hallo und willkommen zum Spam-Board-Installationsskript! Hiermit installieren sie Version ' . $VERSION . " des Forums.<br /><br />Es werden Ihnen im Folgenden ein paar Fragen gestellt. Sie brauchen sich jedoch nicht darum zu sorgen, etwas falsch zu machen, denn nichts wird tatsächlich durchgeführt, bevor Sie im vorletzten Schritt die Gelegenheit hatten, alle Daten nochmals zu überprüfen. Bitte benutzen Sie nicht die Vor und Zurück-Buttons Ihres Browsers, da dies zu Problemen führen kann. Sollten Sie eventuelle Fehler bemerken, oder sich während des Vorgangs bzgl. einer Angabe umentscheiden, können Sie jederzeit mit Hilfe des entsprechenden Buttons vor vorne beginnen.<br /><br />Diese Einleitungstexte sollten Ihnen die benötigten Hintergrunderklärungen liefern. Sollten Sie weitere Informationen benötigen, könnte Sie der (englische) <a href=\"http://www.spamboard.net/wiki/UsersGuide\" target=\"_blank\">&quot;User's Guide&quot;</a> auf der Spam-Board-Homepage interessieren."; 
    388 $LANG['installer_permissions'] = "Um zu funktionieren, benötigt das Boardskript Schreibrechte auf bestimmte Verzeichnisse und Dateien. Das Installationsskript kann versuchen, diese Rechte automatisch zu setzen, und wenn Ihr Webserver auf einem UNIX-artigen System läuft, wird das mit größter Wahrscheinlichkeit funktionieren (sofern die UID, unter der der Webserver läuft, der Besitzer der Dateien ist). Sofern Sie jedoch einfach das Releasearchiv von der offiziellen Homepage heruntergeladen, und direkt auf Ihren Webserver entpackt haben, ist dies wahrscheinlich unnötig, da die Rechte bereits korrekt sind. Wenn Sie das Archiv jedoch zuerst auf einem andersartigen System (z.B. Microsoft Windows) entpackt, und die Dateien von dort hochgeladen haben, sind die Rechte verlorengegangen. Wählen Sie die Checkbox an, sofern Sie möchten, dass das Installationsskript für Sie die Rechte wieder setzt."; 
     388$LANG['installer_permissions'] = "Um zu funktionieren, benötigt das Boardskript Schreibrechte auf bestimmte Verzeichnisse und Dateien. Das Installationsskript kann versuchen, diese Rechte automatisch zu setzen, und wenn Ihr Webserver auf einem UNIX-artigen System läuft, wird das mit größter Wahrscheinlichkeit funktionieren (sofern die UID, unter der der Webserver läuft, der Besitzer der Dateien ist). Sofern Sie jedoch einfach das Releasearchiv von der offiziellen Homepage heruntergeladen, und direkt auf Ihren Webserver entpackt haben, ist dies wahrscheinlich unnötig, da die Rechte bereits korrekt sind. Wenn Sie das Archiv jedoch zuerst auf einem andersartigen System (z.B. Microsoft Windows) entpackt, und die Dateien von dort hochgeladen haben, sind die Rechte verlorengegangen. Wählen Sie die Checkbox an, sofern Sie möchten, dass das Installationsskript für Sie die Rechte wieder setzt. Sollte es n&ouml;tig sein, dass Sie die Rechte manuell setzen, folgen Sie bitte den Anweisungen unter <a href=\"http://www.spamboard.net/wiki/FilePermissions\" target=\"_blank\">https://www.spamboard.net/wiki/FilePermissions</a>."; 
    389389$LANG['installer_database'] = "Bitte geben Sie nun einige Informationen über das von Ihnen benutzte Datenbanksystem ein. Wenn Sie SQLite benutzen, brauchen Sie keinen Benutzernamen und kein Passwort einzugeben. Andere Datenbanksysteme benötigen diese Angaben, und die Datenbank muss bereits existieren. Das Tabellenpräfix wird an den Anfang jedes Tabellennamens geschrieben. Dadurch kann das Board in einer Datenbank, die auch noch andere (boardfremde) Tabellen enthält, betrieben werden."; 
    390390$LANG['installer_pathes'] = "Bitte geben Sie zwei Pfade ein, die den Installationsort des Boards definieren. Der Dateisystempfad ist der Pfad vom Root des Dateisystems zum Root des Boardskripts. Der Webserverpfad ist der Verzeichnisbaum nach der Top-Level-Domain (.com, .net, .org) bis zum Board-Root. Das Installationsskript hat bereits versucht, diese Angaben herauszubekommen und gibt Ihnen Werte vor, die höchstwahrscheinlich stimmen. Bitte ändern Sie sie nur, wenn Sie wissen, was Sie tun."; 
  • trunk/includes/lang/en.php

    r108 r128  
    387387$LANG['group_memberships_updated'] = 'Your group memberships have been updated successfully.'; 
    388388$LANG['installer_intro'] = 'Hello and welcome to the Spam Board installer script! You are about to install version ' . $VERSION . " of this forum.<br /><br />We will ask you a few questions now. Don't worry, nothing will be committed before you had a chance to review all the options again. Please don't use your browser's back and forward buttons, as they'll break things. If you feel the need to change anything, you can start over at any time by using the respective button.<br /><br />These texts should give you the information needed to fill everything out. If you need additional help, try the <a href=\"http://www.spamboard.net/wiki/UsersGuide\" target=\"_blank\">User's Guide</a> available on the Spam Board website."; 
    389 $LANG['installer_permissions'] = "To function properly, the board needs write permissions on certain directories and files. The script can attempt to set these permissions automatically for you, if your webserver runs on a UNIX-ish system, chances are it'll work (if the UID the webserver is running under owns the files that is). However, if you've just downloaded a release archive from the official website and extracted it directly on your webserver, this isn't necessary, as everything should already be set up correctly. If, however, you extracted the archive on another system (e.g. Microsoft Windows) first and uploaded the files to your webspace from there, the permissions have been lost. Check the box below if you want the script to set the permissions again."; 
     389$LANG['installer_permissions'] = "To function properly, the board needs write permissions on certain directories and files. The script can attempt to set these permissions automatically for you, if your webserver runs on a UNIX-ish system, chances are it'll work (if the UID the webserver is running under owns the files that is). However, if you've just downloaded a release archive from the official website and extracted it directly on your webserver, this isn't necessary, as everything should already be set up correctly. If, however, you extracted the archive on another system (e.g. Microsoft Windows) first and uploaded the files to your webspace from there, the permissions have been lost. Check the box below if you want the script to set the permissions again. If you need to set these up manually, follow the instructions found at <a href=\"http://www.spamboard.net/wiki/FilePermissions\" target=\"_blank\">https://www.spamboard.net/wiki/FilePermissions</a>."; 
    390390$LANG['installer_database'] = "Now please enter some information about the database system you're going to use. If you select SQLite, you don't have to enter a username and password. For other database systems, the database you enter here already has to exist. The table prefix is put in front of the name of each table the board will create. This enabled you to run the board within a database which also contains other tables."; 
    391391$LANG['installer_pathes'] = "Please enter two pathes which define the location you're installing the board to. The file system path is the board root in respect to the filesystem root. The web path is the directory tree after the top level domain (.com, .net, .org) to the board root. The installer script has already tried to guess them and entered these values into the respective fields. Usually, this should be correct. Only change these values if you know what you're doing."; 
  • trunk/install.php

    r117 r128  
    6060$nextpage = $page + 1; 
    6161 
    62 // since this is important define the order in which the password hashes should be suggested 
     62// since this is important, define the order in which the password hashes should be suggested 
    6363$hashes_default = Array(); 
    6464$hashes_default[0] = 'sha512'; 
     
    334334            } 
    335335        } 
    336         /* test whether db and settings directories are accessable via HTTP */ 
    337         $fp = @fsockopen($_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], $errno, $errstr, 30); 
    338         if ($fp !== FALSE) { 
    339             // db 
    340             $req = 'GET ' . $SETTINGS['webpath'] . "db/spamboard.sql HTTP/1.1\r\n"; 
    341             $req .= 'Host: ' . $_SERVER['SERVER_NAME'] . "\r\n"; 
    342             $req .= "Connection: Close\r\n\r\n"; 
    343             fwrite($fp, $req); 
    344             $reply = ''; 
    345             while (!feof($fp)) { 
    346                 $reply .= fgets($fp, 128); 
    347             } 
    348             fclose($fp); 
    349             if (strpos($reply, '403 Forbidden') === FALSE) { 
    350                 // db accessable via HTTP -> bad 
     336        if ($ok == 1) { 
     337            /* test whether db and settings directories are accessable via HTTP */ 
     338            $fp = @fsockopen($_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], $errno, $errstr, 30); 
     339            if ($fp !== FALSE) { 
     340                // db 
     341                $req = 'GET ' . $SETTINGS['webpath'] . "db/spamboard.sql HTTP/1.1\r\n"; 
     342                $req .= 'Host: ' . $_SERVER['SERVER_NAME'] . "\r\n"; 
     343                $req .= "Connection: Close\r\n\r\n"; 
     344                fwrite($fp, $req); 
     345                $reply = ''; 
     346                while (!feof($fp)) { 
     347                    $reply .= fgets($fp, 128); 
     348                } 
     349                fclose($fp); 
     350                if (strpos($reply, '403 Forbidden') === FALSE) { 
     351                    // db accessable via HTTP -> bad 
     352                    $ok = -1; 
     353                } 
     354            } else { 
    351355                $ok = -1; 
    352356            } 
    353         } else { 
    354             $ok = -1; 
    355         } 
    356         $fp = @fsockopen($_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], $errno, $errstr, 30); 
    357         if ($fp !== FALSE) { 
    358             // sessions 
    359             @touch('sessions/test.file'); 
    360             $req = 'GET ' . $SETTINGS['webpath'] . "sessions/test.file HTTP/1.1\r\n"; 
    361             $req .= 'Host: ' . $_SERVER['SERVER_NAME'] . "\r\n"; 
    362             $req .= "Connection: Close\r\n\r\n"; 
    363             fwrite($fp, $req); 
    364             $reply = ''; 
    365             while (!feof($fp)) { 
    366                 $reply .= fgets($fp, 128); 
    367             } 
    368             fclose($fp); 
    369             if (strpos($reply, '403 Forbidden') === FALSE) { 
    370                 // db accessable via HTTP -> bad 
     357            $fp = @fsockopen($_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], $errno, $errstr, 30); 
     358            if ($fp !== FALSE) { 
     359                // sessions 
     360                @touch('sessions/test.file'); 
     361                $req = 'GET ' . $SETTINGS['webpath'] . "sessions/test.file HTTP/1.1\r\n"; 
     362                $req .= 'Host: ' . $_SERVER['SERVER_NAME'] . "\r\n"; 
     363                $req .= "Connection: Close\r\n\r\n"; 
     364                fwrite($fp, $req); 
     365                $reply = ''; 
     366                while (!feof($fp)) { 
     367                    $reply .= fgets($fp, 128); 
     368                } 
     369                fclose($fp); 
     370                if (strpos($reply, '403 Forbidden') === FALSE) { 
     371                    // db accessable via HTTP -> bad 
     372                    $ok = -1; 
     373                } 
     374                @unlink('sessions/test.file'); 
     375            } else { 
    371376                $ok = -1; 
    372377            } 
    373             @unlink('sessions/test.file'); 
    374         } else { 
    375             $ok = -1; 
    376         } 
    377         if ($ok == -1) { 
    378             // message about securing db and settings directories 
    379             print($LANG['installer_warning_insecure_directories'] . '<br /><br />'); 
    380             // this won't make the overall installation fail 
    381             $ok = 1; 
    382         } 
    383         /* clean up */ 
    384         if ($ok == 1) { 
    385             // remove settings.tmpl 
    386             if (@unlink('includes/config/settings.tmpl')) { 
    387             } else { $ok = 2; } 
    388             // remove crypt.tmpl 
    389             if (@unlink('includes/config/crypt.tmpl')) { 
    390             } else { $ok = 2; } 
    391             // remove bans.tmpl 
    392             if (@unlink('includes/config/bans.tmpl')) { 
    393             } else { $ok = 2; } 
    394             // remove logins.tmpl 
    395             if (@unlink('includes/config/logins.tmpl')) { 
    396             } else { $ok = 2; } 
    397             // remove memberstages.tmpl 
    398             if (@unlink('includes/config/memberstages.tmpl')) { 
    399             } else { $ok = 2; } 
    400         } else { 
    401             // something went wrong, so remove everything from the database again 
    402             if ($db = @file_get_contents('db/clean.sql')) { 
    403                 // one SQL query at a time 
    404                 $db = explode(';', $db); 
    405                 foreach ($db as $query) { 
    406                     @$C->query(str_replace('%prefix%', $SETTINGS['dbtableprefix'], $query)); 
    407                 } 
    408             } 
    409         } 
    410         /* everything done */ 
    411         if ($ok >= 1) { 
    412             if ($ok == 2) { 
    413                 print($LANG['installer_warning_cleanup_failed'] . '<br /><br />'); 
    414             } 
    415             if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { 
    416                 $_s = 's'; 
    417             } else { $_s = ''; } 
    418             print(str_replace('%boardurl%', 'http' . $_s . '://' . $_SERVER['HTTP_HOST'] . $SETTINGS['webpath'] , $LANG['installer_overall_success'])); 
     378            if ($ok == -1) { 
     379                // message about securing db and settings directories 
     380                print($LANG['installer_warning_insecure_directories'] . '<br /><br />'); 
     381                // this won't make the overall installation fail 
     382                $ok = 1; 
     383            } 
     384            /* clean up */ 
     385            if ($ok == 1) { 
     386                // remove settings.tmpl 
     387                if (@unlink('includes/config/settings.tmpl')) { 
     388                } else { $ok = 2; } 
     389                // remove crypt.tmpl 
     390                if (@unlink('includes/config/crypt.tmpl')) { 
     391                } else { $ok = 2; } 
     392                // remove bans.tmpl 
     393                if (@unlink('includes/config/bans.tmpl')) { 
     394                } else { $ok = 2; } 
     395                // remove logins.tmpl 
     396                if (@unlink('includes/config/logins.tmpl')) { 
     397                } else { $ok = 2; } 
     398                // remove memberstages.tmpl 
     399                if (@unlink('includes/config/memberstages.tmpl')) { 
     400                } else { $ok = 2; } 
     401            } else { 
     402                // something went wrong, so remove everything from the database again 
     403                if ($db = @file_get_contents('db/clean.sql')) { 
     404                    // one SQL query at a time 
     405                    $db = explode(';', $db); 
     406                    foreach ($db as $query) { 
     407                        @$C->query(str_replace('%prefix%', $SETTINGS['dbtableprefix'], $query)); 
     408                    } 
     409                } 
     410            } 
     411            /* everything done */ 
     412            if ($ok >= 1) { 
     413                if ($ok == 2) { 
     414                    print($LANG['installer_warning_cleanup_failed'] . '<br /><br />'); 
     415                } 
     416                if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') { 
     417                    $_s = 's'; 
     418                } else { $_s = ''; } 
     419                print(str_replace('%boardurl%', 'http' . $_s . '://' . $_SERVER['HTTP_HOST'] . $SETTINGS['webpath'] , $LANG['installer_overall_success'])); 
     420            } 
    419421        } 
    420422    break;