本文整理汇总了PHP中owa_coreAPI::serviceSingleton方法的典型用法代码示例。如果您正苦于以下问题:PHP owa_coreAPI::serviceSingleton方法的具体用法?PHP owa_coreAPI::serviceSingleton怎么用?PHP owa_coreAPI::serviceSingleton使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类owa_coreAPI
的用法示例。
在下文中一共展示了owa_coreAPI::serviceSingleton方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action
function action()
{
$s = owa_coreAPI::serviceSingleton();
// lookup method class
$do = $s->getApiMethodClass($this->getParam('do'));
if ($do) {
// check credentials
/* PERFORM AUTHENTICATION */
if (array_key_exists('required_capability', $do)) {
/* CHECK USER FOR CAPABILITIES */
if (!owa_coreAPI::isCurrentUserCapable($do['required_capability'])) {
// doesn't look like the currentuser has the necessary priviledges
owa_coreAPI::debug('User does not have capability required by this controller.');
// auth user
$auth =& owa_auth::get_instance();
$status = $auth->authenticateUser();
// if auth was not successful then return login view.
if ($status['auth_status'] != true) {
return 'This method requires authentication.';
} else {
//check for needed capability again now that they are authenticated
if (!owa_coreAPI::isCurrentUserCapable($do['required_capability'])) {
return 'Your user does not have privileges to access this method.';
}
}
}
}
//perform
$map = owa_coreAPI::getRequest()->getAllOwaParams();
echo owa_coreAPI::executeApiCommand($map);
}
}
示例2: action
function action()
{
// fetch list of modules that require updates
$s =& owa_coreAPI::serviceSingleton();
$modules = $s->getModulesNeedingUpdates();
//print_r($modules);
//return;
// foreach do update in order
$error = false;
foreach ($modules as $k => $v) {
$ret = $s->modules[$v]->update();
if ($ret != true) {
$error = true;
// if there is an error check to see if it's because the cli update mode is required
$cli_update_required = $s->modules[$v]->isCliUpdateModeRequired();
break;
}
}
if ($error === true) {
if ($cli_update_required) {
$this->set('error_msg', $this->getMsg(3311));
} else {
$this->set('error_msg', $this->getMsg(3307));
}
$this->setView('base.error');
$this->setViewMethod('delegate');
} else {
// add data to container
$this->set('status_code', 3308);
$this->set('do', 'base.optionsGeneral');
$this->setViewMethod('redirect');
}
}
示例3: installSchema
function installSchema()
{
$service =& owa_coreAPI::serviceSingleton();
$base = $service->getModule('base');
$status = $base->install();
return $status;
}
示例4: action
function action()
{
$service =& owa_coreAPI::serviceSingleton();
$this->e->notice('starting Embedded install');
//create config file
$this->c->createConfigFile($this->params);
$this->c->applyConfigConstants();
// install schema
$base = $service->getModule('base');
$status = $base->install();
// schema was installed successfully
if ($status === true) {
//create admin user
$cu = owa_coreAPI::getCurrentUser();
$this->createAdminUser($cu->getUserData('email_address'), $cu->getUserData('real_name'));
// create default site
$this->createDefaultSite($this->getParam('domain'), $this->getParam('name'), $this->getParam('description'), $this->getParam('site_family'), $this->getParam('site_id'));
// Persist install complete flag.
$this->c->persistSetting('base', 'install_complete', true);
$save_status = $this->c->save();
if ($save_status === true) {
$this->e->notice('Install Complete Flag added to configuration');
} else {
$this->e->notice('Could not persist Install Complete Flag to the Database');
}
$this->setView('base.installFinishEmbedded');
// schema was not installed successfully
} else {
$this->e->notice('Aborting embedded install due to errors installing schema. Try dropping all OWA tables and try again.');
return false;
}
}
示例5: __construct
function __construct()
{
$this->params = $this->getArgs();
if (isset($this->params['interval'])) {
$this->job_scheduling_interval = $this->params['interval'];
}
if (isset($this->params['max_workers'])) {
$this->max_workers = $this->params['max_workers'];
}
if (isset($this->params['pid_file_location'])) {
$this->pidFileLocation = $this->params['pid_file_location'];
}
if (isset($this->params['uid'])) {
$this->userID = $this->params['uid'];
}
if (isset($this->params['gid'])) {
$this->groupID = $this->params['gid'];
}
if (isset($this->params['pid_file_location'])) {
$this->pidFileLocation = $this->params['pid_file_location'];
}
$s = owa_coreAPI::serviceSingleton();
$this->jobs = $s->getMap('backgound_jobs');
$this->eq = owa_coreAPI::getEventDispatch();
return parent::__construct();
}
示例6: 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);
}
}
}
}
示例7: action
function action()
{
$service = owa_coreAPI::serviceSingleton();
$im = owa_coreAPI::supportClassFactory('base', 'installManager');
$this->e->notice('Starting OWA Install from command line.');
//create config file
$present = $this->c->isConfigFilePresent();
if ($present) {
$this->c->applyConfigConstants();
// install schema
$status = $im->installSchema();
// schema was installed successfully
if ($status === true) {
//create admin user
//owa_coreAPI::debug('password: '.owa_lib::encryptPassword( $this->c->get('base', 'db_password') ) );
$im->createAdminUser($this->getParam('email_address'), $this->getParam('real_name'), $this->c->get('base', 'db_password'));
// create default site
$im->createDefaultSite($this->getParam('domain'), $this->getParam('domain'), $this->getParam('description'), $this->getParam('site_family'));
// Persist install complete flag.
$this->c->persistSetting('base', 'install_complete', true);
$save_status = $this->c->save();
if ($save_status === true) {
$this->e->notice('Install Completed.');
} else {
$this->e->notice('Could not persist Install Complete Flag to the Database');
}
// schema was not installed successfully
} else {
$this->e->notice('Aborting embedded install due to errors installing schema. Try dropping all OWA tables and try again.');
return false;
}
} else {
$this->e->notice("Could not locate config file. Aborting installation.");
}
}
示例8: action
function action()
{
$s =& owa_coreAPI::serviceSingleton();
$m = $s->getModule($this->getParam('module'));
$m->deactivate();
$this->setRedirectAction('base.optionsModules');
$this->setStatusCode(2502);
}
示例9: 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) {
// process event if needed
// lookup which event processor to use to process this event type
$processor_action = owa_coreAPI::getEventProcessor($event->getEventType());
if ($processor_action) {
// processor handles it's own event dispatching, so just return
return owa_coreAPI::handleRequest(array('event' => $event), $processor_action);
} else {
// 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.");
}
}
示例10: listPendingUpdates
function listPendingUpdates()
{
$s =& owa_coreAPI::serviceSingleton();
$modules = $s->getModulesNeedingUpdates();
if ($modules) {
owa_coreAPI::notice(sprintf("Updates pending include: %s", print_r($modules, true)));
} else {
owa_coreAPI::notice("No updates are pending.");
}
}
示例11: getRequiredCapability
function getRequiredCapability()
{
$s = owa_coreAPI::serviceSingleton();
// lookup method class
$do = $s->getApiMethodClass($this->getParam('do'));
if ($do) {
// check for capability
if (array_key_exists('required_capability', $do)) {
return $do['required_capability'];
}
}
}
示例12: up
function up()
{
$db = owa_coreAPI::dbSingleton();
$s =& owa_coreAPI::serviceSingleton();
$entities = $s->modules[$this->module_name]->getEntities();
foreach ($entities as $k => $v) {
$ret = $db->alterTableType($this->c->get('base', 'ns') . $v, 'InnoDB');
if ($ret == true) {
$this->e->notice(sprintf('Changed Table %s to InnoDB', $v));
} else {
$this->e->notice(sprintf('Change to Table %s failed', $v));
return false;
}
}
return true;
}
示例13: pre
/**
* Must be called before all other event property setting functions
*/
function pre()
{
$teh = owa_coreAPI::getInstance('owa_trackingEventHelpers', OWA_BASE_CLASS_DIR . 'trackingEventHelpers.php');
$s = owa_coreAPI::serviceSingleton();
// STAGE 1 - set environmental properties from SERVER
// now happens in coreAPI::logEvent
// STAGE 2 - process incomming properties
$properties = $s->getMap('tracking_properties_regular');
// add custom var properties
$properties = $teh->addCustomVariableProperties($properties);
// translate custom var properties
$teh->translateCustomVariables($this->event);
$teh->setTrackerProperties($this->event, $properties);
// STAGE 3 - derived properties
$derived_properties = $s->getMap('tracking_properties_derived');
$teh->setTrackerProperties($this->event, $derived_properties);
}
示例14: getAllMetrics
public static function getAllMetrics()
{
$s = owa_coreAPI::serviceSingleton();
return $s->metrics;
}
示例15: resolveOs
static function resolveOs($os, $event)
{
$service = owa_coreAPI::serviceSingleton();
$bcap = $service->getBrowscap();
return $bcap->getOsFamily();
}