mirror of
https://github.com/processwire/processwire.git
synced 2025-08-19 13:01:26 +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->message(
|
||||||
$this->_('Settings have not yet been committed.') . "<br /><small>" .
|
$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>",
|
$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;
|
$hasDate = $fileSchema & self::fileSchemaDate;
|
||||||
$hasTags = $fileSchema & self::fileSchemaTags;
|
$hasTags = $fileSchema & self::fileSchemaTags;
|
||||||
$useTags = $field->get('useTags') || $contextField->get('useTags');
|
$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
|
// Filesize update (3.0.154): Adds 'filesize', 'created_users_id', 'modified_users_id' columns
|
||||||
if(!$hasFilesize) {
|
if(!$hasFilesize) {
|
||||||
@@ -1137,7 +1144,7 @@ class FieldtypeFile extends FieldtypeMulti implements ConfigurableModule {
|
|||||||
if($database->columnExists($table, $column)) {
|
if($database->columnExists($table, $column)) {
|
||||||
$result = true;
|
$result = true;
|
||||||
} else {
|
} 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]);
|
unset($schema[$column], $schema['keys'][$column]);
|
||||||
$result = false;
|
$result = false;
|
||||||
}
|
}
|
||||||
|
@@ -98,10 +98,14 @@ class FieldtypeImage extends FieldtypeFile {
|
|||||||
|
|
||||||
if(!$hasDimensions) {
|
if(!$hasDimensions) {
|
||||||
$numErrors = 0;
|
$numErrors = 0;
|
||||||
$columns = array('width', 'height', 'ratio');
|
if($this->wire('database')->tableExists($field->getTable())) {
|
||||||
foreach($columns as $column) {
|
$columns = array('width', 'height', 'ratio');
|
||||||
if(!$this->addColumn($field, $column, $schema)) $numErrors++;
|
foreach($columns as $column) {
|
||||||
if($numErrors) break;
|
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) {
|
if(!$numErrors) {
|
||||||
$fileSchema = $fileSchema | self::fileSchemaDimensions;
|
$fileSchema = $fileSchema | self::fileSchemaDimensions;
|
||||||
|
Reference in New Issue
Block a user