diff options
| author | lsces <lester@lsces.co.uk> | 2026-04-05 11:03:18 +0100 |
|---|---|---|
| committer | lsces <lester@lsces.co.uk> | 2026-04-05 11:03:18 +0100 |
| commit | b03910a566cf1c05b5485a8402dcbc102ca6704c (patch) | |
| tree | 99c50767ae61c4d9965653368fe5be0a01b22d5e /includes | |
| parent | 2e6172918ec330f1963f00b471896f96c288c0b0 (diff) | |
| download | liberty-b03910a566cf1c05b5485a8402dcbc102ca6704c.tar.gz liberty-b03910a566cf1c05b5485a8402dcbc102ca6704c.tar.bz2 liberty-b03910a566cf1c05b5485a8402dcbc102ca6704c.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.
Diffstat (limited to 'includes')
| -rwxr-xr-x | includes/classes/LibertyContent.php | 2 | ||||
| -rwxr-xr-x | includes/classes/LibertySystem.php | 20 |
2 files changed, 12 insertions, 10 deletions
diff --git a/includes/classes/LibertyContent.php b/includes/classes/LibertyContent.php index 58ae668..8d2c825 100755 --- a/includes/classes/LibertyContent.php +++ b/includes/classes/LibertyContent.php @@ -397,7 +397,7 @@ class LibertyContent extends LibertyBase implements BitCacheable { } // store content preferences - if( @is_array( $pParamHash['preferences_store'] ) ) { + if( !empty( $pParamHash['preferences_store'] ) ) { foreach( $pParamHash['preferences_store'] as $pref => $value ) { $this->storePreference( $pref, $value ); } diff --git a/includes/classes/LibertySystem.php b/includes/classes/LibertySystem.php index b0c6bcb..e1669ff 100755 --- a/includes/classes/LibertySystem.php +++ b/includes/classes/LibertySystem.php @@ -413,7 +413,7 @@ class LibertySystem extends BitSingleton { // create tables foreach( $reqs['schema']['tables'] as $table => $tableDict ) { $fullTable = $prefix.$table; - if( !in_array( $fullTable, $dbTables )) { + if( !\in_array( $fullTable, $dbTables ) and !$gBitSystem->mDb->tableExists( $fullTable ) ) { if( $sql = $dict->CreateTableSQL( $fullTable, $tableDict, $build )) { $ret = $dict->ExecuteSQLArray( $sql ); if( $ret === false ) { @@ -594,15 +594,17 @@ class LibertySystem extends BitSingleton { * @return void **/ public function loadContentTypes( $pCacheTime=BIT_QUERY_CACHE_TIME ) { - if( $rs = $this->mDb->query( "SELECT * FROM `".BIT_DB_PREFIX."liberty_content_types`", null, BIT_QUERY_DEFAULT, BIT_QUERY_DEFAULT ) ) { - while( $row = $rs->fetchRow() ) { - // translate name - // content_description backward compatibility for now - $row['content_description'] = $row['content_name'] = KernelTools::tra( $row['content_name'] ); - if( !empty( $row['content_name_plural'] ) ){ - $row['content_name_plural'] = KernelTools::tra( $row['content_name_plural'] ); + if ( $this->mDb->tableExists( 'liberty_content_types' ) ) { + if( $rs = $this->mDb->query( "SELECT * FROM `".BIT_DB_PREFIX."liberty_content_types`", null, BIT_QUERY_DEFAULT, BIT_QUERY_DEFAULT ) ) { + while( $row = $rs->fetchRow() ) { + // translate name + // content_description backward compatibility for now + $row['content_description'] = $row['content_name'] = KernelTools::tra( $row['content_name'] ); + if( !empty( $row['content_name_plural'] ) ){ + $row['content_name_plural'] = KernelTools::tra( $row['content_name_plural'] ); + } + $this->mContentTypes[$row['content_type_guid']] = $row; } - $this->mContentTypes[$row['content_type_guid']] = $row; } } } |
