X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FCore%2FInstaller.php;h=516408b4e3eb9885f1855ed89b3297ebfcd3deb3;hb=6c767743d1bfdfe44c0df37df10b50ba68cce200;hp=b780776cc100cd29a1fe0718d43ee47af835baf9;hpb=04d620fc2f567d32b50f5d5b0974acafeb072177;p=friendica.git
diff --git a/src/Core/Installer.php b/src/Core/Installer.php
index b780776cc1..516408b4e3 100644
--- a/src/Core/Installer.php
+++ b/src/Core/Installer.php
@@ -1,17 +1,33 @@
.
+ *
*/
+
namespace Friendica\Core;
use DOMDocument;
use Exception;
-use Friendica\Core\Config\Cache;
+use Friendica\Core\Config\ValueObject\Cache;
use Friendica\Database\Database;
use Friendica\Database\DBStructure;
use Friendica\DI;
use Friendica\Util\Images;
-use Friendica\Util\Network;
use Friendica\Util\Strings;
/**
@@ -113,14 +129,18 @@ class Installer
$returnVal = false;
}
- if (!$this->checkKeys()) {
+ if (!$this->checkTLS()) {
$returnVal = false;
}
- if (!$this->checkHtAccess($baseurl)) {
+ if (!$this->checkKeys()) {
$returnVal = false;
}
+ /// @TODO This check should not block installations because of containerization issues
+ /// @see https://github.com/friendica/docker/issues/134
+ $this->checkHtAccess($baseurl);
+
return $returnVal;
}
@@ -176,11 +196,11 @@ class Installer
*/
public function installDatabase($basePath)
{
- $result = DBStructure::update($basePath, false, true, true);
+ $result = DBStructure::install($basePath);
if ($result) {
$txt = DI::l10n()->t('You may need to import the file "database.sql" manually using phpmyadmin or mysql.') . EOL;
- $txt .= DI::l10n()->t('Please see the file "INSTALL.txt".');
+ $txt .= DI::l10n()->t('Please see the file "doc/INSTALL.md".');
$this->addCheck($txt, false, true, htmlentities($result, ENT_COMPAT, 'UTF-8'));
@@ -242,7 +262,7 @@ class Installer
$help = "";
if (!$passed) {
$help .= DI::l10n()->t('Could not find a command line version of PHP in the web server PATH.') . EOL;
- $help .= DI::l10n()->t("If you don't have a command line version of PHP installed on your server, you will not be able to run the background processing. See 'Setup the worker'") . EOL;
+ $help .= DI::l10n()->t("If you don't have a command line version of PHP installed on your server, you will not be able to run the background processing. See 'Setup the worker'") . EOL;
$help .= EOL . EOL;
$tpl = Renderer::getMarkupTemplate('field_input.tpl');
/// @todo Separate backend Installer class and presentation layer/view
@@ -258,7 +278,7 @@ class Installer
$cmd = "$phppath -v";
$result = trim(shell_exec($cmd));
$passed2 = (strpos($result, "(cli)") !== false);
- list($result) = explode("\n", $result);
+ [$result] = explode("\n", $result);
$help = "";
if (!$passed2) {
$help .= DI::l10n()->t("PHP executable is not the php cli binary \x28could be cgi-fgci version\x29") . EOL;
@@ -447,6 +467,13 @@ class Installer
);
$returnVal = $returnVal ? $status : false;
+ $status = $this->checkFunction('proc_open',
+ DI::l10n()->t('Program execution functions'),
+ DI::l10n()->t('Error: Program execution functions (proc_open) required but not enabled.'),
+ true
+ );
+ $returnVal = $returnVal ? $status : false;
+
$status = $this->checkFunction('json_encode',
DI::l10n()->t('JSON PHP module'),
DI::l10n()->t('Error: JSON PHP module required but not installed.'),
@@ -482,7 +509,7 @@ class Installer
$help = DI::l10n()->t('The web installer needs to be able to create a file called "local.config.php" in the "config" folder of your web server and it is unable to do so.') . EOL;
$help .= DI::l10n()->t('This is most often a permission setting, as the web server may not be able to write files in your folder - even if you can.') . EOL;
$help .= DI::l10n()->t('At the end of this procedure, we will give you a text to save in a file named local.config.php in your Friendica "config" folder.') . EOL;
- $help .= DI::l10n()->t('You can alternatively skip this procedure and perform a manual installation. Please see the file "INSTALL.txt" for instructions.') . EOL;
+ $help .= DI::l10n()->t('You can alternatively skip this procedure and perform a manual installation. Please see the file "doc/INSTALL.md" for instructions.') . EOL;
}
$this->addCheck(DI::l10n()->t('config/local.config.php is writable'), $status, false, $help);
@@ -523,7 +550,6 @@ class Installer
*
* @param string $baseurl The baseurl of the app
* @return bool false if something required failed
- * @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public function checkHtAccess($baseurl)
{
@@ -531,23 +557,25 @@ class Installer
$help = "";
$error_msg = "";
if (function_exists('curl_init')) {
- $fetchResult = Network::fetchUrlFull($baseurl . "/install/testrewrite");
+ $fetchResult = DI::httpClient()->fetchFull($baseurl . "/install/testrewrite");
$url = Strings::normaliseLink($baseurl . "/install/testrewrite");
if ($fetchResult->getReturnCode() != 204) {
- $fetchResult = Network::fetchUrlFull($url);
+ $fetchResult = DI::httpClient()->fetchFull($url);
}
if ($fetchResult->getReturnCode() != 204) {
$status = false;
- $help = DI::l10n()->t('Url rewrite in .htaccess is not working. Make sure you copied .htaccess-dist to .htaccess.');
+ $help = DI::l10n()->t('Url rewrite in .htaccess seems not working. Make sure you copied .htaccess-dist to .htaccess.') . EOL;
+ $help .= DI::l10n()->t('In some circumstances (like running inside containers), you can skip this error.');
$error_msg = [];
$error_msg['head'] = DI::l10n()->t('Error message from Curl when fetching');
$error_msg['url'] = $fetchResult->getRedirectUrl();
$error_msg['msg'] = $fetchResult->getError();
}
- $this->addCheck(DI::l10n()->t('Url rewrite is working'), $status, true, $help, $error_msg);
+ /// @TODO Required false because of cURL issues in containers - see https://github.com/friendica/docker/issues/134
+ $this->addCheck(DI::l10n()->t('Url rewrite is working'), $status, false, $help, $error_msg);
} else {
// cannot check modrewrite if libcurl is not installed
/// @TODO Maybe issue warning here?
@@ -556,6 +584,38 @@ class Installer
return $status;
}
+ /**
+ * TLS Check
+ *
+ * Tries to determine whether the connection to the server is secured
+ * by TLS or not. If not the user will be warned that it is higly
+ * encuraged to use TLS.
+ *
+ * @return bool (true) as TLS is not mandatory
+ */
+ public function checkTLS()
+ {
+ $tls = false;
+
+ if (isset($_SERVER['HTTPS'])) {
+ if (($_SERVER['HTTPS'] == 1) || ($_SERVER['HTTPS'] == 'on')) {
+ $tls = true;
+ }
+ }
+
+ if (!$tls) {
+ $help = DI::l10n()->t('The detection of TLS to secure the communication between the browser and the new Friendica server failed.');
+ $help .= ' ' . DI::l10n()->t('It is highly encouraged to use Friendica only over a secure connection as sensitive information like passwords will be transmitted.');
+ $help .= ' ' . DI::l10n()->t('Please ensure that the connection to the server is secure.');
+ $this->addCheck(DI::l10n()->t('No TLS detected'), $tls, false, $help);
+ } else {
+ $this->addCheck(DI::l10n()->t('TLS detected'), $tls, false, '');
+ }
+
+ // TLS is not required
+ return true;
+ }
+
/**
* Imagick Check
*
@@ -618,8 +678,8 @@ class Installer
/**
* Setup the default cache for a new installation
*
- * @param Cache $configCache The configuration cache
- * @param string $basePath The determined basepath
+ * @param \Friendica\Core\Config\ValueObject\Cache $configCache The configuration cache
+ * @param string $basePath The determined basepath
*
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/