-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.php
More file actions
64 lines (47 loc) · 1.98 KB
/
install.php
File metadata and controls
64 lines (47 loc) · 1.98 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
<?php
// Migration von mf_googleplaces nach googleplaces
// Benenne bestehende Tabellen mf_googleplaces_reviews in rex_googleplaces_review und
// mf_googleplaces_place_details in rex_googleplaces_place_detail um
$table = rex_sql_table::get('mf_googleplaces_reviews');
if ($table->exists()) {
rex_sql_table::get('mf_googleplaces_reviews')
->setName(rex::getTablePrefix().'googleplaces_review')
->alter();
}
$table = rex_sql_table::get('mf_googleplaces_place_details');
if ($table->exists()) {
rex_sql_table::get('mf_googleplaces_place_details')
->setName(rex::getTablePrefix().'googleplaces_place_detail')
->alter();
}
// Config-Werte übernehmen
if (rex_config::get('mf_googleplaces', 'gmaps-api-key') !== null && rex_config::get('mf_googleplaces', 'gmaps-api-key') !== '') {
rex_config::set('googleplaces', 'api_key', rex_config::get('mf_googleplaces', 'gmaps-api-key'));
}
// Einrichtung und Installation
include(__DIR__ . '/install/table.php');
include(__DIR__ . '/install/tableset.php');
// Create profile photos directory if it doesn't exist
$photo_dir = rex_path::addonData('googleplaces', 'profile_photos/');
rex_dir::create($photo_dir);
if (rex_config::get('mf_googleplaces', 'gmaps-location-id') !== null) {
rex_delete_cache();
// Get existing place or create new one
$sql = rex_sql::factory();
$sql->setTable(rex::getTablePrefix().'googleplaces_place_detail');
$sql->setValue('place_id', rex_config::get('mf_googleplaces', 'gmaps-location-id'));
$sql->insertOrUpdate();
}
rex_config::removeNamespace('mf_googleplaces');
if (rex_addon::get('cronjob')->isAvailable()) {
/**
* Fehlenden CronJob eintragen.
*/
$sql = rex_sql::factory();
$sql->setTable(rex::getTable('cronjob'));
$sql->setWhere('`type` = :class', [':class' => 'FriendsOfRedaxo\\GooglePlaces\\Cronjob']);
$sql->select();
if (0 === $sql->getRows()) {
$this->includeFile(__DIR__ . '/install/cronjob_sync.php');
}
}