From fb8cc06ce25531d1e2af4afb41cab943112d18e2 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Sat, 29 Mar 2025 15:45:59 -0400 Subject: [PATCH 1/2] Remove remaining references of unused urlpath config key --- doc/Config.md | 14 ++------------ doc/Install.md | 1 - doc/Settings.md | 2 +- doc/de/Settings.md | 2 +- src/App/BaseURL.php | 3 +-- static/defaults.config.php | 11 +++++++++++ .../datasets/config/transformer/C.node.config.php | 1 - .../Console/AutomaticInstallationConsoleTest.php | 7 +------ 8 files changed, 17 insertions(+), 24 deletions(-) diff --git a/doc/Config.md b/doc/Config.md index 3e0459f9c8..afd4e65277 100644 --- a/doc/Config.md +++ b/doc/Config.md @@ -43,7 +43,7 @@ Some examples of common known configuration files: Addons can define their own default configuration values in `addon/[addon]/config/[addon].config.php` which is loaded when the addon is activated. If needed, an alternative `config` path can be used by using the `FRIENDICA_CONFIG_DIR` environment variable (full path required!). -This is useful in case of hardening the system by separating configuration from program binaries. +This is useful in case of hardening the system by separating configuration from program binaries. ### Static Configuration location @@ -160,16 +160,6 @@ $a->config['register_policy'] = REGISTER_CLOSED;
-$a->path = "value";
-
-
-'system' => [
-	'urlpath' => 'value',
-],
-
- - -
 $default_timezone = "value";
 
@@ -313,7 +303,7 @@ Enabling the admin panel for an account, and thus making the account holder admi
     'config' => [
         'admin_email' => 'someone@example.com',
     ]
-    
+
 
 Where you have to match the email address used for the account with the one you enter to the `config/local.config.php` file.
 If more than one account should be able to access the admin panel, separate the email addresses with a comma.
diff --git a/doc/Install.md b/doc/Install.md
index f613b2ffc3..3c162d519b 100644
--- a/doc/Install.md
+++ b/doc/Install.md
@@ -218,7 +218,6 @@ All options will be saved in the `config/local.config.php` and are overruling th
 -	`-U|--dbuser ` The username of the mysql/mariadb database login (env `MYSQL_USER` or `MYSQL_USERNAME`)
 -	`-P|--dbpass ` The password of the mysql/mariadb database login (env `MYSQL_PASSWORD`)
 -	`-d|--dbdata ` The name of the mysql/mariadb database (env `MYSQL_DATABASE`)
--	`-u|--urlpath ` The URL path of Friendica - f.e. '/friendica' (env `FRIENDICA_URL_PATH`)
 -	`-b|--phppath ` The path of the PHP binary (env `FRIENDICA_PHP_PATH`)
 -	`-A|--admin ` The admin email address of Friendica (env `FRIENDICA_ADMIN_MAIL`)
 -	`-T|--tz ` The timezone of Friendica (env `FRIENDICA_TZ`)
diff --git a/doc/Settings.md b/doc/Settings.md
index 00c8be2c2e..7ca0e22286 100644
--- a/doc/Settings.md
+++ b/doc/Settings.md
@@ -419,7 +419,7 @@ We strongly discourage you from doing so, as this will break federation to other
 Say you have a subdirectory for tests and put Friendica into a further subdirectory, the config would be:
 
 	'system' => [
-		'urlpath' => 'tests/friendica',
+		'url' => 'https://example.com/tests/friendica',
 	],
 
 ## Other exceptions
diff --git a/doc/de/Settings.md b/doc/de/Settings.md
index 34b349e885..cee965ccaf 100644
--- a/doc/de/Settings.md
+++ b/doc/de/Settings.md
@@ -410,7 +410,7 @@ Wir raten allerdings dringen davon ab, da es die Interoperabilität mit anderen
 Mal angenommen, du hast ein Unterverzeichnis tests und willst Friendica in ein weiteres Unterverzeichnis installieren, dann lautet die Konfiguration hierfĂĽr:
 
 	'system' => [
-		'urlpath' => 'tests/friendica',
+		'url' => 'https://example.com/tests/friendica',
 	],
 
 ## Weitere Ausnahmen
diff --git a/src/App/BaseURL.php b/src/App/BaseURL.php
index 83416866f0..0ebf72dbf8 100644
--- a/src/App/BaseURL.php
+++ b/src/App/BaseURL.php
@@ -17,8 +17,7 @@ use Psr\Http\Message\UriInterface;
 use Psr\Log\LoggerInterface;
 
 /**
- * A class which checks and contains the basic
- * environment for the BaseURL (url, urlpath, ssl_policy, hostname, scheme)
+ * A class which checks and contains the basic environment for the BaseURL (url)
  */
 class BaseURL extends Uri implements UriInterface
 {
diff --git a/static/defaults.config.php b/static/defaults.config.php
index d821ff1813..4a150ec7ab 100644
--- a/static/defaults.config.php
+++ b/static/defaults.config.php
@@ -126,6 +126,11 @@ return [
 		// Display "Emoji Only" posts in big.
 		'big_emojis' => true,
 
+		// basepath (String)
+		// Absolute file path to your Friendica install
+		// Examples: /var/www, /home/user/friendica...
+		'basepath' => '',
+
 		// bulk_delivery (Boolean)
 		// Delivers AP messages in a bulk (experimental)
 		'bulk_delivery' => false,
@@ -576,6 +581,12 @@ return [
 		// Transmit pending events upon accepted contact request for groups
 		'transmit_pending_events' => false,
 
+		// url (String)
+		// The absolute URL used to access your Friendica node. It should include the scheme, the domain name, and the
+		// sub-folder if any. Used by command-line processes to send correct links to your Friendica server.
+		// Example: https://example.com/friendica
+		'url' => '',
+
 		// username_min_length (Integer)
 		// The minimum character length a username can be.
 		// This length is checked once the username has been trimmed and multiple spaces have been collapsed into one.
diff --git a/tests/datasets/config/transformer/C.node.config.php b/tests/datasets/config/transformer/C.node.config.php
index 44969d1eb5..0b2964acd2 100644
--- a/tests/datasets/config/transformer/C.node.config.php
+++ b/tests/datasets/config/transformer/C.node.config.php
@@ -17,7 +17,6 @@ return [
 		'temppath' => '/tmp/friendica.local',
 		'theme' => 'frio',
 		'url' => 'https://friendica.local',
-		'urlpath' => '',
 		'build' => 1508,
 		'maintenance' => false,
 		'dbupdate' => 1,
diff --git a/tests/src/Console/AutomaticInstallationConsoleTest.php b/tests/src/Console/AutomaticInstallationConsoleTest.php
index 7fe56bb152..f3466c0203 100644
--- a/tests/src/Console/AutomaticInstallationConsoleTest.php
+++ b/tests/src/Console/AutomaticInstallationConsoleTest.php
@@ -129,7 +129,6 @@ class AutomaticInstallationConsoleTest extends ConsoleTestCase
 					],
 					'system' => [
 						'basepath'         => '',
-						'urlpath'          => '',
 						'url'              => 'http://friendica.local',
 						'ssl_policy'       => 0,
 						'default_timezone' => '',
@@ -152,7 +151,6 @@ class AutomaticInstallationConsoleTest extends ConsoleTestCase
 						'admin_email' => 'admin@philipp.info',
 					],
 					'system' => [
-						'urlpath'          => 'test/it',
 						'url'              => 'http://friendica.local/test/it',
 						'basepath'         => '',
 						'ssl_policy'       => '2',
@@ -176,7 +174,6 @@ class AutomaticInstallationConsoleTest extends ConsoleTestCase
 						'admin_email' => 'admin@philipp.info',
 					],
 					'system' => [
-						'urlpath'          => 'test/it',
 						'url'              => 'https://friendica.local/test/it',
 						'basepath'         => '',
 						'ssl_policy'       => '1',
@@ -352,7 +349,6 @@ FIN;
 		self::assertConfigEntry('system', 'default_timezone', $assertion, ($default) ? Installer::DEFAULT_TZ : null);
 		self::assertConfigEntry('system', 'language', $assertion, ($default) ? Installer::DEFAULT_LANG : null);
 		self::assertConfigEntry('system', 'url', $assertion);
-		self::assertConfigEntry('system', 'urlpath', $assertion);
 		self::assertConfigEntry('system', 'ssl_policy', $assertion, ($default) ? App\BaseURL::DEFAULT_SSL_SCHEME : null);
 		self::assertConfigEntry('system', 'basepath', ($realBasepath) ? $this->root->url() : $assertion);
 	}
@@ -446,7 +442,6 @@ return [
 	],
 	'system' => [
 		'basepath' => '{$conf('system', 'basepath')}',
-		'urlpath' => '{$conf('system', 'urlpath')}',
 		'url' => '{$conf('system', 'url')}',
 		'ssl_policy' => '{$conf('system', 'ssl_policy')}',
 		'default_timezone' => '{$conf('system', 'default_timezone')}',
@@ -604,7 +599,7 @@ CONF;
 		self::assertStuckDB($txt);
 		self::assertTrue($this->root->hasChild('config' . DIRECTORY_SEPARATOR . 'local.config.php'));
 
-		self::assertConfig(['config' => ['hostname' => 'friendica.local'], 'system' => ['url' => 'http://friendica.local', 'ssl_policy' => 0, 'urlpath' => '']], false, true, false, true);
+		self::assertConfig(['config' => ['hostname' => 'friendica.local'], 'system' => ['url' => 'http://friendica.local', 'ssl_policy' => 0]], false, true, false, true);
 	}
 
 	public function testGetHelp()

From 0f7c7394703822307b4ccc3501c207a4e4f206e6 Mon Sep 17 00:00:00 2001
From: Philipp 
Date: Sat, 3 May 2025 21:39:58 +0200
Subject: [PATCH 2/2] Update BaseURL.php

Fix PHP-CS
---
 src/App/BaseURL.php | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/App/BaseURL.php b/src/App/BaseURL.php
index 0ebf72dbf8..7aaafdc8bf 100644
--- a/src/App/BaseURL.php
+++ b/src/App/BaseURL.php
@@ -42,8 +42,7 @@ class BaseURL extends Uri implements UriInterface
 		/* Relative script path to the web server root
 		 * Not all of those $_SERVER properties can be present, so we do by inverse priority order
 		 */
-		$relativeScriptPath =
-			($server['REDIRECT_URL'] ?? '') ?:
+		$relativeScriptPath = ($server['REDIRECT_URL'] ?? '') ?:
 				($server['REDIRECT_URI'] ?? '') ?:
 					($server['REDIRECT_SCRIPT_URL'] ?? '') ?:
 						($server['SCRIPT_URL'] ?? '') ?: