File ampache-confpath.patch of Package ampache

Index: ampache-6.2.1/locale/base/gather-messages.sh
===================================================================
--- ampache-6.2.1.orig/locale/base/gather-messages.sh
+++ ampache-6.2.1/locale/base/gather-messages.sh
@@ -30,7 +30,7 @@ fi
 potfile='messages.pot'
 tdstxt='translatable-database-strings.txt'
 xhtmltxt='untranslated-strings.txt'
-ampconf='../../config/ampache.cfg.php'
+ampconf='/etc/ampache/ampache.cfg.php'
 
 ##############################################################
 
@@ -94,7 +94,7 @@ generate_pot_utds() {
                 $(find ../../ -type f \( -name "*.php" -o -name "*.inc" \) -not -path "../../config/*" -not -path "../../docs/*" -not -path "../../public/lib/components/*" -not -path "../../vendor/*" -not -path "../../tests/*" | sort)
     if [[ $? -eq 0 ]]; then
 
-        ampconf='../../config/ampache.cfg.php'
+        ampconf='/etc/ampache/ampache.cfg.php'
 
         echo -e "\033[32m Pot creation/update successful\033[0m\n"
         echo -e "Reading database login information from Amapche config file\n"
Index: ampache-6.2.1/public/templates/show_install_check.inc.php
===================================================================
--- ampache-6.2.1.orig/public/templates/show_install_check.inc.php
+++ ampache-6.2.1/public/templates/show_install_check.inc.php
@@ -35,10 +35,10 @@ require __DIR__ . '/install_header.inc.p
             </p>
             <ul>
                 <li><?php echo T_('A MySQL server with a username and password that can create/modify databases'); ?></li>
-                <li><?php /* HINT: %1 and %2 refer to Ampache configuration files */ echo sprintf(T_('Your webserver has read access to the files "%1$s" and "%2%s"'), __DIR__ . '/../../resources/sql/ampache.sql', __DIR__ . '/../../config/ampache.cfg.php.dist'); ?></li>
+                <li><?php /* HINT: %1 and %2 refer to Ampache configuration files */ echo sprintf(T_('Your webserver has read access to the files "%1$s" and "%2%s"'), __DIR__ . '/../../resources/sql/ampache.sql', '/etc/ampache/ampache.cfg.php.dist'); ?></li>
             </ul>
             <p>
-                <?php echo sprintf(T_("Once you have ensured that the above requirements are met please fill out the information below. You will only be asked for the required config values. If you would like to make changes to your Ampache install at a later date simply edit %s"), __DIR__ . '/../../config/ampache.cfg.php'); ?>
+                <?php echo sprintf(T_("Once you have ensured that the above requirements are met please fill out the information below. You will only be asked for the required config values. If you would like to make changes to your Ampache install at a later date simply edit %s"), '/etc/ampache/ampache.cfg.php'); ?>
             </p>
         </div>
 <table class="table">
@@ -50,7 +50,7 @@ require __DIR__ . '/install_header.inc.p
     <?php require __DIR__ . '/show_test_table.inc.php'; ?>
     <tr>
         <td><?php echo T_('"ampache.cfg.php.dist" is readable'); ?></td>
-        <td><?php echo debug_result(is_readable(__DIR__ . '/../../config/ampache.cfg.php.dist')); ?></td>
+        <td><?php echo debug_result(is_readable('/etc/ampache/ampache.cfg.php.dist')); ?></td>
         <td><?php echo T_('This tests whether the configuration template can be read.'); ?></td>
     </tr>
     <tr>
Index: ampache-6.2.1/public/templates/show_install_config.inc.php
===================================================================
--- ampache-6.2.1.orig/public/templates/show_install_config.inc.php
+++ ampache-6.2.1/public/templates/show_install_config.inc.php
@@ -246,7 +246,7 @@ foreach ($modes as $mode) { ?>
 
                 &nbsp;
                 <div class="col-sm-4">
-                    <?php echo T_('config/ampache.cfg.php action'); ?>
+                    <?php echo T_('/etc/ampache/ampache.cfg.php action'); ?>
                 </div>
                 <div class="col-sm-8">
                     <button type="submit" class="btn btn-warning" name="download"><?php echo T_('Download'); ?></button>
@@ -256,9 +256,9 @@ foreach ($modes as $mode) { ?>
                         <?php echo T_('Write'); ?>
                     </button>
                 </div>
-                <div class="col-sm-4 control-label"><?php echo T_('config/ampache.cfg.php exists?'); ?></div>
+                <div class="col-sm-4 control-label"><?php echo T_('/etc/ampache/ampache.cfg.php exists?'); ?></div>
                 <div class="col-sm-8"><?php echo debug_result(is_readable($configfile)); ?></div>
-                <div class="col-sm-4 control-label"><?php echo T_('config/ampache.cfg.php configured?'); ?></div>
+                <div class="col-sm-4 control-label"><?php echo T_('/etc/ampache/ampache.cfg.php configured?'); ?></div>
                 <div class="col-sm-8"><?php $results = (is_readable($configfile) && parse_ini_file($configfile)) ? parse_ini_file($configfile) : array();
 echo debug_result(check_config_values($results)); ?></div>
                 &nbsp;
Index: ampache-6.2.1/public/templates/show_test_config.inc.php
===================================================================
--- ampache-6.2.1.orig/public/templates/show_test_config.inc.php
+++ ampache-6.2.1/public/templates/show_test_config.inc.php
@@ -49,7 +49,7 @@ use Ampache\Module\Util\Ui;
   <div class="container" role="main">
     <div class="jumbotron" style="margin-top: 70px">
       <h1><?php echo T_('Ampache Configuration Parse Error'); ?></h1>
-      <p><?php /* HINT: ampache config file path */ echo sprintf(T_('You may have reached this page because your %s configuration file was not parsable'), '<strong>/config/ampache.cfg.php</strong>'); ?></p>
+      <p><?php /* HINT: ampache config file path */ echo sprintf(T_('You may have reached this page because your %s configuration file was not parsable'), '<strong>/etc/ampache/ampache.cfg.php</strong>'); ?></p>
       <p><a href="https://github.com/ampache/ampache/wiki/FAQ#im-getting-ampache-configuration-parse-error" rel="nofollow"><?php echo T_('Please visit the wiki for help'); ?></a></p>
     </div>
   </div>
Index: ampache-6.2.1/public/templates/show_test_table.inc.php
===================================================================
--- ampache-6.2.1.orig/public/templates/show_test_table.inc.php
+++ ampache-6.2.1/public/templates/show_test_table.inc.php
@@ -158,7 +158,7 @@ if (!$environment->check_dependencies_fo
     <td><?php echo T_('Configuration file readability'); ?></td>
     <td><?php echo debug_result(is_readable($configfile), "WARNING"); ?></td>
     <td>
-        <?php echo T_('This test attempts to read config/ampache.cfg.php. If this fails the file is either not in the correct location, or not readable.'); ?> </br>
+        <?php echo T_('This test attempts to read /etc/ampache/ampache.cfg.php. If this fails the file is either not in the correct location, or not readable.'); ?> </br>
         <?php echo T_('If you are installing Ampache for the first time you can ignore this warning and proceed to the installer.'); ?> &nbsp;<a href="install.php"><?php echo T_('Web Installation'); ?></a>
     </td>
 </tr>
Index: ampache-6.2.1/src/Config/ConfigContainer.php
===================================================================
--- ampache-6.2.1.orig/src/Config/ConfigContainer.php
+++ ampache-6.2.1/src/Config/ConfigContainer.php
@@ -138,6 +138,6 @@ final class ConfigContainer implements C
 
     public function getConfigFilePath(): string
     {
-        return __DIR__ . '/../../config/ampache.cfg.php';
+        return '/etc/ampache/ampache.cfg.php';
     }
 }
Index: ampache-6.2.1/src/Config/functions.php
===================================================================
--- ampache-6.2.1.orig/src/Config/functions.php
+++ ampache-6.2.1/src/Config/functions.php
@@ -518,8 +518,8 @@ function return_bytes($val)
 function check_config_writable(): bool
 {
     // file eixsts && is writable, or dir is writable
-    return ((file_exists(__DIR__ . '/../../config/ampache.cfg.php') && is_writeable(__DIR__ . '/../../config/ampache.cfg.php')) ||
-        (!file_exists(__DIR__ . '/../../config/ampache.cfg.php') && is_writeable(__DIR__ . '/../../config/')));
+    return ((file_exists('/etc/ampache/ampache.cfg.php') && is_writeable('/etc/ampache/ampache.cfg.php')) ||
+        (!file_exists('/etc/ampache/ampache.cfg.php') && is_writeable('/etc/ampache/')));
 }
 
 /**
Index: ampache-6.2.1/src/Config/Init/InitializationHandlerConfig.php
===================================================================
--- ampache-6.2.1.orig/src/Config/Init/InitializationHandlerConfig.php
+++ ampache-6.2.1/src/Config/Init/InitializationHandlerConfig.php
@@ -38,7 +38,7 @@ final class InitializationHandlerConfig
     private const CONFIG_VERSION = '69';
     private const STRUCTURE      = 'public';  // Project release is using either the public html folder or squashed structure
 
-    public const CONFIG_FILE_PATH = __DIR__ . '/../../../config/ampache.cfg.php';
+    public const CONFIG_FILE_PATH = '/etc/ampache/ampache.cfg.php';
 
     private EnvironmentInterface $environment;
 
Index: ampache-6.2.1/src/Module/Application/Admin/System/WriteConfigAction.php
===================================================================
--- ampache-6.2.1.orig/src/Module/Application/Admin/System/WriteConfigAction.php
+++ ampache-6.2.1/src/Module/Application/Admin/System/WriteConfigAction.php
@@ -66,7 +66,7 @@ final class WriteConfigAction implements
             throw new AccessDeniedException();
         }
 
-        if ($this->installationHelper->write_config(__DIR__ . '/../../../../../config/ampache.cfg.php')) {
+        if ($this->installationHelper->write_config('/etc/ampache/ampache.cfg.php')) {
             return $this->responseFactory->createResponse(StatusCode::FOUND)
                 ->withHeader(
                     'Location',
@@ -77,7 +77,7 @@ final class WriteConfigAction implements
         return $this->responseFactory->createResponse(StatusCode::FOUND)
             ->withHeader(
                 'Location',
-                sprintf('%s/error.php?permission=%s', $this->configContainer->getWebPath(), rawurlencode('config/ampache.cfg.php'))
+                sprintf('%s/error.php?permission=%s', $this->configContainer->getWebPath(), rawurlencode('/etc/ampache/ampache.cfg.php'))
             );
     }
 }
Index: ampache-6.2.1/src/Module/Application/Installation/DefaultAction.php
===================================================================
--- ampache-6.2.1.orig/src/Module/Application/Installation/DefaultAction.php
+++ ampache-6.2.1/src/Module/Application/Installation/DefaultAction.php
@@ -60,7 +60,7 @@ final class DefaultAction implements App
     {
         set_error_handler('ampache_error_handler');
 
-        $configfile = __DIR__ . '/../../../../config/ampache.cfg.php';
+        $configfile = '/etc/ampache/ampache.cfg.php';
 
         // Redirect if installation is already complete.
         if (!$this->installationHelper->install_check_status($configfile)) {
Index: ampache-6.2.1/src/Module/Application/Playback/PlayAction.php
===================================================================
--- ampache-6.2.1.orig/src/Module/Application/Playback/PlayAction.php
+++ ampache-6.2.1/src/Module/Application/Playback/PlayAction.php
@@ -412,7 +412,7 @@ final class PlayAction implements Applic
         // If we are in demo mode; die here
         if (AmpConfig::get('demo_mode')) {
             throw new AccessDeniedException(
-                'Streaming Access Denied: Disable demo_mode in \'config/ampache.cfg.php\''
+                'Streaming Access Denied: Disable demo_mode in \'/etc/ampache/ampache.cfg.php\''
             );
         }
         // Check whether streaming is allowed
Index: ampache-6.2.1/src/Module/Application/Test/ConfigAction.php
===================================================================
--- ampache-6.2.1.orig/src/Module/Application/Test/ConfigAction.php
+++ ampache-6.2.1/src/Module/Application/Test/ConfigAction.php
@@ -55,7 +55,7 @@ final class ConfigAction implements Appl
     {
         // Check to see if the config file is working now, if so fall
         // through to the default, else show the appropriate template
-        $configfile = __DIR__ . '/../../../../config/ampache.cfg.php';
+        $configfile = '/etc/ampache/ampache.cfg.php';
 
         if (!count(parse_ini_file($configfile))) {
             require_once __DIR__ . '/../../../../public/templates/show_test_config.inc.php';
Index: ampache-6.2.1/src/Module/Application/Test/ShowAction.php
===================================================================
--- ampache-6.2.1.orig/src/Module/Application/Test/ShowAction.php
+++ ampache-6.2.1/src/Module/Application/Test/ShowAction.php
@@ -60,7 +60,7 @@ final class ShowAction implements Applic
      */
     public function run(ServerRequestInterface $request, GuiGatekeeperInterface $gatekeeper): ?ResponseInterface
     {
-        $configfile = __DIR__ . '/../../../../config/ampache.cfg.php';
+        $configfile = '/etc/ampache/ampache.cfg.php';
         if (!file_exists($configfile)) {
             return $this->responseFactory
                 ->createResponse(StatusCode::FOUND)
Index: ampache-6.2.1/src/Module/Cli/InstallerCommand.php
===================================================================
--- ampache-6.2.1.orig/src/Module/Cli/InstallerCommand.php
+++ ampache-6.2.1/src/Module/Cli/InstallerCommand.php
@@ -56,7 +56,7 @@ final class InstallerCommand extends Com
     public function execute(): void
     {
         $interactor = $this->io();
-        $configfile = __DIR__ . '/../../../config/ampache.cfg.php';
+        $configfile = '/etc/ampache/ampache.cfg.php';
         $values     = $this->values();
 
         $force       = $values['force'];
Index: ampache-6.2.1/src/Module/System/InstallationHelper.php
===================================================================
--- ampache-6.2.1.orig/src/Module/System/InstallationHelper.php
+++ ampache-6.2.1/src/Module/System/InstallationHelper.php
@@ -344,7 +344,7 @@ final class InstallationHelper implement
      */
     public function install_create_config($download = false): bool
     {
-        $config_file = __DIR__ . '/../../../config/ampache.cfg.php';
+        $config_file = '/etc/ampache/ampache.cfg.php';
 
         /* Attempt to make DB connection */
         Dba::dbh();
@@ -651,7 +651,7 @@ final class InstallationHelper implement
     public function generate_config(array $current): string
     {
         // Start building the new config file
-        $distfile = __DIR__ . '/../../../config/ampache.cfg.php.dist';
+        $distfile = '/etc/ampache/ampache.cfg.php.dist';
         $handle   = fopen($distfile, 'r');
         $dist     = fread($handle, Core::get_filesize($distfile));
         fclose($handle);
Index: ampache-6.2.1/tests/Config/ConfigContainerTest.php
===================================================================
--- ampache-6.2.1.orig/tests/Config/ConfigContainerTest.php
+++ ampache-6.2.1/tests/Config/ConfigContainerTest.php
@@ -244,7 +244,7 @@ class ConfigContainerTest extends Mocker
     public function testGetConfigFilePathReturnsPath(): void
     {
         $this->assertStringContainsString(
-            '/config/ampache.cfg.php',
+            '/etc/ampache/ampache.cfg.php',
             $this->createSubject([])->getConfigFilePath()
         );
     }
Index: ampache-6.2.1/tests/Module/Application/Admin/System/WriteConfigActionTest.php
===================================================================
--- ampache-6.2.1.orig/tests/Module/Application/Admin/System/WriteConfigActionTest.php
+++ ampache-6.2.1/tests/Module/Application/Admin/System/WriteConfigActionTest.php
@@ -170,7 +170,7 @@ class WriteConfigActionTest extends Mock
         $this->installationHelper->shouldReceive('write_config')
             ->with(
                 Mockery::on(function ($path): bool {
-                    $test_path = __DIR__ . '/../../../../../config/ampache.cfg.php';
+                    $test_path = '/etc/ampache/ampache.cfg.php';
 
                     $this->assertTrue(
                         file_exists(dirname($path))
Index: ampache-6.2.1/src/Module/User/Registration/RegistrationAgreementRenderer.php
===================================================================
--- ampache-6.2.1.orig/src/Module/User/Registration/RegistrationAgreementRenderer.php
+++ ampache-6.2.1/src/Module/User/Registration/RegistrationAgreementRenderer.php
@@ -32,7 +32,7 @@ final class RegistrationAgreementRendere
     private string $filePath;
 
     public function __construct(
-        string $filePath = __DIR__ . '/../../../../config/registration_agreement.php'
+        string $filePath = '/etc/ampache/registration_agreement.php'
     ) {
         $this->filePath = $filePath;
     }
openSUSE Build Service is sponsored by