source: subversion/trunk/roundcubemail/check.php @ 982

Last change on this file since 982 was 982, checked in by till, 5 years ago
  • fixed #1484437
  • also added it to check.php
File size: 3.3 KB
Line 
1<?php
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
41$writable_dirs = array('logs/', 'temp/');
42$create_files  = array('config/db.inc.php', 'config/main.inc.php');
43
44$path = dirname(__FILE__) . '/';
45
46echo '<h3>Check if directories are writable</h3>';
47echo '<p>RoundCube may need to write/save files into these directories.</p>';
48
49foreach ($writable_dirs AS $dir) {
50    echo "Directory $dir: ";
51    if (!is_writable($path . $dir)) {
52        echo 'NOT OK';
53    } else {
54        echo 'OK';
55    }
56    echo "<br />";
57}
58
59echo '<h3>Check if you setup config files</h3>';
60echo '<p>Checks if the files exist and if they are readable.</p>';
61
62foreach ($create_files AS $file) {
63    echo "File $file: ";
64    if (file_exists($path . $file) && is_readable($path . $file)) {
65        echo 'OK';
66    } else {
67        echo 'NOT OK';
68    }
69    echo '<br />';
70}
71
72echo '<h3>Check supplied DB settings</h3>';
73@include $path . 'config/db.inc.php';
74
75if (isset($rcmail_config)) {
76    echo 'DB settings: ';
77    include_once 'MDB2.php';
78    $db = MDB2::connect($rcmail_config['db_dsnw']);
79    if (!MDB2::IsError($db)) {
80        echo 'OK';
81        $db->disconnect();
82    } else {
83        echo 'NOT OK';
84    }
85    echo '<br />';
86} else {
87    echo 'Could not open db.inc.php config file, or file is empty.<br />';
88}
89
90echo '<h3>Checking .ini settings</h3>';
91
92$auto_start   = ini_get('session.auto_start');
93$file_uploads = ini_get('file_uploads');
94
95echo "session.auto_start: ";
96if ($auto_start == 1) {
97    echo 'NOT OK';
98} else {
99    echo 'OK';
100}
101echo '<br />';
102
103echo "file_uploads: ";
104if ($file_uploads == 1) {
105    echo 'OK';
106} else {
107    echo 'NOT OK';
108}
109echo '<br />';
110?>
Note: See TracBrowser for help on using the repository browser.