3 * Bacula(R) - 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 original author of Bacula is Kern Sibbald, with contributions
10 * from many 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 * This notice must be preserved when any source code is
18 * conveyed and/or propagated.
20 * Bacula(R) is a registered trademark of Kern Sibbald.
24 const ASSETS_DIR = 'assets';
25 const DATA_DIR = 'protected/Data';
26 const RUNTIME_DIR = 'protected/runtime';
28 public function __construct($baseDir) {
29 $this->validateEnvironment($baseDir);
32 private function validateEnvironment($baseDir) {
33 $requirements = array();
34 if(!is_writable(self::ASSETS_DIR)) {
35 $requirements[] = 'Please make writable by the web server next directory: <b>' . $baseDir . '/' . self::ASSETS_DIR . '</b>';
38 if(!is_writable(self::DATA_DIR)) {
39 $requirements[] = 'Please make writable by the web server next directory: <b>' . $baseDir . '/' . self::DATA_DIR . '</b>';
42 if(!is_writable(self::RUNTIME_DIR)) {
43 $requirements[] = 'Please make writable by the web server next directory: <b>' . $baseDir . '/' . self::RUNTIME_DIR . '</b>';
46 if(!function_exists('curl_init') || !function_exists('curl_setopt') || !function_exists('curl_exec') || !function_exists('curl_close')) {
47 $requirements[] = 'Please install <b>cURL PHP module</b>.';
50 if(!function_exists('bcmul') || !function_exists('bcpow')) {
51 $requirements[] = 'Please install <b>BCMath PHP module</b>.';
54 if(!extension_loaded('pdo_pgsql') && !extension_loaded('pdo_mysql')) {
55 $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.';
58 if(!function_exists('mb_strlen')) {
59 $requirements[] = 'Please install <b>MB String PHP module</b> for support for multi-byte string handling to PHP.';
62 if(!function_exists('json_decode')) {
63 $requirements[] = 'Please install <b>Module for JSON functions in PHP scripts</b>.';
66 if(!class_exists('DOMDocument')) {
67 $requirements[] = 'Please install <b>PHP DOM XML</b> to support XML documents (usually included in php-xml binary package).';
70 if(count($requirements) > 0) {
71 echo '<html><body><h2>Baculum - Missing dependencies</h2><ul>';
72 for($i = 0; $i < count($requirements); $i++) {
73 echo '<li>' . $requirements[$i] . '</li>';
77 echo 'For run Baculum <u>please correct above requirements</u> and refresh this page in web browser.';
78 echo '</body></html>';