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:
@@ -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;
|
||||
}
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user