phpOpenTracker/phpOpenTracker Configuration.php,1.1,1.2 Database.php,1.1,1.2

Sebastian Bergmann <[email protected]>
Newsgroups gmane.comp.web.phpopentracker.cvs
Message-ID <[email protected]>
Update of /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker
In directory sc8-pr-cvs1:/tmp/cvs-serv5553/phpOpenTracker

Modified Files:
	Configuration.php Database.php 
Log Message:
Some work on phpOpenTracker_Configuration.

Index: Configuration.php
===================================================================
RCS file: /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/Configuration.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Configuration.php	22 Nov 2003 08:47:43 -0000	1.1
--- Configuration.php	22 Nov 2003 11:53:55 -0000	1.2
***************
*** 16,30 ****
  
  class phpOpenTracker_Configuration {
!     private static $instance = null;
  
      private function __construct() {
      }
  
!     public static function getInstance() {
!         if (self::$instance == null) {
!             self::$instance = new phpOpenTracker_Configuration;
!         }
  
!         return self::$instance;
      }
  }
--- 16,78 ----
  
  class phpOpenTracker_Configuration {
!     private static $configuration = array(
!       'db_type'                             => 'mysql',
!       'db_host'                             => 'localhost',
!       'db_port'                             => 'default',
!       'db_socket'                           => 'default',
!       'db_user'                             => 'root',
!       'db_password'                         => '',
!       'db_database'                         => 'phpOpenTracker',
!       'additional_data_table'               => 'pot_add_data',
!       'accesslog_table'                     => 'pot_accesslog',
!       'documents_table'                     => 'pot_documents',
!       'exit_targets_table'                  => 'pot_exit_targets',
!       'hostnames_table'                     => 'pot_hostnames',
!       'operating_systems_table'             => 'pot_operating_systems',
!       'referers_table'                      => 'pot_referers',
!       'user_agents_table'                   => 'pot_user_agents',
!       'visitors_table'                      => 'pot_visitors',
!       'merge_tables_threshold'              => 6,
!       'delay_key_write'                     => false,
!       'document_env_var'                    => 'REQUEST_URI',
!       'clean_referer_string'                => false,
!       'clean_query_string'                  => false,
!       'get_parameter_filter'                => '',
!       'resolve_hostname'                    => true,
!       'group_hostnames'                     => true,
!       'group_user_agents'                   => true,
!       'track_returning_visitors'            => false,
!       'returning_visitors_cookie'           => 'pot_visitor_id',
!       'returning_visitors_cookie_lifetime'  => 365,
!       'locking'                             => false,
!       'log_reload'                          => false,
!       'jpgraph_path'                        => '',
!       'logging_engine_plugins'              => '',
!       'query_cache'                         => false,
!       'query_cache_dir'                     => '/tmp',
!       'query_cache_lifetime'                => 3600,
!       'debug_level'                         => 1,
!       'exit_on_fatal_errors'                => true,
!       'log_errors'                          => false
!     );
  
      private function __construct() {
      }
  
!     public static function getConfiguration() {
!         return self::$configuration;
!     }
  
!     public static function get($directive) {
!         return isset(self::$configuration[$directive]) ? self::$configuration[$directive] : false;
!     }
! 
!     public static function set($directive, $value) {
!         if (isset(self::$configuration[$directive])) {
!             self::$configuration[$directive] = $value;
!             return true;
!         } else {
!             return false;
!         }
      }
  }

Index: Database.php
===================================================================
RCS file: /cvsroot/phpopencounter/phpOpenTracker/phpOpenTracker/Database.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Database.php	22 Nov 2003 08:47:43 -0000	1.1
--- Database.php	22 Nov 2003 11:53:55 -0000	1.2
***************
*** 19,23 ****
      private static $instance = null;
  
!     private function __construct(phpOpenTracker_Configuration $configuration) {
          $this->configuration = $configuration;
      }
--- 19,23 ----
      private static $instance = null;
  
!     private function __construct($configuration) {
          $this->configuration = $configuration;
      }
***************
*** 25,31 ****
      public static function getInstance() {
          if (self::$instance == null) {
!             $configuration = phpOpenTracker_Configuration::getInstance();
  
!             $class = 'phpOpenTracker_Database_' . $configuration->databaseType;
  
              self::$instance = new $class($configuration);
--- 25,31 ----
      public static function getInstance() {
          if (self::$instance == null) {
!             $configuration = phpOpenTracker_Configuration::getConfiguration();
  
!             $class = 'phpOpenTracker_Database_' . $configuration['db_type'];
  
              self::$instance = new $class($configuration);




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?  SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.