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


PHP midcom_connection::get方法代码示例

本文整理汇总了PHP中midcom_connection::get方法的典型用法代码示例。如果您正苦于以下问题:PHP midcom_connection::get方法的具体用法?PHP midcom_connection::get怎么用?PHP midcom_connection::get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在midcom_connection的用法示例。


在下文中一共展示了midcom_connection::get方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _on_execute

 /**
  * Loads all entries that need to be processed and processes them.
  */
 public function _on_execute()
 {
     $qb = midcom_services_at_entry_dba::new_query_builder();
     // (to be) start(ed) AND last touched over two days ago
     $qb->add_constraint('start', '<=', time() - 3600 * 24 * 2);
     $qb->begin_group('OR');
     $qb->add_constraint('host', '=', midcom_connection::get('host'));
     $qb->add_constraint('host', '=', 0);
     $qb->end_group();
     $qb->add_constraint('metadata.revised', '<=', date('Y-m-d H:i:s', time() - 3600 * 24 * 2));
     $qb->add_constraint('status', '>=', midcom_services_at_entry_dba::RUNNING);
     midcom::get('auth')->request_sudo('midcom.services.at');
     $qbret = $qb->execute();
     if (empty($qbret)) {
         debug_add('Got empty resultset, exiting');
         midcom::get('auth')->drop_sudo();
         return;
     }
     foreach ($qbret as $entry) {
         debug_add("Deleting dangling entry #{$entry->id}\n", MIDCOM_LOG_INFO);
         debug_print_r("Entry #{$entry->id} dump: ", $entry);
         $entry->delete();
     }
     midcom::get('auth')->drop_sudo();
 }
开发者ID:nemein,项目名称:openpsa,代码行数:28,代码来源:clean.php

示例2: _on_creating

 /**
  * Makes sure we have status set and arguments serialized
  *
  * @return boolean Always true
  */
 public function _on_creating()
 {
     if (!$this->status) {
         $this->status = self::SCHEDULED;
     }
     if (!$this->host) {
         $this->host = midcom_connection::get('host');
     }
     $this->_serialize_arguments();
     return true;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:16,代码来源:entry.php

示例3: list_styles

 /**
  * Static method for listing available style templates
  */
 public static function list_styles($up = 0, $prefix = '/', $spacer = '')
 {
     static $style_array = array();
     $style_array[''] = midcom::get('i18n')->get_string('default', 'midcom.admin.folder');
     // Give an option for creating a new layout template
     $style_array['__create'] = midcom::get('i18n')->get_string('new layout template', 'midcom.admin.folder');
     if ($GLOBALS['midcom_config']['styleengine_relative_paths'] && $up == 0) {
         // Relative paths in use, start seeking from under the style used for the Midgard host
         $up = midcom_connection::get('style');
     }
     $qb = midcom_db_style::new_query_builder();
     $qb->add_constraint('up', '=', $up);
     $styles = $qb->execute();
     foreach ($styles as $style) {
         $style_string = "{$prefix}{$style->name}";
         // Hide common unwanted material with heuristics
         if (preg_match('/(asgard|empty)/i', $style_string)) {
             continue;
         }
         $style_array[$style_string] = "{$spacer}{$style->name}";
         self::list_styles($style->id, $style_string . '/', $spacer . '&nbsp;&nbsp;');
     }
     return $style_array;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:27,代码来源:management.php

示例4: _initialize_user_from_midgard

 /**
  * Internal startup helper, synchronizes the authenticated user with the Midgard Authentication
  * for startup. This will be overridden by MidCOM Auth, but is there for compatibility reasons.
  */
 private function _initialize_user_from_midgard()
 {
     if (midcom_connection::get_user() && ($user = $this->get_user(midcom_connection::get_user()))) {
         $this->user = $user;
         if (midcom_connection::is_admin() || midcom_connection::get('root')) {
             $this->admin = true;
         }
     }
 }
开发者ID:nemein,项目名称:openpsa,代码行数:13,代码来源:main.php

示例5: export

 public function export()
 {
     $this->read_root(midcom_connection::get('style'));
 }
开发者ID:nemein,项目名称:openpsa,代码行数:4,代码来源:style.php

示例6: _on_execute

 /**
  * Loads all entries that need to be processed and processes them.
  *
  * @todo FIXME: refactor to use more modern MidCOM interfaces and better sanity-checking
  */
 public function _on_execute()
 {
     $qb = midcom_services_at_entry_dba::new_query_builder();
     $qb->add_constraint('start', '<=', time());
     $qb->begin_group('OR');
     $qb->add_constraint('host', '=', midcom_connection::get('host'));
     $qb->add_constraint('host', '=', 0);
     $qb->end_group();
     $qb->add_constraint('status', '=', midcom_services_at_entry_dba::SCHEDULED);
     $qb->set_limit((int) $this->_config->get('limit_per_run'));
     midcom::get('auth')->request_sudo('midcom.services.at');
     $qbret = $qb->execute();
     midcom::get('auth')->drop_sudo();
     if (empty($qbret)) {
         debug_add('Got empty resultset, exiting');
         return;
     }
     foreach ($qbret as $entry) {
         debug_add("Processing entry #{$entry->id}\n");
         //Avoid double-execute in case of long runs
         $entry->status = midcom_services_at_entry_dba::RUNNING;
         midcom::get('auth')->request_sudo('midcom.services.at');
         $entry->update();
         midcom::get('auth')->drop_sudo();
         midcom::get('componentloader')->load($entry->component);
         $args = $entry->arguments;
         $args['midcom_services_at_entry_object'] = $entry;
         $interface = midcom::get('componentloader')->get_interface_class($entry->component);
         $method = $entry->method;
         if (!is_callable(array($interface, $method))) {
             $error = "\$interface->{$method}() is not callable";
             $this->print_error($error);
             debug_add($error, MIDCOM_LOG_ERROR);
             debug_add('$interface is ' . get_class($interface));
             debug_print_r('$args', $args);
             //PONDER: Delete instead ? (There is currently nothing we do with failed entries)
             $entry->status = midcom_services_at_entry_dba::FAILED;
             midcom::get('auth')->request_sudo('midcom.services.at');
             $entry->update();
             midcom::get('auth')->drop_sudo();
             continue;
         }
         $mret = $interface->{$method}($args, $this);
         if ($mret !== true) {
             $error = "\$interface->{$method}(\$args, \$this) returned '{$mret}', errstr: " . midcom_connection::get_error_string();
             $this->print_error($error);
             debug_add($error, MIDCOM_LOG_ERROR);
             debug_add('$interface is ' . get_class($interface));
             debug_print_r('$args', $args);
             //PONDER: Delete instead ? (There is currently nothing we do with failed entries)
             $entry->status = midcom_services_at_entry_dba::FAILED;
             midcom::get('auth')->request_sudo('midcom.services.at');
             $entry->update();
             midcom::get('auth')->drop_sudo();
         } else {
             midcom::get('auth')->request_sudo('midcom.services.at');
             $entry->delete();
             midcom::get('auth')->drop_sudo();
         }
     }
 }
开发者ID:nemein,项目名称:openpsa,代码行数:66,代码来源:check.php

示例7: _create_style

 /**
  * Create a new style for the topic
  *
  * @param string $style_name Name of the style
  * @return string Style path
  */
 private function _create_style($style_name)
 {
     if (isset($GLOBALS['midcom_style_inherited'])) {
         $up = midcom::get('style')->get_style_id_from_path($GLOBALS['midcom_style_inherited']);
         debug_add("Style inherited from {$GLOBALS['midcom_style_inherited']}");
     } else {
         $up = midcom_connection::get('style');
         debug_add("No inherited style found, placing the new style under host style ID: " . midcom_connection::get('style'));
     }
     $style = new midcom_db_style();
     $style->name = $style_name;
     $style->up = $up;
     if (!$style->create()) {
         debug_print_r('Failed to create a new style due to ' . midcom_connection::get_error_string(), $style, MIDCOM_LOG_WARN);
         midcom::get('uimessages')->add('edit folder', sprintf(midcom::get('i18n')->get_string('failed to create a new style template: %s', 'midcom.admin.folder'), midcom_connection::get_error_string()), 'error');
         return '';
     }
     debug_print_r('New style created', $style);
     return midcom::get('style')->get_style_path_from_id($style->id);
 }
开发者ID:nemein,项目名称:openpsa,代码行数:26,代码来源:edit.php

示例8: get_style

 function get_style()
 {
     if (is_null($this->object)) {
         $this->object = new midcom_db_style(midcom_connection::get('style'));
     }
     return $this->object;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:7,代码来源:_styleloader.php

示例9: _complete_defaults

 private function _complete_defaults()
 {
     if (midcom_connection::get('config', 'auth_cookie_id')) {
         $auth_cookie_id = midcom_connection::get('config', 'auth_cookie_id');
     } else {
         // Generate host identifier from Midgard host
         $auth_cookie_id = "host" . midcom_connection::get('host');
     }
     $this->_default_config['auth_backend_simple_cookie_id'] = $auth_cookie_id;
     if (class_exists('Memcache')) {
         $this->_default_config['cache_module_content_backend'] = array('driver' => 'memcached');
         $this->_default_config['cache_module_memcache_backend'] = 'memcached';
     }
     if (isset($_SERVER['SERVER_ADDR'])) {
         $this->_default_config['indexer_reindex_allowed_ips'][] = $_SERVER['SERVER_ADDR'];
     }
     $this->_default_config['midcom_site_title'] = $_SERVER['SERVER_NAME'];
     $this->_default_config['toolbars_simple_css_path'] = MIDCOM_STATIC_URL . "/midcom.services.toolbars/simple.css";
     $basedir = "/var/lib/midgard";
     // TODO: Would be good to include DB name into the path
     if (extension_loaded('midgard2')) {
         $basedir = dirname(midgard_connection::get_instance()->config->sharedir);
     } else {
         $prefix = midcom_connection::get('config', 'prefix');
         if ($prefix == '/usr/local') {
             $basedir = '/var/local/lib/midgard';
         }
     }
     $this->_default_config['midcom_services_rcs_root'] = $basedir . '/rcs';
 }
开发者ID:nemein,项目名称:openpsa,代码行数:30,代码来源:midcom_config.php


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