X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FLogging%2FSchema.php;h=d9a633c77d7dfbfe9852be07f19e88baf95e1394;hb=1e134c589990013a8c8da28b7163d927e02d3c00;hp=ad09e3a32c20431bbc7266fee8c543f441424377;hpb=c3ea4bd79fd546aa98f709a53353adb3a5a64322;p=civicrm-core.git diff --git a/CRM/Logging/Schema.php b/CRM/Logging/Schema.php index ad09e3a32c..d9a633c77d 100644 --- a/CRM/Logging/Schema.php +++ b/CRM/Logging/Schema.php @@ -429,16 +429,18 @@ AND (TABLE_NAME LIKE 'log_civicrm_%' $nonStandardTableNameString ) * name of the relevant table. * @param array $cols * Mixed array of columns to add or null (to check for the missing columns). - * - * @return bool */ - public function fixSchemaDifferencesFor($table, $cols = []) { - if (empty($table)) { - return FALSE; + public function fixSchemaDifferencesFor(string $table, array $cols = []): void { + if (!in_array($table, $this->tables, TRUE)) { + // Create the table if the log table does not exist and + // the table is in 'this->tables'. This latter array + // could have been altered by a hook if the site does not + // want to log a specific table. + return; } if (empty($this->logs[$table])) { $this->createLogTableFor($table); - return TRUE; + return; } if (empty($cols)) { @@ -480,8 +482,6 @@ AND (TABLE_NAME LIKE 'log_civicrm_%' $nonStandardTableNameString ) } $this->resetSchemaCacheForTable("log_$table"); - - return TRUE; } /** @@ -512,7 +512,7 @@ AND (TABLE_NAME LIKE 'log_civicrm_%' $nonStandardTableNameString ) * Get column query. * * @param string $col - * @param bool $createQuery + * @param array $createQuery * * @return array|mixed|string */