本文整理汇总了PHP中owa_coreAPI::notice方法的典型用法代码示例。如果您正苦于以下问题:PHP owa_coreAPI::notice方法的具体用法?PHP owa_coreAPI::notice怎么用?PHP owa_coreAPI::notice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类owa_coreAPI
的用法示例。
在下文中一共展示了owa_coreAPI::notice方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _logMessage
function _logMessage($msg, $status = DLOG_NOTICE)
{
if ($status & DLOG_TO_CONSOLE) {
echo $msg . "\n";
}
owa_coreAPI::notice("Daemon: {$msg}");
}
示例2: action
function action()
{
if ($this->getParam('queues')) {
$queues = $this->getParam('queues');
} else {
$queues = 'incoming_tracking_events,processing';
}
if ($this->getParam('interval')) {
$interval = $this->getParam('interval');
} else {
$interval = 3600 * 24;
}
// pull list of event queues to process from command line
$queues = $this->getParam('queues');
if ($queues) {
// parse command line
$queues = explode(',', $this->getParam('queues'));
} else {
// get whatever queues are registered by modules
$s = owa_coreAPI::serviceSingleton();
$queues = array_keys($s->getMap('event_queues'));
}
if ($queues) {
foreach ($queues as $queue_name) {
owa_coreAPI::notice("About to prune archive of event queue: {$queue_name}");
$q = owa_coreAPI::getEventQueue($queue_name);
if ($q->connect()) {
$q->pruneArchive($interval);
}
}
}
}
示例3: action
function action()
{
$sm = owa_coreAPI::supportClassFactory('base', 'siteManager');
$ret = $sm->createNewSite($this->getParam('domain'), $this->getParam('name'), $this->getParam('description'), $this->getParam('site_family'));
if ($ret) {
owa_coreAPI::notice("Site added successfully. site_id: {$ret}");
}
}
示例4: action
function action()
{
$module = $this->getParam('module');
if ($module) {
$ret = owa_coreAPI::activateModule($module);
} else {
owa_coreAPI::notice('No module argument was specified. Use module=xxx');
}
}
示例5: __construct
/**
* Constructor
*
* @param array $params
* @return owa_controller
*/
function __construct($params)
{
if (owa_coreAPI::getSetting('base', 'cli_mode')) {
return parent::__construct($params);
} else {
owa_coreAPI::notice("Controller not called from CLI");
exit;
}
}
示例6: isDbReady
function isDbReady()
{
$this->db_file_path = OWA_MAXMIND_DATA_DIR . $this->db_file_name;
if (file_exists($this->db_file_path)) {
$this->db_file_present = true;
} else {
owa_coreAPI::notice('Maxmind DB file could is not present at: ' . OWA_MAXMIND_DATA_DIR);
}
return $this->db_file_present;
}
示例7: __construct
/**
* Constructor
*
* @return owa_hostip
*/
function __construct()
{
if (!defined('OWA_MAXMIND_DATA_DIR')) {
define('OWA_MAXMIND_DATA_DIR', OWA_DATA_DIR . 'maxmind/');
}
$this->db_file_path = OWA_MAXMIND_DATA_DIR . $this->db_file_name;
if (file_exists($this->db_file_path)) {
$this->db_file_present = true;
} else {
owa_coreAPI::notice('Maxmind DB file could is not present at: ' . OWA_MAXMIND_DATA_DIR);
}
return parent::__construct();
}
示例8: action
function action()
{
if ($this->getParam('queues')) {
$queues = $this->getParam('queues');
} else {
$queues = 'incoming_tracking_events,processing';
}
owa_coreAPI::notice("About to process event queues: {$queues}");
// pull list of event queues to process from command line
$queues = $this->getParam('queues');
if ($queues) {
// parse command line
$queues = explode(',', $this->getParam('queues'));
} else {
// get whatever queues are registered by modules
$s = owa_coreAPI::serviceSingleton();
$queues = array_keys($s->getMap('event_queues'));
}
if ($queues) {
foreach ($queues as $queue_name) {
$q = owa_coreAPI::getEventQueue($queue_name);
if ($q->connect()) {
$d = owa_coreAPI::getEventDispatch();
$more = true;
while ($more) {
owa_coreAPI::debug('calling receive message');
// get an item from the queue
$event = $q->receiveMessage();
owa_coreAPI::debug('Event returned: ' . print_r($event, true));
if ($event) {
// dispatch event
$ret = $d->notify($event);
if ($ret = OWA_EHS_EVENT_HANDLED) {
// delete event from queue
// second param is for backwards compat. remove soon
$q->deleteMessage($event->getQueueGuid());
}
} else {
// if no event, stop the loop
$more = false;
owa_coreAPI::notice("No more events to process.");
}
}
$q->disconnect();
}
}
} else {
owa_coreAPI::notice("There are no event queues registered.");
}
}
示例9: action
function action()
{
$c = owa_coreAPI::configSingleton();
$config_values = $this->get('config');
if (!empty($config_values)) {
foreach ($config_values as $k => $v) {
list($module, $name) = explode('.', $k);
if ($module && $name) {
$c->persistSetting($module, $name, $v);
}
}
$c->save();
owa_coreAPI::notice("Configuration changes saved to database.");
$this->setStatusCode(2500);
}
$this->setRedirectAction('base.optionsGeneral');
}
示例10: notify
/**
* Notify Event Handler
*
* @param unknown_type $event
* @access public
*/
function notify($event)
{
if ($event->get('document_id') || $event->get('page_url')) {
// create entity
$d = owa_coreAPI::entityFactory('base.document');
// get document id from event
$id = $event->get('document_id');
// if no document_id present attempt to make one from the page_url property
if (!$id) {
$page_url = $event->get('page_url');
if ($page_url) {
$id = $d->generateId($page_url);
} else {
owa_coreAPI::debug('Not persisting Document, no page_url or document_id event property found.');
return OWA_EHS_EVENT_HANDLED;
}
}
$d->load($id);
if (!$d->wasPersisted()) {
$d->setProperties($event->getProperties());
$d->set('url', $event->get('page_url'));
$d->set('uri', $event->get('page_uri'));
$d->set('id', $id);
$ret = $d->create();
if ($ret) {
return OWA_EHS_EVENT_HANDLED;
} else {
return OWA_EHS_EVENT_FAILED;
}
} else {
owa_coreAPI::debug('Not logging Document, already exists');
return OWA_EHS_EVENT_HANDLED;
}
} else {
owa_coreAPI::notice('Not persisting Document dimension. document id or page url are missing from event.');
return OWA_EHS_EVENT_HANDLED;
}
}
示例11: notify
/**
* Notify Event Handler
*
* @param unknown_type $event
* @access public
*/
function notify($event)
{
if (!$event->get('host_id')) {
owa_coreAPI::notice('Not persisting host dimension. Host id missing from event.');
return OWA_EHS_EVENT_HANDLED;
}
$h = owa_coreAPI::entityFactory('base.host');
$h->getByPk('id', $event->get('host_id'));
$id = $h->get('id');
if (!$id) {
$h->setProperties($event->getProperties());
$h->set('id', $event->get('host_id'));
$ret = $h->create();
if ($ret) {
return OWA_EHS_EVENT_HANDLED;
} else {
return OWA_EHS_EVENT_FAILED;
}
} else {
owa_coreAPI::debug('Not Persisting. Host already exists.');
return OWA_EHS_EVENT_HANDLED;
}
}
示例12: isLocked
function isLocked()
{
if (file_exists($this->lock_file)) {
//read contents of lock file for last PID
$lock = fopen($this->lock_file, "r") or die("Could not read lock file");
if ($lock) {
while (!feof($lock)) {
$former_pid = fgets($lock, 4096);
}
fclose($lock);
}
//check to see if former process is still running
$ps_check = $this->isRunning($former_pid);
//if the process is still running, exit.
if ($ps_check) {
owa_coreAPI::notice(sprintf('Previous Process (%d) still active. Terminating Run.', $former_pid));
return true;
//if it's not running remove the lock file and proceead.
} else {
owa_coreAPI::debug(sprintf('Process %d is no longer running. Deleting old Lock file. \\n', $former_pid));
unlink($this->lock_file);
return false;
}
} else {
return false;
}
}
示例13: markAsHandled
function markAsHandled($item_id)
{
$qi = owa_coreAPI::entityFactory('base.queue_item');
$qi->load($item_id);
if ($qi->wasPersisted()) {
$qi->set('status', 'handled');
$qi->set('handled_timestamp', $this->makeTimestamp());
$qi->save();
} else {
owa_coreAPI::notice("Could not find/delete queue item id: {$item_id}");
}
}
示例14: update
/**
* Checks for and applies schema upgrades for the module
*
*/
function update()
{
// list files in a directory
$files = owa_lib::listDir(OWA_DIR . 'modules' . '/' . $this->name . '/' . 'updates', false);
//print_r($files);
$current_schema_version = $this->c->get($this->name, 'schema_version');
// extract sequence
foreach ($files as $k => $v) {
// the use of %d casts the sequence number as an int which is critical for maintaining the
// order of the keys in the array that we are going ot create that holds the update objs
//$n = sscanf($v['name'], '%d_%s', $seq, $classname);
$seq = substr($v['name'], 0, -4);
settype($seq, "integer");
if ($seq > $current_schema_version) {
if ($seq <= $this->required_schema_version) {
$this->updates[$seq] = owa_coreAPI::updateFactory($this->name, substr($v['name'], 0, -4));
// if the cli update mode is required and we are not running via cli then return an error.
owa_coreAPI::debug('cli update mode required: ' . $this->updates[$seq]->isCliModeRequired());
if ($this->updates[$seq]->isCliModeRequired() === true && !defined('OWA_CLI')) {
//set flag in module
$this->update_from_cli_required = true;
owa_coreAPI::notice("Aborting update {$seq}. This update must be applied using the command line interface.");
return false;
}
// set schema version from sequence number in file name. This ensures that only one update
// class can ever be in use for a particular schema version
$this->updates[$seq]->schema_version = $seq;
}
}
}
// sort the array
ksort($this->updates, SORT_NUMERIC);
//print_r(array_keys($this->updates));
foreach ($this->updates as $k => $obj) {
$this->e->notice(sprintf("Applying Update %d (%s)", $k, get_class($obj)));
$ret = $obj->apply();
if ($ret == true) {
$this->e->notice("Update Suceeded");
} else {
$this->e->notice("Update Failed");
return false;
}
}
return true;
}
示例15: flush
function flush()
{
owa_coreAPI::notice("Cannot flush Memcache from client.");
return true;
}