This repository was archived by the owner on Nov 20, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathupd.addon.php
More file actions
80 lines (65 loc) · 1.96 KB
/
upd.addon.php
File metadata and controls
80 lines (65 loc) · 1.96 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
79
80
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
require_once PATH_THIRD.'addon/config.php';
/**
* Addon Module Update
*/
class Addon_upd
{
var $version = ADDON_VER;
function __construct()
{
$this->EE =& get_instance();
}
/**
* Installs the module, creating the necessary tables
*/
public function install()
{
// Insert module information into Modules table
$data = array(
"module_name" => ADDON_NAME_MACHINE,
"module_version" => $this->version,
"has_cp_backend" => "y",
"has_publish_fields" => "n"
);
$this->EE->db->insert('modules', $data);
// Create new database tables
$this->EE->load->dbforge();
// Settings Table
$settings_table = array(
"id" => array("type" => "int", "constraint" => "10", "unsigned" => TRUE, "auto_increment" => TRUE),
"name" => array("type" => "varchar", "constraint" => "250"),
"value" => array("type" => "text")
);
$this->EE->dbforge->add_field($settings_table);
$this->EE->dbforge->add_key('id', TRUE);
$this->EE->dbforge->create_table(ADDON_DB_SETTINGS);
return TRUE;
}
/**
* Uninstalls the module, removing the database tables
*/
public function uninstall()
{
$module_id = $this->EE->db->select('module_id')->get_where('modules', array('module_name' => ADDON_NAME))->row('module_id');
$this->EE->db->where('module_id', $module_id);
$this->EE->db->delete('module_member_groups');
$this->EE->db->where('module_name', ADDON_NAME);
$this->EE->db->delete('modules');
$this->EE->db->where('class', ADDON_NAME);
$this->EE->db->delete('actions');
$this->EE->load->dbforge();
$this->EE->dbforge->drop_table(ADDON_DB_SETTINGS);
return TRUE;
}
/**
* Update the module's database tables if necessary
* @param String $current The installed module's current version
*/
public function update($current = '')
{
return FALSE;
}
}
// End File upd.addon.php
// File Source /system/expressionengine/third_party/addon/upd.addon.php