From 4cc8e56e9d98e551d9e32fd08e2c4b80e99a768b Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Fri, 31 Jul 2020 08:06:14 -0400 Subject: [PATCH] Add system update 18 for processwire/processwire-issues#1171 --- .../System/SystemUpdater/SystemUpdate18.php | 24 +++++++++++++++++++ .../System/SystemUpdater/SystemUpdater.module | 8 +++---- 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 wire/modules/System/SystemUpdater/SystemUpdate18.php diff --git a/wire/modules/System/SystemUpdater/SystemUpdate18.php b/wire/modules/System/SystemUpdater/SystemUpdate18.php new file mode 100644 index 00000000..01e2c1cc --- /dev/null +++ b/wire/modules/System/SystemUpdater/SystemUpdate18.php @@ -0,0 +1,24 @@ +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); + } +} + diff --git a/wire/modules/System/SystemUpdater/SystemUpdater.module b/wire/modules/System/SystemUpdater/SystemUpdater.module index 51e26435..2d98e241 100644 --- a/wire/modules/System/SystemUpdater/SystemUpdater.module +++ b/wire/modules/System/SystemUpdater/SystemUpdater.module @@ -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,8 +26,8 @@ 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, + ); } protected $configData = array( @@ -35,7 +35,7 @@ class SystemUpdater extends WireData implements Module, ConfigurableModule { // can represent anything about the system that's related to the individual installation. // 0 = the first version when this module was created, should remain there. 'systemVersion' => 0, - ); + ); /** * Number of updates that were applied during this request