forked from Open-Web-Analytics/Open-Web-Analytics
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- refactored settings/config into real object - added modules roster and stub for activate/deactivate
- Loading branch information
padams
committed
Feb 5, 2007
1 parent
dad3177
commit 88efd2d
Showing
91 changed files
with
4,155 additions
and
3,638 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,107 +1,108 @@ | ||
<?php | ||
|
||
// | ||
// Open Web Analytics - An Open Source Web Analytics Framework | ||
// | ||
// Copyright 2006 Peter Adams. All rights reserved. | ||
// | ||
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// $Id$ | ||
// | ||
|
||
require_once OWA_PEARLOG_DIR . '/Log.php'; | ||
require_once OWA_PLUGINS_DIR . '/log/queue.php'; | ||
require_once OWA_PLUGINS_DIR . '/log/async_queue.php'; | ||
require_once 'owa_observer.php'; | ||
|
||
/** | ||
* Event Queue | ||
* | ||
* @author Peter Adams <[email protected]> | ||
* @copyright Copyright © 2006 Peter Adams <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 | ||
* @category owa | ||
* @package owa | ||
* @version $Revision$ | ||
* @since owa 1.0.0 | ||
*/ | ||
class eventQueue { | ||
|
||
/** | ||
* Configuration | ||
* | ||
* @var array | ||
*/ | ||
var $config; | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @return eventQueue | ||
*/ | ||
function eventQueue() { | ||
|
||
return; | ||
} | ||
|
||
/** | ||
* Event Queue factory | ||
* @static | ||
* @return object | ||
* @access public | ||
*/ | ||
function &get_instance() { | ||
|
||
static $eq; | ||
|
||
$this->config = &owa_settings::get_settings(); | ||
|
||
if (!isset($eq)): | ||
// Create an async event queue | ||
if ($this->config['async_db'] == true): | ||
$conf = array('mode' => 0600, 'timeFormat' => '%X %x'); | ||
$eq = &Log::singleton('async_queue', $this->config['async_log_dir'].$this->config['async_log_file'], 'async_event_queue', $conf); | ||
$eq->_lineFormat = '%1$s|*|%2$s|*|[%3$s]|*|%4$s|*|%5$s'; | ||
// not sure why this is needed but it is. | ||
$eq->_filename = $this->config['async_log_dir'].$this->config['async_log_file']; | ||
|
||
// This observer will watch the queue and exec a new php process that will process the events | ||
require_once(OWA_PLUGINS_DIR.'/event_handlers/async/observer_async_helper.php'); | ||
$async_helper = &owa_observer::factory('async_helper', PEAR_LOG_INFO); | ||
$eq->attach($async_helper); | ||
|
||
else: | ||
//Create a normal event queue using 'queue' which is an extension to PEAR LOG. | ||
$eq = Log::singleton('queue', '', 'event_queue'); | ||
|
||
/* if ($dir = @opendir(OWA_PLUGINS_DIR.'/event_handlers')): | ||
while (($file = @readdir($dir)) !== false) { | ||
if (strstr($file, '.php') && | ||
substr($file, -1, 1) != "~" && | ||
substr($file, 0, 1) != "#"): | ||
require_once(OWA_PLUGINS_DIR.'/event_handlers/'.$file); | ||
$class = substr($file, 9, -4); | ||
$plugin_name = &owa_observer::factory($class, PEAR_LOG_INFO); | ||
$eq->attach($plugin_name); | ||
endif; | ||
} | ||
@closedir($dir); | ||
endif; */ | ||
endif; | ||
endif; | ||
|
||
return $eq; | ||
} | ||
|
||
} | ||
|
||
?> | ||
<?php | ||
|
||
// | ||
// Open Web Analytics - An Open Source Web Analytics Framework | ||
// | ||
// Copyright 2006 Peter Adams. All rights reserved. | ||
// | ||
// Licensed under GPL v2.0 http://www.gnu.org/copyleft/gpl.html | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// $Id$ | ||
// | ||
|
||
require_once OWA_PEARLOG_DIR . '/Log.php'; | ||
require_once OWA_PLUGINS_DIR . '/log/queue.php'; | ||
require_once OWA_PLUGINS_DIR . '/log/async_queue.php'; | ||
require_once 'owa_observer.php'; | ||
|
||
/** | ||
* Event Queue | ||
* | ||
* @author Peter Adams <[email protected]> | ||
* @copyright Copyright © 2006 Peter Adams <[email protected]> | ||
* @license http://www.gnu.org/copyleft/gpl.html GPL v2.0 | ||
* @category owa | ||
* @package owa | ||
* @version $Revision$ | ||
* @since owa 1.0.0 | ||
*/ | ||
class eventQueue { | ||
|
||
/** | ||
* Configuration | ||
* | ||
* @var array | ||
*/ | ||
var $config; | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @return eventQueue | ||
*/ | ||
function eventQueue() { | ||
|
||
return; | ||
} | ||
|
||
/** | ||
* Event Queue factory | ||
* @static | ||
* @return object | ||
* @access public | ||
*/ | ||
function &get_instance() { | ||
|
||
static $eq; | ||
|
||
$c = &owa_coreAPI::configSingleton(); | ||
$this->config = $c->fetch('base'); | ||
|
||
if (!isset($eq)): | ||
// Create an async event queue | ||
if ($this->config['async_db'] == true): | ||
$conf = array('mode' => 0600, 'timeFormat' => '%X %x'); | ||
$eq = &Log::singleton('async_queue', $this->config['async_log_dir'].$this->config['async_log_file'], 'async_event_queue', $conf); | ||
$eq->_lineFormat = '%1$s|*|%2$s|*|[%3$s]|*|%4$s|*|%5$s'; | ||
// not sure why this is needed but it is. | ||
$eq->_filename = $this->config['async_log_dir'].$this->config['async_log_file']; | ||
|
||
// This observer will watch the queue and exec a new php process that will process the events | ||
require_once(OWA_PLUGINS_DIR.'/event_handlers/async/observer_async_helper.php'); | ||
$async_helper = &owa_observer::factory('async_helper', PEAR_LOG_INFO); | ||
$eq->attach($async_helper); | ||
|
||
else: | ||
//Create a normal event queue using 'queue' which is an extension to PEAR LOG. | ||
$eq = Log::singleton('queue', '', 'event_queue'); | ||
|
||
/* if ($dir = @opendir(OWA_PLUGINS_DIR.'/event_handlers')): | ||
while (($file = @readdir($dir)) !== false) { | ||
if (strstr($file, '.php') && | ||
substr($file, -1, 1) != "~" && | ||
substr($file, 0, 1) != "#"): | ||
require_once(OWA_PLUGINS_DIR.'/event_handlers/'.$file); | ||
$class = substr($file, 9, -4); | ||
$plugin_name = &owa_observer::factory($class, PEAR_LOG_INFO); | ||
$eq->attach($plugin_name); | ||
endif; | ||
} | ||
@closedir($dir); | ||
endif; */ | ||
endif; | ||
endif; | ||
|
||
return $eq; | ||
} | ||
|
||
} | ||
|
||
?> |
Oops, something went wrong.