1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-17 20:11:46 +02:00
This commit is contained in:
Ryan Cramer
2020-07-31 08:06:14 -04:00
parent 45bf8e2bca
commit 4cc8e56e9d
2 changed files with 28 additions and 4 deletions

View File

@@ -0,0 +1,24 @@
<?php namespace ProcessWire;
/**
* Loads file/image fields to ensure their schema is up-to-date and avoid an error message
*
*
*/
class SystemUpdate18 extends SystemUpdate {
public function execute() {
$this->wire()->addHookAfter('ProcessWire::ready', $this, 'executeAtReady');
return 0; // indicates we will update system version ourselves when ready
}
public function executeAtReady() {
foreach($this->wire()->fields as $field) {
if($field->type instanceof FieldtypeFile) {
try {
$field->type->getDatabaseSchema($field);
} catch(\Exception $e) { }
}
}
$this->updater->saveSystemVersion(18);
}
}

View File

@@ -5,7 +5,7 @@
*
* ProcessWire System Helper Module
*
* ProcessWire 3.x, Copyright 2019 by Ryan Cramer
* ProcessWire 3.x, Copyright 2020 by Ryan Cramer
* https://processwire.com
*
* @method coreVersionChange($fromVersion, $toVersion)
@@ -26,7 +26,7 @@ class SystemUpdater extends WireData implements Module, ConfigurableModule {
* This version number is important, as this updater keeps the systemVersion up with this version
*
*/
'version' => 17,
'version' => 18,
);
}