forked from TobiasKrais/d2u_jobs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
uninstall.php
31 lines (27 loc) · 1.39 KB
/
uninstall.php
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
<?php
$sql = rex_sql::factory();
// Delete views
$sql->setQuery('DROP VIEW IF EXISTS ' . rex::getTablePrefix() . 'd2u_jobs_url_jobs');
$sql->setQuery('DROP VIEW IF EXISTS ' . rex::getTablePrefix() . 'd2u_jobs_url_jobs_categories');
// Delete url schemes
if(\rex_addon::get('url')->isAvailable()) {
if(rex_version::compare(\rex_addon::get('url')->getVersion(), '1.5', '>=')) {
$sql->setQuery("DELETE FROM ". \rex::getTablePrefix() ."url_generator_profile WHERE `namespace` = 'job_id';");
$sql->setQuery("DELETE FROM ". \rex::getTablePrefix() ."url_generator_profile WHERE `namespace` = 'job_category_id';");
}
else {
$sql->setQuery("DELETE FROM `". rex::getTablePrefix() ."url_generate` WHERE `table` LIKE '%d2u_jobs_url_jobs%'");
}
}
// Delete language replacements
if(!class_exists('d2u_jobs_lang_helper')) {
// Load class in case addon is deactivated
require_once 'lib/d2u_jobs_lang_helper.php';
}
d2u_jobs_lang_helper::factory()->uninstall();
// Delete tables
$sql->setQuery('DROP TABLE IF EXISTS ' . rex::getTablePrefix() . 'd2u_jobs_jobs');
$sql->setQuery('DROP TABLE IF EXISTS ' . rex::getTablePrefix() . 'd2u_jobs_jobs_lang');
$sql->setQuery('DROP TABLE IF EXISTS ' . rex::getTablePrefix() . 'd2u_jobs_categories');
$sql->setQuery('DROP TABLE IF EXISTS ' . rex::getTablePrefix() . 'd2u_jobs_categories_lang');
$sql->setQuery('DROP TABLE IF EXISTS ' . rex::getTablePrefix() . 'd2u_jobs_contacts');