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


PHP debug_add函数代码示例

本文整理汇总了PHP中debug_add函数的典型用法代码示例。如果您正苦于以下问题:PHP debug_add函数的具体用法?PHP debug_add怎么用?PHP debug_add使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: _parse_query

 private function _parse_query()
 {
     if (!isset($_GET['query'])) {
         return;
     }
     if (isset($_GET['query_mode'])) {
         $this->_query_mode = $_GET['query_mode'];
     }
     $this->_query_string = trim($_GET['query']);
     //Convert asterisks to correct wildcard
     $this->_query_string_processed = str_replace('*', '%', $this->_query_string);
     $this->_query = explode(' ', $this->_query_string_processed);
     // Handle automatic wildcards
     $auto_wildcards = $this->_config->get('auto_wildcards');
     if ($auto_wildcards && strpos($this->_query_string_processed, '%') === false) {
         switch ($auto_wildcards) {
             case 'both':
                 $this->_wildcard_template = '%__TERM__%';
                 break;
             case 'start':
                 $this->_wildcard_template = '%__TERM__';
                 break;
             case 'end':
                 $this->_wildcard_template = '__TERM__%';
                 break;
             default:
                 debug_add("Don't know how to handle auto_wildcards value '{$auto_wildcards}'", MIDCOM_LOG_WARN);
                 break;
         }
     }
 }
开发者ID:nemein,项目名称:openpsa,代码行数:31,代码来源:search.php

示例2: _on_reindex

 /**
  * Iterate over all articles and create index record using the datamanager indexer
  * method.
  */
 public function _on_reindex($topic, $config, &$indexer)
 {
     if (is_null($config->get('symlink_topic')) && !$config->get('disable_indexing')) {
         $qb = midcom::get('dbfactory')->new_query_builder('midcom_db_article');
         $qb->add_constraint('topic', '=', $topic->id);
         $result = $qb->execute();
         if ($result) {
             $schemadb = midcom_helper_datamanager2_schema::load_database($config->get('schemadb'));
             $datamanager = new midcom_helper_datamanager2_datamanager($schemadb);
             if (!$datamanager) {
                 debug_add('Warning, failed to create a datamanager instance with this schemapath:' . $config->get('schemadb'), MIDCOM_LOG_WARN);
                 continue;
             }
             foreach ($result as $article) {
                 if (!$datamanager->autoset_storage($article)) {
                     debug_add("Warning, failed to initialize datamanager for Article {$article->id}. Skipping it.", MIDCOM_LOG_WARN);
                     continue;
                 }
                 net_nehmer_blog_viewer::index($datamanager, $indexer, $topic);
             }
         }
     } elseif (is_null($config->get('symlink_topic')) && !$config->get('disable_search')) {
         debug_add("The topic {$topic->id} is is not to be indexed, skipping indexing.");
     } else {
         debug_add("The topic {$topic->id} is symlinked to another topic, skipping indexing.");
     }
     return true;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:32,代码来源:interfaces.php

示例3: notify

 /**
  * Sends a notice to a selected person
  *
  * @param string $component_action Key of the event in format component:event
  * @param string $recipient GUID of the receiving person
  * @param Array $message Notification message in array format
  */
 public static function notify($component_action, $recipient, $message)
 {
     // Parse action to component and action
     $action_parts = explode(':', $component_action);
     if (count($action_parts) != 2) {
         return false;
     }
     $component = $action_parts[0];
     $action = $action_parts[1];
     // Find in which ways to notify the user
     $notification_type = self::_merge_notification_prefences($component, $action, $recipient);
     if ($notification_type == 'none') {
         // User doesn't wish to be notified
         return true;
     }
     // Add the action to the message
     $message['action'] = $component_action;
     // Figure out notification rendering handler
     // TODO: Support component-specific renderers via class_exists() or handler-like autoloading
     // For example: if (class_exists('org_openpsa_calendar_notifications'))
     $notifier = new org_openpsa_notifications_notifier($recipient);
     // Send the type requested by user
     debug_add("Notifying {$recipient} with type {$notification_type}");
     $method = "send_{$notification_type}";
     if (!method_exists($notifier, $method)) {
         return false;
     }
     $notifier->{$method}($message);
     return true;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:37,代码来源:main.php

示例4: _on_execute

 function _on_execute()
 {
     debug_push_class(__CLASS__, __FUNCTION__);
     if (!$_MIDCOM->auth->request_sudo('fi.kilonkipinat.accountregistration')) {
         $msg = "Could not get sudo, aborting operation, see error log for details";
         $this->print_error($msg);
         debug_add($msg, MIDCOM_LOG_ERROR);
         debug_pop();
         return;
     }
     $time_for_old = date('Y-m-d 00:00', time() - 3600 * 24);
     $qb_resetrequests = fi_kilonkipinat_accountregistration_resetrequest_dba::new_query_builder();
     $qb_resetrequests->add_constraint('metadata.revised', '<', $time_for_old);
     $qb_resetrequests->add_constraint('status', '=', FI_KILONKIPINAT_ACCOUNTREGISTRATION_PASSWORDRESETREQUEST_STATUS_NEW);
     $results = $qb_resetrequests->execute();
     foreach ($results as $result) {
         $result->status = FI_KILONKIPINAT_ACCOUNTREGISTRATION_PASSWORDRESETREQUEST_STATUS_INVALID;
         $result->update();
     }
     $time_for_old = date('Y-m-d 00:00', time() - 3600 * 24 * 31);
     $qb_accounts = fi_kilonkipinat_accountregistration_accountrequest_dba::new_query_builder();
     $qb_accounts->add_constraint('metadata.revised', '<', $time_for_old);
     $qb_accounts->add_constraint('status', '=', FI_KILONKIPINAT_ACCOUNTREGISTRATION_ACCOUNT_STATUS_NEW);
     $results2 = $qb_accounts->execute();
     foreach ($results2 as $result) {
         $result->status = FI_KILONKIPINAT_ACCOUNTREGISTRATION_ACCOUNT_STATUS_INVALID;
         $result->update();
     }
     $_MIDCOM->auth->drop_sudo();
     debug_pop();
 }
开发者ID:netblade,项目名称:kilonkipinat,代码行数:31,代码来源:clearold.php

示例5: _on_execute

 /**
  * Find hanging duplicate marks (that no longer point anywhere) and clear them
  */
 public function _on_execute()
 {
     debug_add('_on_execute called');
     if (!$this->_config->get('enable_duplicate_search')) {
         debug_add('Duplicate operations disabled, aborting', MIDCOM_LOG_INFO);
         return;
     }
     // Untill the FIXME below is handled we abort
     debug_add('Duplicate cleanup disabled since it needs code cleanup for 1.8 Midgfard, aborting', MIDCOM_LOG_ERROR);
     return;
     ignore_user_abort();
     $qb = new midgard_query_builder('midgard_parameter');
     $qb->add_constraint('domain', '=', 'org.openpsa.contacts.duplicates:possible_duplicate');
     $qb->add_order('name', 'ASC');
     $results = @$qb->execute();
     foreach ($results as $param) {
         try {
             $obj = midcom::get('dbfactory')->get_object_by_guid($param->name);
         } catch (midcom_error $e) {
             debug_add("GUID {$param->name} points to nonexistent person, removing possible duplicate mark", MIDCOM_LOG_INFO);
             if (!$param->delete()) {
                 debug_add("Failed to delete parameter {$param->guid}, errstr: " . midcom_connection::get_error_string(), MIDCOM_LOG_ERROR);
             }
         }
     }
     debug_add('Done');
     return;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:31,代码来源:clean.php

示例6: _on_initialize

 /**
  * Initialize the class, if necessary, create a callback instance, otherwise
  * validate that an option array is present.
  */
 public function _on_initialize()
 {
     if (is_string($this->callback)) {
         $classname = $this->callback;
         // Try auto-load.
         $path = MIDCOM_ROOT . '/' . str_replace('_', '/', $classname) . '.php';
         if (!file_exists($path)) {
             debug_add("Auto-loading of the class {$classname} from {$path} failed: File does not exist.", MIDCOM_LOG_ERROR);
             return false;
         }
         require_once $path;
         if (!class_exists($classname)) {
             debug_add("The class {$classname} was defined as option callback for the field {$this->name} but did not exist.", MIDCOM_LOG_ERROR);
             return false;
         }
         $this->_callback = new $classname($this->option_callback_arg);
         $this->_callback->set_type($this);
         return true;
     } elseif (is_object($this->callback)) {
         $this->_callback =& $this->callback;
         return true;
     }
     // todo check the headers and rows
     return false;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:29,代码来源:table.php

示例7: send

 public function send()
 {
     if (!preg_match('|^https?://|', $this->url)) {
         if ($this->url == '' || substr($this->url, 0, 1) != "/") {
             $prefix = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX);
             if ($prefix == '') {
                 $prefix = midcom::get()->get_page_prefix();
             }
             $this->url = "{$prefix}{$this->url}";
             debug_add("This is a relative URL from the local site, prepending anchor prefix: {$this->url}");
         } else {
             $this->url = midcom::get()->get_host_name() . $this->url;
             debug_add("This is an absolute URL from the local host, prepending host name: {$this->url}");
         }
         $location = "Location: {$this->url}";
     } else {
         // This is an external URL
         $location = "Location: {$this->url}";
     }
     midcom::get('cache')->content->no_cache();
     midcom::get()->finish();
     debug_add("Relocating to {$location}");
     midcom::get()->header($location, $this->code);
     _midcom_stop_request();
 }
开发者ID:nemein,项目名称:openpsa,代码行数:25,代码来源:relocate.php

示例8: _on_execute

 /**
  * Find all old send tokens and clear them.
  */
 public function _on_execute()
 {
     //Disable limits, TODO: think if this could be done in smaller chunks to save memory.
     midcom::get()->disable_limits();
     debug_add('_on_execute called');
     $days = $this->_config->get('send_token_max_age');
     if ($days == 0) {
         debug_add('send_token_max_age evaluates to zero, aborting');
         return;
     }
     $th = time() - $days * 3600 * 24;
     $qb = org_openpsa_directmarketing_campaign_messagereceipt_dba::new_query_builder();
     $qb->add_constraint('token', '<>', '');
     $qb->add_constraint('timestamp', '<', $th);
     $qb->add_constraint('orgOpenpsaObtype', '=', org_openpsa_directmarketing_campaign_messagereceipt_dba::SENT);
     $ret = $qb->execute_unchecked();
     if ($ret === false || !is_array($ret)) {
         //TODO: display some error ?
         return false;
     }
     if (empty($ret)) {
         debug_add('No results, returning early.');
         return;
     }
     foreach ($ret as $receipt) {
         debug_add("clearing token '{$receipt->token}' from receipt #{$receipt->id}");
         $receipt->token = '';
         $stat = $receipt->update();
         if (!$stat) {
             debug_add("FAILED to update receipt #{$receipt->id}, errstr: " . midcom_connection::get_error_string(), MIDCOM_LOG_WARN);
         }
     }
     debug_add('Done');
     return;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:38,代码来源:cleartokens.php

示例9: process_deliverable

 /**
  */
 public function process_deliverable(org_openpsa_sales_salesproject_deliverable_dba $deliverable, $cycle_number = null)
 {
     $this->_deliverable = $deliverable;
     // Recalculate price to catch possible unit changes
     $client_class = midcom_baseclasses_components_configuration::get('org.openpsa.sales', 'config')->get('calculator');
     $client = new $client_class();
     $client->run($this->_deliverable);
     $this_cycle_amount = $client->get_price();
     if ($this_cycle_amount == 0) {
         debug_add('Invoice sum 0, skipping invoice creation');
         return 0;
     }
     $this->_invoice = $this->_probe_invoice($cycle_number);
     if (!$this->_invoice->update()) {
         throw new midcom_error("The invoice could not be saved. Last Midgard error was: " . midcom_connection::get_error_string());
     }
     // TODO: Create invoicing task if assignee is defined
     $items = $client->get_invoice_items($this->_invoice);
     foreach ($items as $item) {
         $item->deliverable = $this->_deliverable->id;
         $item->skip_invoice_update = true;
         if ($item->id) {
             $stat = $item->update();
         } else {
             $stat = $item->create();
         }
         if (!$stat) {
             throw new midcom_error('Failed to save item to disk, ' . midcom_connection::get_error_string());
         }
     }
     org_openpsa_invoices_invoice_item_dba::update_invoice($this->_invoice);
     org_openpsa_invoices_invoice_item_dba::update_deliverable($this->_deliverable);
     return $this_cycle_amount;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:36,代码来源:calculator.php

示例10: _on_execute

 /**
  * Loads all (not-archived) smart campaigns and schedules a separate background update for each
  */
 public function _on_execute()
 {
     debug_add('_on_execute called');
     $qb = org_openpsa_directmarketing_campaign_dba::new_query_builder();
     $qb->add_constraint('archived', '=', 0);
     $qb->add_constraint('orgOpenpsaObtype', '=', org_openpsa_directmarketing_campaign_dba::TYPE_SMART);
     midcom::get('auth')->request_sudo('org.openpsa.directmarketing');
     $ret = $qb->execute();
     midcom::get('auth')->drop_sudo();
     if ($ret === false || !is_array($ret)) {
         //TODO: display some error ?
         return false;
     }
     if (empty($ret)) {
         return;
     }
     $i = 1;
     foreach ($ret as $campaign) {
         $next_time = time() + $i++ * 60;
         debug_add("Scheduling member update for campaign #{$campaign->id} ({$campaign->title}) to happen on " . date('Y-m-d H:i:s', $next_time));
         $stat = $campaign->schedule_update_smart_campaign_members($next_time);
         if (!$stat) {
             //TODO: Display some error ?
         }
     }
     debug_add('Done');
     return;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:31,代码来源:updatemembers.php

示例11: _on_execute

 /**
  * Find all old temporary reports and clear them.
  */
 public function _on_execute()
 {
     //Disable limits, TODO: think if this could be done in smaller chunks to save memory.
     midcom::get()->disable_limits();
     debug_add('_on_execute called');
     $days = $this->_config->get('temporary_report_max_age');
     if ($days == 0) {
         debug_add('temporary_report_max_age evaluates to zero, aborting');
         return;
     }
     $th = time() - $days * 3600 * 24;
     $qb = org_openpsa_reports_query_dba::new_query_builder();
     $qb->add_constraint('metadata.created', '<', $th);
     $qb->add_constraint('orgOpenpsaObtype', '=', ORG_OPENPSA_OBTYPE_REPORT_TEMPORARY);
     $ret = $qb->execute_unchecked();
     if ($ret === false || !is_array($ret)) {
         //TODO: display some error ?
         return false;
     }
     if (empty($ret)) {
         debug_add('No results, returning early.');
         return;
     }
     foreach ($ret as $query) {
         debug_add("removing temporary query #{$query->id}");
         $stat = $query->delete();
         if (!$stat) {
             debug_add("FAILED to delete query #{$query->id}, errstr: " . midcom_connection::get_error_string(), MIDCOM_LOG_WARN);
         }
     }
     debug_add('Done');
     return;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:36,代码来源:clearold.php

示例12: _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

示例13: reopen_account

 /**
  * Function to unblock an account after too many failed to login attempts
  *
  * @param array $args Contains the guid, parameter & parameter names to get username&password
  */
 function reopen_account($args, &$handler)
 {
     midcom::get('auth')->request_sudo($this->_component);
     try {
         $person = new midcom_db_person($args['guid']);
     } catch (midcom_error $e) {
         $msg = 'Person with guid #' . $args['guid'] . ' does not exist';
         debug_add($msg, MIDCOM_LOG_ERROR);
         $handler->print_error($msg);
         midcom::get('auth')->drop_sudo();
         return false;
     }
     $accounthelper = new org_openpsa_user_accounthelper($person);
     try {
         $accounthelper->reopen_account();
     } catch (midcom_error $e) {
         midcom::get('auth')->drop_sudo();
         $e->log();
         $handler->print_error($e->getMessage());
         midcom::get('auth')->drop_sudo();
         return false;
     }
     midcom::get('auth')->drop_sudo();
     return true;
 }
开发者ID:nemein,项目名称:openpsa,代码行数:30,代码来源:interfaces.php

示例14: _handler_move

 /**
  * Handle the moving of a group phase
  *
  * @param mixed $handler_id The ID of the handler.
  * @param Array $args The argument list.
  * @param Array &$data The local request data.
  */
 public function _handler_move($handler_id, array $args, array &$data)
 {
     $data['group'] = new midcom_db_group($args[0]);
     // Get the prefix
     $data['prefix'] = midcom_core_context::get()->get_key(MIDCOM_CONTEXT_ANCHORPREFIX);
     if (isset($_POST['f_cancel'])) {
         return new midcom_response_relocate("__mfa/asgard_midcom.admin.user/group/edit/{$data['group']->guid}/");
     }
     if (isset($_POST['f_submit'])) {
         echo "<pre>\n";
         print_r($_POST);
         echo "</pre>\n";
         $data['group']->owner = (int) $_POST['midcom_admin_user_move_group'];
         if ($data['group']->update()) {
             midcom::get('uimessages')->add($this->_l10n->get('midcom.admin.user'), midcom::get('i18n')->get_string('updated', 'midcom'));
             return new midcom_response_relocate("__mfa/asgard_midcom.admin.user/group/edit/{$data['group']->guid}/");
         } else {
             debug_add('Failed to update the group, last midcom_connection::get_error_string was ' . midgard_connection::get_error_string(), MIDCOM_LOG_ERROR);
             debug_print_r('We operated on this object', $data['group'], MIDCOM_LOG_ERROR);
             throw new midcom_error('Failed to update the group, see error level log for details');
         }
     }
     $data['view_title'] = sprintf($this->_l10n->get('move %s'), $data['group']->official);
     midcom::get('head')->set_pagetitle($data['view_title']);
     $this->_update_breadcrumb($handler_id);
 }
开发者ID:nemein,项目名称:openpsa,代码行数:33,代码来源:list.php

示例15: _handler_trash

 /**
  * Trash view
  *
  * @param mixed $handler_id The ID of the handler.
  * @param Array $args The argument list.
  * @param Array &$data The local request data.
  * @return boolean Indicating success.
  */
 public function _handler_trash($handler_id, array $args, array &$data)
 {
     midcom::get('auth')->require_admin_user();
     midcom::get('cache')->content->no_cache();
     $data['view_title'] = $this->_l10n->get('trash');
     midcom::get('head')->set_pagetitle($data['view_title']);
     $data['types'] = array();
     foreach (midcom_connection::get_schema_types() as $type) {
         if (substr($type, 0, 2) == '__') {
             continue;
         }
         if (class_exists('midgard_reflector_object')) {
             // In Midgard2 we can have objects that don't
             // have metadata. These should not be shown
             // in trash.
             $ref = new midgard_reflector_object($type);
             if (!$ref->has_metadata_class($type)) {
                 debug_add("{$type} has no metadata, skipping", MIDCOM_LOG_DEBUG);
                 continue;
             }
         }
         $qb = new midgard_query_builder($type);
         $qb->include_deleted();
         $qb->add_constraint('metadata.deleted', '=', true);
         $data['types'][$type] = $qb->count();
     }
     // Set the breadcrumb data
     $this->add_breadcrumb('__mfa/asgard/', $this->_l10n->get('midgard.admin.asgard'));
     $this->add_breadcrumb('__mfa/asgard/trash/', $this->_l10n->get('trash'));
 }
开发者ID:nemein,项目名称:openpsa,代码行数:38,代码来源:undelete.php


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