private static function create($Network_Folder_)
 {
     Logger::debug('main', 'Starting Abstract_Network_Folder::create for \'' . $Network_Folder_->id . '\'');
     if (Abstract_Network_Folder::exists($Network_Folder_->id)) {
         Logger::error('main', 'Abstract_Network_Folder::create(\'' . $Network_Folder_->id . '\') Network_Folder already exists');
         return false;
     }
     $SQL = SQL::getInstance();
     $SQL->DoQuery('INSERT INTO #1 (@2) VALUES (%3)', self::$table, 'id', $Network_Folder_->id);
     return true;
 }
예제 #2
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;
}
예제 #3
0
 public function remove($sharedfolder_id_)
 {
     Logger::debug('main', "SharedFolderDB::internal::remove({$sharedfolder_id_})");
     $sharedfolder = $this->import($sharedfolder_id_);
     if (is_object($sharedfolder) == false) {
         Logger::error('main', "SharedFolderDB::internal::remove({$sharedfolder_id_}) failed, unable to import sharedfolder");
         return false;
     }
     if (self::invalidate($sharedfolder_id_) == false) {
         return false;
     }
     if (Abstract_Network_Folder::delete($sharedfolder_id_) == false) {
         return false;
     }
     return true;
 }
예제 #4
0
 foreach ($ret['shares'] as $share) {
     if (is_object($sharedfolderdb) && $sharedfolderdb->exists($share['id'])) {
         $buf = $sharedfolderdb->import($share['id']);
         $db = $sharedfolderdb;
     } else {
         if (is_object($profiledb) && $profiledb->exists($share['id'])) {
             $buf = $profiledb->import($share['id']);
             $db = $profiledb;
         } else {
             $buf = false;
         }
     }
     if (!$buf) {
         if (!Abstract_Network_Folder::exists($share['id'])) {
             Logger::warning('main', "Share " . $share['id'] . ' do not exist on SM. It will be add in the orphan network folder list');
             Abstract_Network_Folder::save(new NetworkFolder($share['id'], $server->id, NetworkFolder::NF_STATUS_NOT_EXISTS));
         }
         continue;
     }
 }
 if (array_key_exists('shares', $ret) && is_array($ret['shares'])) {
     $SMFolders = array();
     if (is_object($profiledb)) {
         $profiles = $profiledb->importFromServer($ret['server']);
         if (is_array($profiles)) {
             $SMFolders = array_merge($SMFolders, $profiles);
         }
     }
     if (is_object($sharedfolderdb)) {
         $shares = $sharedfolderdb->importFromServer($ret['server']);
         if (is_array($shares)) {
예제 #5
0
 public static function update($profile_)
 {
     Logger::debug('main', 'ProfileDB::internal::update for \'' . $profile_->id . '\'');
     return Abstract_Network_Folder::save($profile_);
 }
예제 #6
0
파일: api.php 프로젝트: bloveing/openulteo
 public function network_folder_remove($id_)
 {
     $this->check_authorized('manageServers');
     $network_folder = Abstract_Network_Folder::load($id_);
     if (!is_object($network_folder)) {
         Logger::error('api', sprintf("Network folder '%s' do not exists", $id_));
         return false;
     }
     $server = Abstract_Server::load($network_folder->server);
     if ($server && $server->isOnline()) {
         $server->deleteNetworkFolder($network_folder->id, true);
     }
     Abstract_Network_Folder::delete($network_folder->id);
     $this->log_action('network_folder_remove', array('id' => $id_));
     return true;
 }