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 System Helper Module
|
||||||
*
|
*
|
||||||
* ProcessWire 3.x, Copyright 2019 by Ryan Cramer
|
* ProcessWire 3.x, Copyright 2020 by Ryan Cramer
|
||||||
* https://processwire.com
|
* https://processwire.com
|
||||||
*
|
*
|
||||||
* @method coreVersionChange($fromVersion, $toVersion)
|
* @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
|
* This version number is important, as this updater keeps the systemVersion up with this version
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
'version' => 17,
|
'version' => 18,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected $configData = array(
|
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.
|
// 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.
|
// 0 = the first version when this module was created, should remain there.
|
||||||
'systemVersion' => 0,
|
'systemVersion' => 0,
|
||||||
);
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Number of updates that were applied during this request
|
* Number of updates that were applied during this request
|
||||||
|
Reference in New Issue
Block a user