<?

/*

PHPOS, The PHP Persistent Object Store - Base Classes
=====================================================

Copyright (C) 2003 Vincent Negrier aka. sIX <six@aegis-corp.org>

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library 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
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

*/

class PHPOS_Base_System {

	function Version() {

		return PHPOSD_VERSION;
	
	}

	function PHP_Version() {

		return (phpversion());
	
	}
	
	function Get_Stats() {

		$sa=array();

		$sa["uptime"]=time()-$GLOBALS["PHPOS_Start_Time"];
		
		return ($sa);
	
	}
	
	function Shutdown($message="requested") {

		$GLOBALS["PHPOS_Halt"]=$message;
	
	}

	function Log($str) {

		SK_Toolkit::techo($str);
	
	}

	function Store_Get_Classes() {

		$ret=array();		
		
		foreach ($GLOBALS["PHPOS_Store"]->containers as $c) if (isset($c->class_name)) {

			$cl=array(	"oid"		 => $c->oid,
						"class_name" => $c->class_name,
						"owner"		 =>	$c->owner,
						"access_mode"=>	$c->access_mode);

			$ret[$c->oid]=$cl;

		}

		return ($ret);
	
	}

	function Store_Get_Objects() {

		$ret=array();		
		
		foreach ($GLOBALS["PHPOS_Store"]->containers as $c) if (isset($c->content)) {

			$ol=array(	"oid"			=> $c->oid,
						"owner"			=> $c->owner,
						"access_mode"	=> $c->access_mode,
						"total_binds"	=> $c->total_binds,
						"active_binds"  => $c->active_binds,
						"create_time"	=> $c->create_time,
						"sleep_time"	=> $c->sleep_time,
						"wake_time"		=> $c->wake_time,
						"total_stasis"	=> $c->total_stasis,
						"last_act_time"	=> $c->last_act_time);

			$ret[$c->oid]=$ol;

		}

		return ($ret);
	
	}

}

?>
