当前位置: 首页>>代码示例>>PHP>>正文


PHP owa_coreAPI::serviceSingleton方法代码示例

本文整理汇总了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);
     }
 }
开发者ID:nishantmendiratta,项目名称:Open-Web-Analytics,代码行数:32,代码来源:apiRequest.php

示例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');
     }
 }
开发者ID:nishantmendiratta,项目名称:Open-Web-Analytics,代码行数:33,代码来源:updatesApply.php

示例3: installSchema

 function installSchema()
 {
     $service =& owa_coreAPI::serviceSingleton();
     $base = $service->getModule('base');
     $status = $base->install();
     return $status;
 }
开发者ID:nishantmendiratta,项目名称:Open-Web-Analytics,代码行数:7,代码来源:installManager.php

示例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;
     }
 }
开发者ID:nishantmendiratta,项目名称:Open-Web-Analytics,代码行数:32,代码来源:installEmbedded.php

示例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();
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:26,代码来源:daemon.php

示例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);
             }
         }
     }
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:32,代码来源:pruneEventQueueArchivesCli.php

示例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.");
     }
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:35,代码来源:installCli.php

示例8: action

 function action()
 {
     $s =& owa_coreAPI::serviceSingleton();
     $m = $s->getModule($this->getParam('module'));
     $m->deactivate();
     $this->setRedirectAction('base.optionsModules');
     $this->setStatusCode(2502);
 }
开发者ID:nishantmendiratta,项目名称:Open-Web-Analytics,代码行数:8,代码来源:moduleDeactivate.php

示例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.");
     }
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:58,代码来源:processEventQueue.php

示例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.");
     }
 }
开发者ID:nishantmendiratta,项目名称:Open-Web-Analytics,代码行数:10,代码来源:updatesApplyCli.php

示例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'];
         }
     }
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:12,代码来源:apiRequest.php

示例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;
 }
开发者ID:nishantmendiratta,项目名称:Open-Web-Analytics,代码行数:16,代码来源:003.php

示例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);
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:20,代码来源:processEvent.php

示例14: getAllMetrics

 public static function getAllMetrics()
 {
     $s = owa_coreAPI::serviceSingleton();
     return $s->metrics;
 }
开发者ID:ashutoshdev,项目名称:Open-Web-Analytics,代码行数:5,代码来源:owa_coreAPI.php

示例15: resolveOs

 static function resolveOs($os, $event)
 {
     $service = owa_coreAPI::serviceSingleton();
     $bcap = $service->getBrowscap();
     return $bcap->getOsFamily();
 }
开发者ID:arineng,项目名称:Open-Web-Analytics,代码行数:6,代码来源:trackingEventHelpers.php


注:本文中的owa_coreAPI::serviceSingleton方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。