3 * Bacula® - The Network Backup Solution
4 * Baculum - Bacula web interface
6 * Copyright (C) 2013-2015 Marcin Haba
8 * The main author of Baculum is Marcin Haba.
9 * The main author of Bacula is Kern Sibbald, with contributions from many
10 * others, a complete list can be found in the file AUTHORS.
12 * You may use this file and others of this release according to the
13 * license defined in the LICENSE file, which includes the Affero General
14 * Public License, v3.0 ("AGPLv3") and some additional permissions and
15 * terms pursuant to its AGPLv3 Section 7.
17 * Bacula® is a registered trademark of Kern Sibbald.
21 const ASSETS_DIR = 'assets';
22 const DATA_DIR = 'protected/Data';
23 const RUNTIME_DIR = 'protected/runtime';
25 public function __construct($baseDir) {
26 $this->validateEnvironment($baseDir);
29 private function validateEnvironment($baseDir) {
30 $requirements = array();
31 if(!is_writable(self::ASSETS_DIR)) {
32 $requirements[] = 'Please make writable by the web server next directory: <b>' . $baseDir . '/' . self::ASSETS_DIR . '</b>';
35 if(!is_writable(self::DATA_DIR)) {
36 $requirements[] = 'Please make writable by the web server next directory: <b>' . $baseDir . '/' . self::DATA_DIR . '</b>';
39 if(!is_writable(self::RUNTIME_DIR)) {
40 $requirements[] = 'Please make writable by the web server next directory: <b>' . $baseDir . '/' . self::RUNTIME_DIR . '</b>';
43 if(!function_exists('curl_init') || !function_exists('curl_setopt') || !function_exists('curl_exec') || !function_exists('curl_close')) {
44 $requirements[] = 'Please install <b>cURL PHP module</b>.';
47 if(!function_exists('bcmul') || !function_exists('bcpow')) {
48 $requirements[] = 'Please install <b>BCMath PHP module</b>.';
51 if(!extension_loaded('pdo_pgsql') && !extension_loaded('pdo_mysql')) {
52 $requirements[] = 'Please install <b>PDO (PHP Data Objects) PHP module for PostgreSQL or MySQL</b> depending on what database type you are using with Bacula.';
55 if(!function_exists('mb_strlen')) {
56 $requirements[] = 'Please install <b>MB String PHP module</b> for support for multi-byte string handling to PHP.';
59 if(!function_exists('json_decode')) {
60 $requirements[] = 'Please install <b>Module for JSON functions in PHP scripts</b>.';
63 if(count($requirements) > 0) {
64 echo '<html><body><h2>Baculum - Missing dependencies</h2><ul>';
65 for($i = 0; $i < count($requirements); $i++) {
66 echo '<li>' . $requirements[$i] . '</li>';
70 echo 'For run Baculum <u>please correct above requirements</u> and refresh this page in web browser.';
71 echo '</body></html>';