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)) {
private function add($sharedfolder_) { $SQL = SQL::getInstance(); if (is_null($sharedfolder_->id)) { $sharedfolder_->id = 'sf_' . gen_unique_string(); // $SQL->InsertId(); } if (is_null($sharedfolder_->name) || $sharedfolder_->name === '') { $sharedfolder_->name = $sharedfolder_->id; } $SQL->DoQuery('INSERT INTO #1 (@2,@3) VALUES (%4,%5)', self::$table, 'id', 'name', $sharedfolder_->id, $sharedfolder_->name); Abstract_Network_Folder::save($sharedfolder_); return $sharedfolder_->id; }
public static function update($profile_) { Logger::debug('main', 'ProfileDB::internal::update for \'' . $profile_->id . '\''); return Abstract_Network_Folder::save($profile_); }