mirror of
https://github.com/processwire/processwire.git
synced 2025-08-17 20:11:46 +02:00
Add system update 18 for processwire/processwire-issues#1171
This commit is contained in:
24
wire/modules/System/SystemUpdater/SystemUpdate18.php
Normal file
24
wire/modules/System/SystemUpdater/SystemUpdate18.php
Normal 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);
|
||||
}
|
||||
}
|
||||
|
@@ -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,
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user