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

CRM: 3406 - address SQLite table creation error #34872

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
4 changes: 0 additions & 4 deletions projects/plugins/crm/admin/system/system-status.page.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,6 @@ function zeroBSCRM_render_systemstatus_page() {

global $ZBSCRM_t,$wpdb;
$missingTables = array();
$tablesExist = $wpdb->get_results( "SHOW TABLES LIKE '" . $ZBSCRM_t['keys'] . "'" );
if ( count( $tablesExist ) < 1 ) {
$missingTables[] = $ZBSCRM_t['keys'];
}

// then we cycle through our tables :) - means all keys NEED to be kept up to date :)
foreach ( $ZBSCRM_t as $tableKey => $tableName ) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed


19 changes: 4 additions & 15 deletions projects/plugins/crm/includes/ZeroBSCRM.Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
$ZBSCRM_t['tags'] = $wpdb->prefix . "zbs_tags";
$ZBSCRM_t['taglinks'] = $wpdb->prefix . "zbs_tags_links";
$ZBSCRM_t['settings'] = $wpdb->prefix . "zbs_settings";
$ZBSCRM_t['keys'] = $wpdb->prefix . "zbscrm_api_keys";
$ZBSCRM_t['segments'] = $wpdb->prefix . "zbs_segments";
$ZBSCRM_t['segmentsconditions'] = $wpdb->prefix . "zbs_segments_conditions";
$ZBSCRM_t['adminlog'] = $wpdb->prefix . "zbs_admlog";
Expand Down Expand Up @@ -94,15 +93,6 @@ function zeroBSCRM_createTables(){
// we log the last error before we start, in case another plugin has left an error in the buffer
$zbsDB_lastError = ''; if (isset($wpdb->last_error)) $zbsDB_lastError = $wpdb->last_error;
$zbsDB_creationErrors = array();

#} Keys zbs_perm = {0 = revoked, 1 = read_only, 2 = read_and_write
$sql = "CREATE TABLE IF NOT EXISTS ". $ZBSCRM_t['keys'] ."(
`zbs_id` INT NOT NULL AUTO_INCREMENT ,
`zbs_key` VARCHAR(200) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci' NULL ,
`zbs_perm` INT(1) NULL ,
PRIMARY KEY (`zbs_id`))
".$storageEngineLine.";";
zeroBSCRM_db_runDelta($sql);

// Contacts
$sql = "CREATE TABLE IF NOT EXISTS ". $ZBSCRM_t['contacts'] ."(
Expand Down Expand Up @@ -938,11 +928,6 @@ function zeroBSCRM_checkTablesExist(){
global $ZBSCRM_t, $wpdb;

$create = false;
$tablesExist = $wpdb->get_results("SHOW TABLES LIKE '".$ZBSCRM_t['keys']."'");

if ( count($tablesExist) < 1 ) {
$create = true;
}

// then we cycle through our tables :) - means all keys NEED to be kept up to date :)
// No need to add to this ever now :)
Expand Down Expand Up @@ -1002,6 +987,10 @@ function zeroBSCRM_db_runDelta($sql=''){
*/
function zeroBSCRM_DB_canInnoDB(){

if ( jpcrm_database_engine() === 'sqlite' ) {
return false;
}

global $wpdb;

// attempt to cycle through MySQL's ENGINES & discern InnoDB
Expand Down