source: branches/feature-module-update/data/conf/conf.php @ 16143

Revision 16143, 2.8 KB checked in by nanasess, 16 years ago (diff)

Smarty コンパイルディレクトリを自動生成するように修正

  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-httpd-php; charset=UTF-8
Line 
1<?php
2/**
3 *
4 * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
5 *
6 * http://www.lockon.co.jp/
7 *
8 */
9
10$CONF_PHP_PATH = realpath( dirname( __FILE__) );
11//require_once($CONF_PHP_PATH ."/../install.php");
12require_once($CONF_PHP_PATH ."/../install_pgsql.php");
13require_once($CONF_PHP_PATH ."/core.php" );
14
15/**
16 * エラーレベル設定
17 *
18 * ・推奨値
19 *   開発時 - E_ALL
20 *   運用時 - E_ALL & ~E_NOTICE
21 */
22//error_reporting(E_ALL & ~E_NOTICE);
23error_reporting(E_ALL);
24
25// 定数を設定する
26defineConstants();
27
28// Smarty コンパイルディレクトリを生成する.
29createCacheDir();
30
31/**
32 * マルチバイト文字列設定
33 *
34 * TODO SJIS-win や, eucJP-win への対応
35 */
36ini_set("mbstring.http_input", CHAR_CODE);
37ini_set("mbstring.http_output", CHAR_CODE);
38ini_set("auto_detect_line_endings", 1);
39ini_set("default_charset", CHAR_CODE);
40ini_set("mbstring.internal_encoding", CHAR_CODE);
41ini_set("mbstring.detect_order", "auto");
42ini_set("mbstring.substitute_character", "none");
43
44/** EC-CUBEのバージョン */
45define('ECCUBE_VERSION', "1.5");
46
47/**
48 * 定数を設定する.
49 *
50 * 注意: この関数を外部で使用することは推奨しません.
51 *
52 * mtb_constants.php を読み込んで定数を設定する.
53 * キャッシュディレクトリに存在しない場合は, 初期データからコピーする.
54 *
55 * @access private
56 * @return void
57 */
58function defineConstants() {
59    $CONF_PHP_PATH = realpath( dirname( __FILE__) );
60
61    $errorMessage = "data/conf/cache/mtb_constants.php が生成できません";
62    // 定数を設定
63    if (is_file($CONF_PHP_PATH . "/cache/mtb_constants.php")) {
64        require_once($CONF_PHP_PATH . "/cache/mtb_constants.php");
65
66    // キャッシュが無ければ, 初期データからコピー
67    } elseif (is_file($CONF_PHP_PATH
68                      . "/mtb_constants_init.php")) {
69
70        $mtb_constants = file_get_contents($CONF_PHP_PATH . "/mtb_constants_init.php");
71        $handle = fopen($CONF_PHP_PATH . "/cache/mtb_constants.php", "w");
72        if (!$handle) {
73            die($errorMessage);
74        }
75        if (fwrite($handle, $mtb_constants) === false) {
76            die($errorMessage);
77        }
78        fclose($handle);
79
80        require_once($CONF_PHP_PATH . "/cache/mtb_constants.php");
81    } else {
82        die("html/install/mtb_constants.php が存在しません.");
83    }
84}
85
86/**
87 * 各種キャッシュディレクトリを生成する.
88 *
89 * 注意: この関数を外部で使用することは推奨しません.
90 *
91 * Smarty キャッシュディレクトリを生成する.
92 *
93 * @access private
94 * @return void
95 */
96function createCacheDir() {
97
98    if (!file_exists(COMPILE_DIR)) {
99        mkdir(COMPILE_DIR);
100    }
101
102    if (!file_exists(COMPILE_ADMIN_DIR)) {
103        mkdir(COMPILE_ADMIN_DIR);
104    }
105
106    if (!file_exists(COMPILE_FTP_DIR)) {
107        mkdir(COMPILE_FTP_DIR);
108    }
109}
110?>
Note: See TracBrowser for help on using the repository browser.