Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/configdir #500

Merged
merged 2 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .composer-require-checker.config.json
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Copyright © 2003-2024 The Galette Team
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/**
* Copyright © 2003-2024 The Galette Team
*
Expand All @@ -20,7 +21,7 @@

/**
* Various paths
* Path to external librarires, logs files, exports directory, ...
* Path to external libraries, logs files, exports directory, ...
*
* @author Johan Cwiklinski <johan@x-tnd.be>
*/
Expand All @@ -29,48 +30,23 @@
include GALETTE_ROOT . 'config/local_paths.inc.php';
}

//external libraries
if (!defined('GALETTE_ZEND_PATH')) {
define('GALETTE_ZEND_PATH', GALETTE_ROOT . 'vendor/zendframework');
}
if (!defined('GALETTE_ANALOG_PATH')) {
define(
'GALETTE_ANALOG_PATH',
GALETTE_ROOT . 'vendor/analog/analog'
);
}
if (!defined('GALETTE_PHP_MAILER_PATH')) {
define(
'GALETTE_PHP_MAILER_PATH',
GALETTE_ROOT . 'vendor/phpmailer/phpmailer'
);
}
if (!defined('GALETTE_SMARTY_PATH')) {
define(
'GALETTE_SMARTY_PATH',
GALETTE_ROOT . 'vendor/smarty/smarty/'
);
}
//3rd party libs paths
if (!defined('GALETTE_TCPDF_PATH')) {
define(
'GALETTE_TCPDF_PATH',
GALETTE_ROOT . '/vendor/tecnickcom/tcpdf'
);
}
/*if ( !defined('GALETTE_SLIM_PATH') ) {
define('GALETTE_SLIM_PATH', GALETTE_ROOT . 'lib/Slim-' . SLIM_VERSION);
}
if ( !defined('GALETTE_SLIM_VIEWS_PATH') ) {
define('GALETTE_SLIM_VIEWS_PATH', GALETTE_ROOT . 'lib/Slim-Views');
}*/
if (!defined('GALETTE_XHPROF_PATH')) {
define('GALETTE_XHPROF_PATH', '/usr/share/xhprof/');
}

//galete's paths
//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 All @@ -83,9 +59,6 @@
if (!defined('GALETTE_LOGS_PATH')) {
define('GALETTE_LOGS_PATH', GALETTE_DATA_PATH . 'logs/');
}
if (!defined('GALETTE_COMPILE_DIR')) {
define('GALETTE_COMPILE_DIR', GALETTE_DATA_PATH . 'templates_c/');
}
if (!defined('GALETTE_CACHE_DIR')) {
define('GALETTE_CACHE_DIR', GALETTE_DATA_PATH . 'cache/' . GALETTE_VERSION . '/');
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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');
1 change: 0 additions & 1 deletion galette/install/steps/check.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
// check file permissions
$perms_ok = true;
$files_need_rw = array(
_T("Compilation") => GALETTE_COMPILE_DIR,
_T("Photos") => GALETTE_PHOTOS_PATH,
_T("Cache") => str_replace(GALETTE_VERSION, '', GALETTE_CACHE_DIR),
_T("Temporary images") => GALETTE_TEMPIMAGES_PATH,
Expand Down
2 changes: 1 addition & 1 deletion galette/lib/Galette/Common/XHProf.php
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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