/** * rcube:utils::is_absolute_path() */ function test_is_absolute_path() { if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { $test = array('' => false, "C:\\" => true, 'some/path' => false); } else { $test = array('' => false, '/path' => true, 'some/path' => false); } foreach ($test as $input => $output) { $result = rcube_utils::is_absolute_path($input); $this->assertSame($output, $result); } }
/** * Helper method to resolve absolute paths to the given config file. * This also takes the 'env' property into account. * * @param string $file Filename or absolute file path * @param boolean $use_env Return -$env file path if exists * * @return array List of candidates in config dir path(s) */ public function resolve_paths($file, $use_env = true) { $files = array(); $abs_path = rcube_utils::is_absolute_path($file); foreach ($this->paths as $basepath) { $realpath = $abs_path ? $file : realpath($basepath . '/' . $file); // check if <file>-env.ini exists if ($realpath && $use_env && !empty($this->env)) { $envfile = preg_replace('/\\.(inc.php)$/', '-' . $this->env . '.\\1', $realpath); if (is_file($envfile)) { $realpath = $envfile; } } if ($realpath) { $files[] = $realpath; // no need to continue the loop if an absolute file path is given if ($abs_path) { break; } } } return $files; }
echo html::tag('li', null, html::span('propname', $msg['prop']) . ': ' . $msg['explain']); } echo '</ul>'; } } ?> <h3>Check if directories are writable</h3> <p>Roundcube may need to write/save files into these directories</p> <?php $dirs[] = $RCI->config['temp_dir'] ? $RCI->config['temp_dir'] : 'temp'; if ($RCI->config['log_driver'] != 'syslog') { $dirs[] = $RCI->config['log_dir'] ? $RCI->config['log_dir'] : 'logs'; } foreach ($dirs as $dir) { $dirpath = rcube_utils::is_absolute_path($dir) ? $dir : INSTALL_PATH . $dir; if (is_writable(realpath($dirpath))) { $RCI->pass($dir); $pass = true; } else { $RCI->fail($dir, 'not writeable for the webserver'); } echo '<br />'; } if (!$pass) { echo '<p class="hint">Use <tt>chmod</tt> or <tt>chown</tt> to grant write privileges to the webserver</p>'; } ?> <h3>Check DB config</h3> <?php