diff options
| author | lsces <lester@lsces.co.uk> | 2026-04-05 11:02:06 +0100 |
|---|---|---|
| committer | lsces <lester@lsces.co.uk> | 2026-04-05 11:02:06 +0100 |
| commit | 4d11e97bd15fae091be3ddd3b3b6da07b4128c0f (patch) | |
| tree | af2e397d600ba073bc4db76955dc92e17c19a7da | |
| parent | bac9e94152757395cff16c46e03e775248896965 (diff) | |
| download | kernel-4d11e97bd15fae091be3ddd3b3b6da07b4128c0f.tar.gz kernel-4d11e97bd15fae091be3ddd3b3b6da07b4128c0f.tar.bz2 kernel-4d11e97bd15fae091be3ddd3b3b6da07b4128c0f.zip | |
Solving a little chicken and egg situation when installing from scratch. Once the database is created autoload is messing things up until the tables are also created. Need a tidier way of doing this but it works for now by check tables exist before using them.
| -rwxr-xr-x | includes/classes/BitDb.php | 2 | ||||
| -rwxr-xr-x | includes/classes/BitDbPear.php | 2 | ||||
| -rwxr-xr-x | includes/classes/BitSystem.php | 10 | ||||
| -rwxr-xr-x | includes/classes/KernelTools.php | 4 | ||||
| -rw-r--r-- | templates/bot_bar.tpl | 2 |
5 files changed, 10 insertions, 10 deletions
diff --git a/includes/classes/BitDb.php b/includes/classes/BitDb.php index 0f6de78..51a1f75 100755 --- a/includes/classes/BitDb.php +++ b/includes/classes/BitDb.php @@ -162,7 +162,7 @@ class BitDb { * @return true if DB connection is valid, false if not */ public function isValid() { - return !empty( $this->mDb ); + return !empty( $this->mDb ) && count ($this->mDb->MetaTables() ); } /** * Determines if the database connection is valid diff --git a/includes/classes/BitDbPear.php b/includes/classes/BitDbPear.php index 45650e9..3d7e5a5 100755 --- a/includes/classes/BitDbPear.php +++ b/includes/classes/BitDbPear.php @@ -19,7 +19,7 @@ */ require_once 'DB.php'; -require_once( KERNEL_PKG_CLASS_PATH.'BitDbBase.php' ); +require_once( KERNEL_PKG_CLASS_PATH.'BitDb.php' ); /** * This class is used for database access and provides a number of functions to help diff --git a/includes/classes/BitSystem.php b/includes/classes/BitSystem.php index 3bc6cc6..6e1f236 100755 --- a/includes/classes/BitSystem.php +++ b/includes/classes/BitSystem.php @@ -206,7 +206,7 @@ class BitSystem extends BitSingleton { $whereClause = ' WHERE `package`=? '; } - if ( empty( $this->mConfig ) ) { + if ( empty( $this->mConfig ) && $this->mDb->tableExists('kernel_config') ) { $this->mConfig = []; $query = "SELECT `config_name` ,`config_value`, `package` FROM `" . BIT_DB_PREFIX . "kernel_config` " . $whereClause; if( $rs = $this->mDb->query( $query, $queryVars, -1, -1 ) ) { @@ -214,8 +214,9 @@ class BitSystem extends BitSingleton { $this->mConfig[$row['config_name']] = $row['config_value']; } } + return count( $this->mConfig ); } - return count( $this->mConfig ); + return 0; } // <<< getConfig @@ -1135,7 +1136,7 @@ class BitSystem extends BitSingleton { 'activatable' => false, ]; if( $pPkgDir == 'kernel' ) { - $pRegisterHash = array_merge( $pRegisterHash, [ 'required_package' => true ] ); + $pRegisterHash = [ ...$pRegisterHash, 'required_package' => true ]; } $this->registerPackage( $pRegisterHash ); } @@ -1176,7 +1177,7 @@ class BitSystem extends BitSingleton { */ public function scanPackages( $pScanFile = 'bit_setup_inc.php', $pOnce=true, $pSelect='', $pAutoRegister=true ) { global $gPreScan; - if( !empty( $gPreScan ) && is_array( $gPreScan )) { + if( !empty( $gPreScan ) && \is_array( $gPreScan )) { // gPreScan may hold a list of packages that must be loaded first foreach( $gPreScan as $pkgDir ) { $loadPkgs[] = $pkgDir; @@ -1194,7 +1195,6 @@ class BitSystem extends BitSingleton { // load the list of pkgs in the right order foreach( $loadPkgs as $loadPkg ) { -// print_r('<br>Load Plugins - ' . $loadPkg . '<br>'); $this->loadPackage( $loadPkg, $pScanFile, $pAutoRegister, $pOnce ); } diff --git a/includes/classes/KernelTools.php b/includes/classes/KernelTools.php index 84df9db..e08b474 100755 --- a/includes/classes/KernelTools.php +++ b/includes/classes/KernelTools.php @@ -5,13 +5,13 @@ * @subpackage functions */ namespace Bitweaver; +define( 'EMAIL_ADDRESS_REGEX', '[-a-zA-Z0-9._%+]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}' ); class KernelTools { public function __construct() { mb_internal_encoding( "UTF-8" ); - define( 'EMAIL_ADDRESS_REGEX', '[-a-zA-Z0-9._%+]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}' ); } @@ -229,7 +229,7 @@ class KernelTools $out .= "\n\t".str_replace( "\n", "\n\t", $pReplace ); } - if( !defined( 'IS_LIVE' ) && IS_LIVE == false ) { + if( !defined( 'IS_LIVE' ) || IS_LIVE == false ) { vd( $out, false, true ); } else { error_log( $out ); diff --git a/templates/bot_bar.tpl b/templates/bot_bar.tpl index 4866736..d0a4b31 100644 --- a/templates/bot_bar.tpl +++ b/templates/bot_bar.tpl @@ -2,7 +2,7 @@ {if $gBitSystem->isFeatureActive( 'messages_site_contact' )} <a href="{$smarty.const.MESSAGES_PKG_URL}contact.php">{booticon iname="fa-envelope" iexplain="Contact Us"}</a> {/if} - <a id="poweredby" class="external pull-right" href="http://www.bitweaver.org"><img src="/liberty/icons/bitweaver/bitweaver.gif" alt="Bitweaver" title="Bitweaver" class="icon"></a> {$version_info.local} + <a id="poweredby" class="external pull-right" href="http://www.bitweaver.org"><img src="/liberty/icons/bitweaver/bitweaver.gif" alt="Bitweaver" title="Bitweaver" class="icon"></a> {$version_info.local ?? ''} {if $gBitUser->isAdmin()} <strong>{$gBitSystem->getBitVersion()}</strong> {assign var=version_info value=$gBitSystem->checkBitVersion()} {if $version_info.compare lt 0} |
