Skip to content

Commit

Permalink
Simple setup improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
BelleNottelling committed Jan 29, 2022
1 parent 1b5bb58 commit 34d8449
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 6 deletions.
6 changes: 3 additions & 3 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@

<fileset id="api-sources" dir="src" followsymlinks="false">
<include name="bb-data/log"/>
<include name="bb-data/cache"/>
<include name="bb-data/uploads"/>
<include name="bb-data/cache/index.html"/>
<include name="bb-data/uploads/index.html"/>
<include name="bb-data/index.html"/>
<include name="bb-data/.htaccess"/>
<include name="bb-data/.htaccess.txt"/>

<exclude name="bb-data/log/*"/>
<exclude name="bb-data/cache/*"/>
Expand Down
File renamed without changes.
3 changes: 2 additions & 1 deletion src/bb-library/Box/Requirements.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public function __construct()
'zlib',
'gettext',
'openssl',
'dom',
),
'version' => PHP_VERSION,
'min_version' => '7.4',
Expand Down Expand Up @@ -120,7 +121,7 @@ public function isBoxVersionOk()
}

/**
* What extensions must be loaded for BoxBilling o function correctly
* What extensions must be loaded for BoxBilling to function correctly
*/
public function extensions()
{
Expand Down
File renamed without changes.
File renamed without changes.
39 changes: 37 additions & 2 deletions src/install/install.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ function isSSL()
define('BB_PATH_ROOT', realpath(dirname(__FILE__) . '/..'));
define('BB_PATH_LIBRARY', BB_PATH_ROOT . '/bb-library');
define('BB_PATH_VENDOR', BB_PATH_ROOT . '/bb-vendor');
define('BB_PATH_THEMES', BB_PATH_ROOT . '/install');
define('BB_PATH_INSTALL_THEMES', BB_PATH_ROOT . '/install');
define('BB_PATH_THEMES', BB_PATH_ROOT . '/bb-themes');
define('BB_PATH_LICENSE', BB_PATH_ROOT . '/LICENSE');
define('BB_PATH_SQL', BB_PATH_ROOT . '/install/sql/structure.sql');
define('BB_PATH_SQL_DATA', BB_PATH_ROOT . '/install/sql/content.sql');
Expand All @@ -39,6 +40,21 @@ function isSSL()
define('BB_PATH_CRON', BB_PATH_ROOT . '/bb-cron.php');
define('BB_PATH_LANGS', BB_PATH_ROOT . '/bb-locale');

/*
Config paths & templates
*/
define('BB_PATH_HTACCESS', BB_PATH_ROOT . '/.htaccess');
define('BB_PATH_HTACCESS_TEMPLATE', BB_PATH_ROOT . '/.htaccess.txt');

define('BB_BS_CONFIG', BB_PATH_THEMES . '/bootstrap/config/settings_data.json');
define('BB_BS_CONFIG_TEMPLATE', BB_PATH_THEMES . '/bootstrap/config/settings_data.json.txt');

define('BB_HURAGA_CONFIG', BB_PATH_THEMES . '/huraga/config/settings_data.json');
define('BB_HURAGA_CONFIG_TEMPLATE', BB_PATH_THEMES . '/huraga/config/settings_data.json.txt');

define('BB_BBTHEME_CONFIG', BB_PATH_THEMES . '/boxbilling/config/settings_data.json');
define('BB_BBTHEM_CONFIG_TEMPLATE', BB_PATH_THEMES . '/boxbilling/config/settings_data.json.txt');

// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, [
BB_PATH_LIBRARY,
Expand Down Expand Up @@ -189,7 +205,7 @@ function rmAllDir($dir) {
private function render($name, $vars = [])
{
$options = [
'paths' => [BB_PATH_THEMES],
'paths' => [BB_PATH_INSTALL_THEMES],
'debug' => true,
'charset' => 'utf-8',
'optimizations' => 1,
Expand Down Expand Up @@ -315,7 +331,26 @@ private function makeInstall($ns)
// E-mail was not sent, but that is not a problem
error_log($e->getMessage());
}


/*
Copy config templates when applicable
*/
if(!file_exists(BB_PATH_HTACCESS) && file_exists(BB_PATH_HTACCESS_TEMPLATE)) {
rename(BB_PATH_HTACCESS_TEMPLATE, BB_PATH_HTACCESS);
}

if(!file_exists(BB_BS_CONFIG) && file_exists(BB_BS_CONFIG_TEMPLATE)) {
rename(BB_BS_CONFIG_TEMPLATE, BB_BS_CONFIG);
}

if(!file_exists(BB_HURAGA_CONFIG) && file_exists(BB_HURAGA_CONFIG_TEMPLATE)) {
rename(BB_HURAGA_CONFIG_TEMPLATE, BB_HURAGA_CONFIG);
}

if(!file_exists(BB_BBTHEME_CONFIG) && file_exists(BB_BBTHEM_CONFIG_TEMPLATE)) {
rename(BB_BBTHEM_CONFIG_TEMPLATE, BB_BBTHEME_CONFIG);
}
return true;
}

Expand Down

0 comments on commit 34d8449

Please sign in to comment.