This repository has been archived by the owner on Feb 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupd.fbphotos.php
112 lines (89 loc) · 2.77 KB
/
upd.fbphotos.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
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/** -----------------------------------------------
* Fbphotos Update
* -----------------------------------------------
* This will install, update and un-install the
* module.
*
* @package Fbphotos
* @author Greg Whitworth
*/
class FBPhotos_upd {
var $version = '1.0';
function __construct()
{
// Make a local reference to the ExpressionEngine super object
$this->EE =& get_instance();
}
// ================================================
// Installer
// ================================================
function install()
{
$data = array(
'module_name' => 'Fbphotos',
'module_version' => '1.0',
'has_cp_backend' => 'y',
'has_publish_fields' => 'n'
);
$this->EE->db->insert('modules', $data);
$this->EE->load->dbforge();
// Create Facebook Settings Table
$fields = array(
'id' => array(
'type' => 'int',
'constraint' => '10',
'unsigned' => TRUE,
'auto_increment'=> TRUE
),
'setting_name' => array(
'type' => 'varchar',
'constraint' => '200'
),
'setting_value' => array(
'type' => 'varchar',
'constraint' => '1000'
)
);
$this->EE->dbforge->add_field( $fields );
$this->EE->dbforge->add_key('id');
$this->EE->dbforge->create_table('fb_photo_settings');
// POPULATE Settings
// =============================================
$data = array(
'setting_name' => 'facebook_id',
'setting_value' => 'insert something here'
);
$this->EE->db->insert('fb_photo_settings', $data);
$albums_default = serialize( array( 'checked' => array('default'), 'unchecked' => array('default') ) );
$data = array(
'setting_name' => 'facebook_albums',
'setting_value' => $albums_default
);
$this->EE->db->insert('fb_photo_settings', $data);
return true;
}
// ================================================
// Uninstall
// ================================================
function uninstall()
{
$this->EE->db->select('module_id');
$query = $this->EE->db->get_where('modules', array('module_name' => 'Fbphotos'));
$this->EE->db->where('module_name', 'Fbphotos');
$this->EE->db->delete('modules');
$this->EE->db->where('class', 'Fbphotos');
$this->EE->db->delete('actions');
$this->EE->load->dbforge();
$this->EE->dbforge->drop_table('fb_photo_settings');
return true;
}
// ================================================
// Update
// ================================================
function update($current = '')
{
return FALSE;
}
} // END Facebook Photos Class
?>