1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-18 04:22:10 +02:00

Adjustment to prevent irrelevant error messages from appearing when creating new images field

This commit is contained in:
Ryan Cramer
2020-04-15 07:06:37 -04:00
parent b957a81846
commit b79c5c0e45
2 changed files with 17 additions and 6 deletions

View File

@@ -174,7 +174,7 @@ class FieldtypeFile extends FieldtypeMulti implements ConfigurableModule {
$this->message(
$this->_('Settings have not yet been committed.') . "<br /><small>" .
$this->_('Please review the settings on this page and save once more (even if you do not change anything) to confirm you accept them.') . "</small>",
Notice::allowMarkup);
Notice::allowMarkup | Notice::noGroup);
}
}
@@ -1024,6 +1024,13 @@ class FieldtypeFile extends FieldtypeMulti implements ConfigurableModule {
$hasDate = $fileSchema & self::fileSchemaDate;
$hasTags = $fileSchema & self::fileSchemaTags;
$useTags = $field->get('useTags') || $contextField->get('useTags');
if(!$hasFilesize || !$hasFiledata || !$hasDate || !$hasTags) {
if(!$database->tableExists($table)) {
// new field being created, getting initial schema to create table
return $fileSchema;
}
}
// Filesize update (3.0.154): Adds 'filesize', 'created_users_id', 'modified_users_id' columns
if(!$hasFilesize) {
@@ -1137,7 +1144,7 @@ class FieldtypeFile extends FieldtypeMulti implements ConfigurableModule {
if($database->columnExists($table, $column)) {
$result = true;
} else {
$this->error("Error adding '$column' to '{$field->name}' schema", Notice::log);
$this->error("Error adding '$column' to '{$field->name}' schema", Notice::log | Notice::debug);
unset($schema[$column], $schema['keys'][$column]);
$result = false;
}

View File

@@ -98,10 +98,14 @@ class FieldtypeImage extends FieldtypeFile {
if(!$hasDimensions) {
$numErrors = 0;
$columns = array('width', 'height', 'ratio');
foreach($columns as $column) {
if(!$this->addColumn($field, $column, $schema)) $numErrors++;
if($numErrors) break;
if($this->wire('database')->tableExists($field->getTable())) {
$columns = array('width', 'height', 'ratio');
foreach($columns as $column) {
if(!$this->addColumn($field, $column, $schema)) $numErrors++;
if($numErrors) break;
}
} else {
// new field being created that is getting initial schema to create table
}
if(!$numErrors) {
$fileSchema = $fileSchema | self::fileSchemaDimensions;