-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathupdate.php
More file actions
78 lines (61 loc) · 3.05 KB
/
Copy pathupdate.php
File metadata and controls
78 lines (61 loc) · 3.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
/** @var rex_addon $this */
spl_autoload_register(static function (string $class): void {
if (strncmp($class, 'Cke5\\', 5) !== 0) {
return;
}
$relativeClass = str_replace('\\', '/', substr($class, 5));
$classFile = __DIR__ . '/lib/Cke5/' . $relativeClass . '.php';
// Legacy-Dateipfad: Cke5\Utils\Cke5CssHandler liegt im Handler-Verzeichnis.
if (!is_file($classFile) && $class === 'Cke5\\Utils\\Cke5CssHandler') {
$classFile = __DIR__ . '/lib/Cke5/Handler/Cke5CssHandler.php';
}
if (is_file($classFile)) {
require_once $classFile;
}
});
use Cke5\Handler\Cke5DefaultDataService;
use Cke5\Handler\Cke5ExtensionHandler;
include_once (__DIR__ . '/db.php');
// Setze den Standard-Lizenzschlüssel auf "GPL", falls er noch nicht existiert
if ($this->getConfig('license_code') === null || $this->getConfig('license_code') === '') {
$this->setConfig('license_code', 'GPL');
}
$this->setConfig('restore_files', true);
try {
Cke5DefaultDataService::importBundle($this->getPath('install/default_bundle.json'), ['demo_default', 'demo_light', 'demo_full_expert']);
if ($this->getConfig('image_resize_handles_restored') !== true) {
rex_sql::factory()->setQuery(
'UPDATE ' . rex::getTable('cke5_profiles') . ' SET image_resize_handles = :image_resize_handles WHERE image_resize_handles IS NULL OR image_resize_handles = :empty_value',
[
'image_resize_handles' => '|default_resize_handles|',
'empty_value' => '',
]
);
$this->setConfig('image_resize_handles_restored', true);
}
if (!file_exists(rex_path::assets('addons/cke5_custom_data'))) {
mkdir(rex_path::assets('addons/cke5_custom_data'));
}
if (!file_exists(rex_path::assets('addons/cke5_custom_data/custom-style.css'))) {
rex_file::copy($this->getPath('custom_data/custom-styles.css'), rex_path::assets('addons/cke5_custom_data/custom-style.css'));
}
if (!file_exists(rex_path::assets('addons/cke5_custom_data/autogenerated-custom-style.css'))) {
rex_file::copy($this->getPath('custom_data/autogenerated-custom-styles.css'), rex_path::assets('addons/cke5_custom_data/autogenerated-custom-style.css'));
}
try {
rex_sql::factory()->setQuery('DROP TABLE IF EXISTS ' . rex::getTablePrefix() . 'cke5_mblock_demo');
// Legacy-Tabellen aus älteren Versionen aufräumen.
// DROP TABLE IF EXISTS ist absichtlich ohne zusätzliche Exists-Prüfung,
// um fehlerhafte Metadaten-Queries auf nicht vorhandene Tabellen zu vermeiden.
rex_sql::factory()->setQuery('DROP TABLE IF EXISTS ' . rex::getTablePrefix() . 'cke5_templates');
rex_sql::factory()->setQuery('DROP TABLE IF EXISTS ' . rex::getTablePrefix() . 'cke5_template_groups');
} catch (rex_sql_exception $e) {
rex_logger::logException($e);
}
} catch (rex_functional_exception $e) {
rex_logger::logException($e);
}
Cke5ExtensionHandler::updateOrCreateProfiles();
$addon = rex_addon::get('cke5');
$addon->setConfig('updated', true);