Skip to content

Commit

Permalink
Keep config directory as user config, move system config elsewhere
Browse files Browse the repository at this point in the history
closes #1822
  • Loading branch information
trasher committed Apr 30, 2024
1 parent 84bc07e commit 850588d
Show file tree
Hide file tree
Showing 14 changed files with 26 additions and 18 deletions.
1 change: 1 addition & 0 deletions .composer-require-checker.config.json
Expand Up @@ -30,6 +30,7 @@
"GALETTE_CARD_ROWS",
"GALETTE_CARD_WIDTH",
"GALETTE_COMPAT_VERSION",
"GALETTE_SYSCONFIG_PATH",
"GALETTE_CONFIG_PATH",
"GALETTE_DATA_PATH",
"GALETTE_DB_VERSION",
Expand Down
4 changes: 2 additions & 2 deletions bin/release
Expand Up @@ -142,7 +142,7 @@ def is_version_bumped(ver):
global repo, tag_commit

versions_file = repo.git.execute(
["git", "show", f"{tag_commit}:{os.path.join('galette', 'config', 'versions.inc.php')}"])
["git", "show", f"{tag_commit}:{os.path.join('galette', 'includes', 'sys_config', 'versions.inc.php')}"])
file_version = re.search("^define\\('GALETTE_VERSION', 'v(?P<version>.+)'\\)", versions_file, re.MULTILINE)
if file_version.group('version') != ver:
print_err('Trying to release %s, but bumped version is %s!' % (ver, file_version.group('version')))
Expand Down Expand Up @@ -387,7 +387,7 @@ def add_libs(rel_name, galette_archive):
galette.close()

# set galette nightly version
config_dir = os.path.join(src_dir, rel_name, 'galette', 'config')
config_dir = os.path.join(src_dir, rel_name, 'galette', 'includes', 'sys_config')
if nightly_version != None:
sed_cmd = 'sed -e "s/GALETTE_NIGHTLY\', false/GALETTE_NIGHTLY\', \'%s\'/" -i versions.inc.php' % nightly_version
print(sed_cmd)
Expand Down
4 changes: 2 additions & 2 deletions galette/includes/galette.inc.php
Expand Up @@ -24,8 +24,8 @@
define('GALETTE_ROOT', __DIR__ . '/../');
}

require_once GALETTE_ROOT . 'config/versions.inc.php';
require_once GALETTE_ROOT . 'config/paths.inc.php';
require_once GALETTE_ROOT . '/includes/sys_config/versions.inc.php';
require_once GALETTE_ROOT . '/includes/sys_config/paths.inc.php';

// check required PHP version...
if (version_compare(PHP_VERSION, GALETTE_PHP_MIN, '<')) {
Expand Down
File renamed without changes.
@@ -1,4 +1,5 @@
<?php

/**
* Copyright © 2003-2024 The Galette Team
*
Expand Down
@@ -1,4 +1,5 @@
<?php

/**
* Copyright © 2003-2024 The Galette Team
*
Expand Down Expand Up @@ -41,9 +42,11 @@
}

//Galette paths
const GALETTE_SYSCONFIG_PATH = GALETTE_ROOT . 'includes/sys_config/';
if (!defined('GALETTE_CONFIG_PATH')) {
define('GALETTE_CONFIG_PATH', GALETTE_ROOT . 'config/');
}

if (!defined('GALETTE_PLUGINS_PATH')) {
define('GALETTE_PLUGINS_PATH', GALETTE_ROOT . 'plugins/');
}
Expand Down
@@ -1,4 +1,5 @@
<?php

/**
* Copyright © 2003-2024 The Galette Team
*
Expand Down Expand Up @@ -32,4 +33,4 @@
define('GALETTE_NIGHTLY', false);
define('GALETTE_VERSION', 'v1.1.0-dev');
define('GALETTE_COMPAT_VERSION', '1.1.0');
define('GALETTE_DB_VERSION', '1.100');
define('GALETTE_DB_VERSION', '1.100');
2 changes: 1 addition & 1 deletion galette/lib/Galette/Common/XHProf.php
Expand Up @@ -30,7 +30,7 @@
*
* Install the pecl/xhprof extension
*
* Add XHPROF_PATH and XHPROF_URL in config/config_path.php (if needed)
* Add XHPROF_PATH and XHPROF_URL in config/local_paths.inc.php (if needed)
*
* Before the code
* $prof = new XHProf("something useful");
Expand Down
10 changes: 6 additions & 4 deletions galette/lib/Galette/IO/CsvOut.php
Expand Up @@ -38,7 +38,6 @@ class CsvOut extends Csv
{
public const DEFAULT_DIRECTORY = GALETTE_EXPORTS_PATH;

private string $parameted_path;
private string $legacy_parameted_file = 'exports.xml';
private string $parameted_file = 'exports.yaml';

Expand All @@ -48,9 +47,12 @@ class CsvOut extends Csv
public function __construct()
{
parent::__construct(self::DEFAULT_DIRECTORY);
$this->parameted_path = GALETTE_CONFIG_PATH;
$this->parameted_file = $this->parameted_path . $this->parameted_file;
$this->legacy_parameted_file = $this->parameted_path . $this->legacy_parameted_file;
if (file_exists(GALETTE_CONFIG_PATH . $this->parameted_file)) {
$this->parameted_file = GALETTE_CONFIG_PATH . $this->parameted_file;
} else {
$this->parameted_file = GALETTE_SYSCONFIG_PATH . $this->parameted_file;
}
$this->legacy_parameted_file = GALETTE_CONFIG_PATH . $this->legacy_parameted_file;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion galette/lib/Galette/IO/Pdf.php
Expand Up @@ -31,7 +31,7 @@
/*
* TCPDF configuration file for Galette
*/
require_once GALETTE_CONFIG_PATH . 'galette_tcpdf_config.php';
require_once GALETTE_SYSCONFIG_PATH . 'galette_tcpdf_config.php';

/**
* PDF class for galette
Expand Down
4 changes: 2 additions & 2 deletions galette/webroot/compat_test.php
Expand Up @@ -20,8 +20,8 @@
*/

define('GALETTE_ROOT', __DIR__ . '/../');
require_once GALETTE_ROOT . 'config/versions.inc.php';
require_once GALETTE_ROOT . 'config/paths.inc.php';
require_once GALETTE_ROOT . 'includes/sys_config/versions.inc.php';
require_once GALETTE_ROOT . 'includes/sys_config/paths.inc.php';

$phpok = !version_compare(PHP_VERSION, GALETTE_PHP_MIN, '<');
$php_message = PHP_VERSION;
Expand Down
2 changes: 1 addition & 1 deletion galette/webroot/index.php
Expand Up @@ -27,7 +27,7 @@
define('GALETTE_ROOT', __DIR__ . '/../');

// check PHP version
require_once GALETTE_ROOT . 'config/versions.inc.php';
require_once GALETTE_ROOT . 'includes/sys_config/versions.inc.php';
if (version_compare(PHP_VERSION, GALETTE_PHP_MIN, '<')) {
header('location: ' . GALETTE_BASE_PATH . 'compat_test.php');
die(1);
Expand Down
2 changes: 1 addition & 1 deletion galette/webroot/installer.php
Expand Up @@ -35,7 +35,7 @@

// check PHP modules
require_once GALETTE_ROOT . '/vendor/autoload.php';
require_once GALETTE_ROOT . 'config/versions.inc.php';
require_once GALETTE_ROOT . 'includes/sys_config/versions.inc.php';

if (version_compare(PHP_VERSION, GALETTE_PHP_MIN, '<') || !extension_loaded('intl')) {
header('location: compat_test.php');
Expand Down
6 changes: 3 additions & 3 deletions phpstan.neon
Expand Up @@ -5,10 +5,10 @@ parameters:
paths:
- galette/lib/
scanFiles:
- galette/config/paths.inc.php
- galette/config/versions.inc.php
- galette/includes/sys_config/paths.inc.php
- galette/includes/sys_config/versions.inc.php
- galette/config/config.inc.php.dist
- galette/config/galette_tcpdf_config.php
- galette/includes/sys_config/galette_tcpdf_config.php
scanDirectories:
- galette/includes/
dynamicConstantNames:
Expand Down

0 comments on commit 850588d

Please sign in to comment.