commit | author | age
|
efc805
|
1 |
<?php |
T |
2 |
/** |
|
3 |
* Copyright (c) 2008, Till Klampaeckel |
|
4 |
* |
|
5 |
* All rights reserved. |
|
6 |
* |
|
7 |
* Redistribution and use in source and binary forms, with or without modification, |
|
8 |
* are permitted provided that the following conditions are met: |
|
9 |
* |
|
10 |
* * Redistributions of source code must retain the above copyright notice, this |
|
11 |
* list of conditions and the following disclaimer. |
|
12 |
* * Redistributions in binary form must reproduce the above copyright notice, this |
|
13 |
* list of conditions and the following disclaimer in the documentation and/or |
|
14 |
* other materials provided with the distribution. |
|
15 |
* |
|
16 |
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
17 |
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
18 |
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
19 |
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
|
20 |
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
|
21 |
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
|
22 |
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
|
23 |
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
|
24 |
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
|
25 |
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
|
26 |
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
27 |
* |
|
28 |
* PHP Version 5 |
|
29 |
* |
|
30 |
* @category Config |
|
31 |
* @package RoundCube |
|
32 |
* @author Till Klampaeckel <till@php.net> |
|
33 |
* @license http://www.opensource.org/licenses/bsd-license.php The BSD License |
|
34 |
* @version CVS: $Id$ |
|
35 |
* @link https://svn.roundcube.net/trunk |
|
36 |
* @todo Check IMAP settings. |
|
37 |
* @todo Check SMTP settings. |
|
38 |
* @todo HTML/CSS to make it pretty. |
|
39 |
*/ |
|
40 |
|
2b9b6b
|
41 |
$include_path = dirname(__FILE__) . '/program/lib/'; |
T |
42 |
$include_path .= PATH_SEPARATOR . get_include_path(); |
|
43 |
set_include_path($include_path); |
|
44 |
|
efc805
|
45 |
$writable_dirs = array('logs/', 'temp/'); |
T |
46 |
$create_files = array('config/db.inc.php', 'config/main.inc.php'); |
|
47 |
|
|
48 |
$path = dirname(__FILE__) . '/'; |
|
49 |
|
|
50 |
echo '<h3>Check if directories are writable</h3>'; |
|
51 |
echo '<p>RoundCube may need to write/save files into these directories.</p>'; |
|
52 |
|
|
53 |
foreach ($writable_dirs AS $dir) { |
|
54 |
echo "Directory $dir: "; |
|
55 |
if (!is_writable($path . $dir)) { |
|
56 |
echo 'NOT OK'; |
|
57 |
} else { |
|
58 |
echo 'OK'; |
|
59 |
} |
|
60 |
echo "<br />"; |
|
61 |
} |
|
62 |
|
|
63 |
echo '<h3>Check if you setup config files</h3>'; |
|
64 |
echo '<p>Checks if the files exist and if they are readable.</p>'; |
|
65 |
|
|
66 |
foreach ($create_files AS $file) { |
|
67 |
echo "File $file: "; |
|
68 |
if (file_exists($path . $file) && is_readable($path . $file)) { |
|
69 |
echo 'OK'; |
|
70 |
} else { |
|
71 |
echo 'NOT OK'; |
|
72 |
} |
581213
|
73 |
echo '<br />'; |
efc805
|
74 |
} |
T |
75 |
|
|
76 |
echo '<h3>Check supplied DB settings</h3>'; |
|
77 |
@include $path . 'config/db.inc.php'; |
|
78 |
|
8bbe9d
|
79 |
$db_working = false; |
efc805
|
80 |
if (isset($rcmail_config)) { |
T |
81 |
echo 'DB settings: '; |
|
82 |
include_once 'MDB2.php'; |
|
83 |
$db = MDB2::connect($rcmail_config['db_dsnw']); |
|
84 |
if (!MDB2::IsError($db)) { |
|
85 |
echo 'OK'; |
|
86 |
$db->disconnect(); |
8bbe9d
|
87 |
$db_working = true; |
efc805
|
88 |
} else { |
T |
89 |
echo 'NOT OK'; |
|
90 |
} |
581213
|
91 |
echo '<br />'; |
efc805
|
92 |
} else { |
T |
93 |
echo 'Could not open db.inc.php config file, or file is empty.<br />'; |
|
94 |
} |
581213
|
95 |
|
8bbe9d
|
96 |
echo '<h3>TimeZone</h3>'; |
T |
97 |
echo 'Status: '; |
|
98 |
if ($db_working === true) { |
|
99 |
require_once 'include/rcube_mdb2.inc'; |
|
100 |
$DB = new $dbclass($rcmail_config['db_dsnw'], '', false); |
|
101 |
$DB->db_connect('w'); |
|
102 |
|
|
103 |
$tz_db = $DB->unixtimestamp(); |
|
104 |
$tz_local = time(); |
|
105 |
if ($tz_db != $tz_local) { |
|
106 |
echo 'NOT OK'; |
|
107 |
} else { |
|
108 |
echo 'OK'; |
|
109 |
} |
|
110 |
} else { |
|
111 |
echo 'Could not test (fix DB first).'; |
|
112 |
} |
|
113 |
echo '<br />'; |
|
114 |
|
581213
|
115 |
echo '<h3>Checking .ini settings</h3>'; |
T |
116 |
|
|
117 |
$auto_start = ini_get('session.auto_start'); |
|
118 |
$file_uploads = ini_get('file_uploads'); |
|
119 |
|
8bbe9d
|
120 |
echo '<h4>session.auto_start</h4>'; |
T |
121 |
echo 'status: '; |
581213
|
122 |
if ($auto_start == 1) { |
T |
123 |
echo 'NOT OK'; |
|
124 |
} else { |
|
125 |
echo 'OK'; |
|
126 |
} |
|
127 |
echo '<br />'; |
|
128 |
|
8bbe9d
|
129 |
echo '<h4>file_uploads</h4>'; |
T |
130 |
echo 'status: '; |
581213
|
131 |
if ($file_uploads == 1) { |
T |
132 |
echo 'OK'; |
|
133 |
} else { |
|
134 |
echo 'NOT OK'; |
|
135 |
} |
8bbe9d
|
136 |
|
T |
137 |
/* |
|
138 |
* Probably not needed because we have a custom handler |
|
139 |
echo '<h4>session.save_path</h4>'; |
|
140 |
echo 'status: '; |
|
141 |
$save_path = ini_get('session.save_path'); |
|
142 |
if (empty($save_path)) { |
|
143 |
echo 'NOT OK'; |
|
144 |
} else { |
|
145 |
echo "OK: $save_path"; |
|
146 |
if (!file_exists($save_path)) { |
|
147 |
echo ', but it does not exist'; |
|
148 |
} else { |
|
149 |
if (!is_readable($save_path) || !is_writable($save_path)) { |
|
150 |
echo ', but permissions to read and/or write are missing'; |
|
151 |
} |
|
152 |
} |
|
153 |
} |
581213
|
154 |
echo '<br />'; |
8bbe9d
|
155 |
*/ |
T |
156 |
?> |