Beispiel #1
0
/**
 * Copyright (C) 2008-2013 Ulteo SAS
 * http://www.ulteo.com
 * Author Julien LANGLOIS <*****@*****.**> 2008-2013
 * Author Laurent CLOUET <*****@*****.**> 2008-2011
 * Author Jeremy DESVAGES <*****@*****.**> 2008-2011
 * Author Vincent ROULLIER <*****@*****.**> 2013
 * Author David LECHEVALIER <*****@*****.**> 2012
 * Author David PHAM-VAN <*****@*****.**> 2013
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; version 2
 * of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 **/
function init_db($prefs_)
{
    // prefs must be valid
    Logger::debug('main', 'init_db');
    $modules_enable = $prefs_->get('general', 'module_enable');
    foreach ($modules_enable as $module_name) {
        if (!is_null($prefs_->get($module_name, 'enable'))) {
            $enable = $prefs_->get($module_name, 'enable');
            if (is_string($enable)) {
                $mod_name = $module_name . '_' . $enable;
                $ret_eval = call_user_func(array($mod_name, 'init'), $prefs_);
                if ($ret_eval !== true) {
                    Logger::error('main', 'init_db init module \'' . $mod_name . '\' failed');
                    return false;
                }
            } elseif (is_array($enable)) {
                foreach ($enable as $sub_module) {
                    $mod_name = $module_name . '_' . $sub_module;
                    $ret_eval = call_user_func(array($mod_name, 'init'), $prefs_);
                    if ($ret_eval !== true) {
                        Logger::error('main', 'init_db init module \'' . $mod_name . '\' failed');
                        return false;
                    }
                }
            }
        }
    }
    Logger::debug('main', 'init_db modules inited');
    // Init of Abstract
    Abstract_Server::init($prefs_);
    Abstract_ServersGroup::init($prefs_);
    Abstract_Session::init($prefs_);
    Abstract_Token::init($prefs_);
    Abstract_News::init($prefs_);
    Abstract_Script::init($prefs_);
    Abstract_Liaison::init($prefs_);
    if (class_exists("PremiumManager")) {
        PremiumManager::initdb($prefs_);
    }
    Abstract_Task::init($prefs_);
    Abstract_ReportServer::init($prefs_);
    Abstract_ReportSession::init($prefs_);
    Abstract_User_Preferences::init($prefs_);
    Abstract_UserGroup_Preferences::init($prefs_);
    Abstract_UserGroup_Rule::init($prefs_);
    Abstract_VDI::init($prefs_);
    Abstract_Network_Folder::init($prefs_);
    Abstract_AdminAction::init($prefs_);
    return true;
}