public function initialize()
 {
     $userDB_enabled = $this->prefs->get('UserDB', 'enable');
     if (!in_array($userDB_enabled, $this->getUserDB())) {
         Logger::error('main', 'SessionManagement::initialize - UserDB "' . $userDB_enabled . '" is not compatible with the current integration settings');
         return false;
     }
     $max_sessions_number = $this->prefs->get('general', 'max_sessions_number');
     if ($max_sessions_number != 0) {
         $session_number = Abstract_Session::countByStatus();
         if ($session_number >= $max_sessions_number) {
             Logger::error('main', 'SessionManagement::buildServersList - Maximum number of sessions already started ' . $session_number);
             return false;
         }
     }
     return true;
 }
Exemple #2
0
</div>
</div>
		</td>
		<td style="width: 20px;">
		</td>
		<td style="padding-right: 20px; text-align: left; vertical-align: top;">
<div class="container rounded" style="background: #eee; width: 99%; margin-left: auto; margin-right: auto;">
<div>
	<h2><?php 
echo _('Status');
?>
</h2>
<?php 
if ($show_status) {
    echo '<ul>';
    $count_active_sessions = Abstract_Session::countByStatus(Session::SESSION_STATUS_ACTIVE);
    $online_servers = Abstract_Server::load_by_status(Server::SERVER_STATUS_ONLINE);
    $count_online_servers = count($online_servers);
    $offline_servers = Abstract_Server::load_by_status(Server::SERVER_STATUS_OFFLINE);
    $count_offline_servers = count($offline_servers);
    $broken_servers = Abstract_Server::load_by_status(Server::SERVER_STATUS_BROKEN);
    $count_broken_servers = count($broken_servers);
    echo '<li>';
    echo $count_active_sessions . ' ';
    echo '<a href="sessions.php">';
    if ($count_active_sessions > 1) {
        echo _('active sessions');
    } else {
        echo _('active session');
    }
    echo '</a>';
Exemple #3
0
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 **/
require_once dirname(__FILE__) . '/../includes/core-minimal.inc.php';
if (!defined('STDIN')) {
    echo "This script cannot be used in CGI mode.\n";
    exit(1);
}
// Check if session manager is in maintenance
try {
    $prefs = new Preferences_admin();
} catch (Exception $e) {
    echo "Internal error while loading settings, unable to continue.\n";
    exit(2);
}
if ($prefs->isValid() !== true) {
    // First install
    exit(0);
}
$system_in_maintenance = $prefs->get('general', 'system_in_maintenance');
if ($system_in_maintenance != '1') {
    echo "The Session Manager is in production mode. It's not possible to perform an upgrade until it's on maintenance mode.\n";
    exit(3);
}
// Check if there still have sessions
$nb_sessions = Abstract_Session::countByStatus();
if ($nb_sessions != 0) {
    echo "There are running sessions on the OVD farm. It's not possible to perform an upgrade until there are running sessions\n";
    exit(4);
}
exit(0);
Exemple #4
0
     echo '<input type="submit" name="kill" value="' . _('Kill') . '" />';
     echo '</td>';
     echo '	</tr>';
     echo '</tfoot>';
 }
 echo '</table>';
 echo '</td><td style="vertical-align: top;">';
 echo '<table style="margin-left: auto; margin-right: 0px;" class="main_sub sortable" border="0" cellspacing="1" cellpadding="3">';
 echo '<tr class="title">';
 echo '<th>' . _('Status') . '</th>';
 echo '<th>' . _('Number of sessions') . '</th>';
 echo '</tr>';
 echo '<tfoot>';
 $i = 0;
 foreach (Session::getAllStates() as $state) {
     $total = Abstract_Session::countByStatus($state);
     if ($total == 0) {
         continue;
     }
     $css_class = 'content' . ($i++ % 2 == 0 ? 1 : 2);
     echo '<tr class="' . $css_class . '">';
     echo '<td><span class="msg_' . Session::colorStatus($state) . '">' . Session::textStatus($state) . '</span></td>';
     echo '<td style="text-align: right;">' . $total . '</td>';
     echo '</tr>';
 }
 echo '</tfoot>';
 echo '</table>';
 echo '</td></tr></table>';
 if (isset($pagechanger)) {
     echo $pagechanger;
 }
Exemple #5
0
 public function sessions_count()
 {
     $this->check_authorized('viewStatus');
     $ret = array('total' => 0);
     foreach (Session::getAllStates() as $state) {
         $nb = Abstract_Session::countByStatus($state);
         if ($nb == 0) {
             continue;
         }
         $ret[$state] = $nb;
         $ret['total'] += $nb;
     }
     return $ret;
 }