-
Notifications
You must be signed in to change notification settings - Fork 46
/
maintain.inc.php
109 lines (94 loc) · 3.18 KB
/
maintain.inc.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
<?php
/***********************************************
* File : maintain.inc.php
* Project : piwigo-videojs
* Descr : Install / Uninstall method
*
* Created : 24.06.2012
*
* Copyright 2012-2024 <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
************************************************/
if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
global $prefixeTable;
define('videojs_table', $prefixeTable.'image_videojs');
function plugin_install()
{
if (!defined('VIDEOJS_PATH'))
define('VIDEOJS_PATH', PHPWG_PLUGINS_PATH . basename(dirname(__FILE__)).'/');
$default_config = array(
'skin' => 'vjs-default-skin',
'max_height' => '720',
'preload' => 'auto',
'controls' => true,
'autoplay' => false,
'loop' => false,
'volume' => '1',
'upscale' => false,
'plugins' => array(
'zoomrotate' => false,
'thumbnails' => false,
'watermark' => false,
'resolution' => false,
),
'player' => 'html5-player.tpl',
'metadata' => true,
);
/* Add configuration to the config table */
$conf['vjs_conf'] = serialize($default_config);
conf_update_param('vjs_conf', $conf['vjs_conf']);
/* Add a comment to the entry */
$q = 'UPDATE '.CONFIG_TABLE.' SET `comment` = "Configuration settings for piwigo-videojs plugin" WHERE `param` = "vjs_conf";';
pwg_query( $q );
/* Keep customCSS separate as it can be big entry */
conf_update_param('vjs_customcss', '');
/* Add a comment to the entry */
$q = 'UPDATE '.CONFIG_TABLE.' SET `comment` = "Custom CSS used by the piwigo-videojs plugin" WHERE `param` = "vjs_customcss";';
pwg_query( $q );
/* Table to hold videos metadata details */
$q = 'CREATE TABLE IF NOT EXISTS `'.videojs_table.'` (
`id` mediumint(8) unsigned NOT NULL,
`metadata` text DEFAULT NULL,
`date_metadata_update` DATE DEFAULT NULL,
PRIMARY KEY (id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8
;';
pwg_query($q);
}
function plugin_uninstall()
{
global $prefixeTable;
/* Drop VideoJS configuration settings */
$q = 'DELETE FROM '.CONFIG_TABLE.' WHERE param LIKE "%vjs_%";';
pwg_query( $q );
/* Drop VideoJS metadata table */
$q = 'DROP TABLE IF EXISTS '.$prefixeTable.'image_videojs'.';';
pwg_query( $q );
// TODO : Do we need to purge the videos from the images table?
}
function plugin_activate()
{
global $conf;
if (!is_array($conf['vjs_conf']))
$conf['vjs_conf'] = unserialize($conf['vjs_conf']);
if ( (!isset($conf['vjs_conf'])) or (!isset($conf['vjs_customcss']))
or (!empty($conf['vjs_conf']))
or (count($conf['vjs_conf'], COUNT_RECURSIVE) != 12))
{
plugin_install();
}
}
?>