forked from topspin/topspin-wordpress
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtopspin_activation.php
More file actions
63 lines (58 loc) · 1.82 KB
/
topspin_activation.php
File metadata and controls
63 lines (58 loc) · 1.82 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
<?php
/*
* Last Modified: August 1, 2011
*
* ----------------------------------
* Change Log
* ----------------------------------
* 2011-08-01
- updated topspin_activate()
added new file to run: topspin_stores_featured_items.sql
* 2011-04-06
- updated topspin_activate()
added new file to run: topspin_artists.sql
* 2011-04-05
- updated topspin_activate()
added new file to run: topspin_items_images.sql
*
*/
### Hooks
register_activation_hook(TOPSPIN_PLUGIN_FILE,'topspin_activate');
register_deactivation_hook(TOPSPIN_PLUGIN_FILE, 'topspin_deactivate');
### Functions
function topspin_run_sql_file($filename) {
$file = TOPSPIN_PLUGIN_PATH.'/sql/'.$filename;
if(file_exists($file)) {
global $wpdb;
ob_start();
include($file);
$sql = ob_get_contents();
ob_end_clean();
$wpdb->query($sql);
}
}
function topspin_activate() {
## Create Tables
topspin_run_sql_file('topspin_currency.sql');
topspin_run_sql_file('topspin_currency_insert.sql');
topspin_run_sql_file('topspin_items.sql');
topspin_run_sql_file('topspin_items_tags.sql');
topspin_run_sql_file('topspin_items_images.sql');
topspin_run_sql_file('topspin_offer_types.sql');
topspin_run_sql_file('topspin_offer_types_insert.sql');
topspin_run_sql_file('topspin_orders.sql');
topspin_run_sql_file('topspin_orders_items.sql');
topspin_run_sql_file('topspin_settings.sql');
topspin_run_sql_file('topspin_stores.sql');
topspin_run_sql_file('topspin_stores_featured_items.sql');
topspin_run_sql_file('topspin_stores_offer_type.sql');
topspin_run_sql_file('topspin_stores_tag.sql');
topspin_run_sql_file('topspin_artists.sql');
topspin_run_sql_file('topspin_tags.sql');
## Activate Cron
wp_schedule_event(time(),'every_5_min','topspin_cron_fetch_items');
}
function topspin_deactivate() {
wp_clear_scheduled_hook('topspin_cron_fetch_items');
}
?>