forked from netcommons/NetCommons2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUpdate.class.php
More file actions
56 lines (53 loc) · 1.69 KB
/
Update.class.php
File metadata and controls
56 lines (53 loc) · 1.69 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
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
* アップデートクラス
*
* @package NetCommons
* @author Noriko Arai,Ryuji Masukawa
* @copyright 2006-2007 NetCommons Project
* @license http://www.netcommons.org/license.txt NetCommons License
* @project NetCommons Project, supported by National Institute of Informatics
* @access public
*/
class Holiday_Update extends Action
{
//使用コンポーネントを受け取るため
var $db = null;
/**
* execute実行
*
* @access public
*/
function execute()
{
$adodb = $this->db->getAdoDbObject();
$metaTables = $adodb->MetaTables();
// calendar_blockにindexを追加
$sql = "SHOW INDEX FROM `".$this->db->getPrefix()."holiday` ;";
$results = $this->db->execute($sql);
if($results === false) return false;
$alter_table_lang_dirname_flag = true;
$alter_table_rrule_id_flag = true;
foreach($results as $result) {
if(isset($result['Key_name']) && $result['Key_name'] == "lang_dirname") {
$alter_table_lang_dirname_flag = false;
}
if(isset($result['Key_name']) && $result['Key_name'] == "rrule_id") {
$alter_table_rrule_id_flag = false;
}
}
if($alter_table_lang_dirname_flag) {
$sql = "ALTER TABLE `".$this->db->getPrefix()."holiday` ADD INDEX ( `lang_dirname` , `holiday` );";
$result = $this->db->execute($sql);
if($result === false) return false;
}
if($alter_table_rrule_id_flag) {
$sql = "ALTER TABLE `".$this->db->getPrefix()."holiday` ADD INDEX ( `rrule_id` );";
$result = $this->db->execute($sql);
if($result === false) return false;
}
return true;
}
}
?>