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


PHP fCore::debug方法代码示例

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


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

示例1: email_notify

function email_notify($check,$check_result,$subscription) {
 global $status_array;
 $user = new User($subscription->getUserId());
 echo 'email plugin!';
 $email = new fEmail();
 // This sets up fSMTP to connect to the gmail SMTP server
 // with a 5 second timeout. Gmail requires a secure connection.
 $smtp = new fSMTP('smtp.gmail.com', 465, TRUE, 5);
 $smtp->authenticate('example@example.com', 'example');
 $email->addRecipient($user->getEmail(), $user->getUsername());
 // Set who the email is from
 $email->setFromEmail('flourish@example.com','Tattle');
 // Set the subject include UTF-8 curly quotes
 $email->setSubject('Tattle : Alert for ' . $check->prepareName());
 // Set the body to include a string containing UTF-8
 $state = $status_array[$check_result->getStatus()];
 $email->setHTMLBody("<p>$state Alert for {$check->prepareName()} </p><p>The check returned {$check_result->prepareValue()}</p><p>Warning Threshold is : ". $check->getWarn() . "</p><p>Error Threshold is : ". $check->getError() . '</p><p>View Alert Details : <a href="' . $fURL::getDomain() . '/' . CheckResult::makeURL('list',$check_result) . '">'.$check->prepareName()."</a></p>");
 $email->setBody("
$state Alert for {$check->prepareName()}
The check returned {$check_result->prepareValue()}
Warning Threshold is : ". $check->getWarn() . "
Error Threshold is : ". $check->getError() . "
           ");
 try {  
   $message_id = $email->send($smtp);
 } catch ( fConnectivityException $e) { 
   fCore::debug("email send failed",FALSE);
 }


}
开发者ID:rberger,项目名称:Graphite-Tattle,代码行数:31,代码来源:email_plugin.php

示例2: email_plugin_notify

function email_plugin_notify($check,$check_result,$subscription,$alt_email=false) {
  global $status_array;
  $user = new User($subscription->getUserId());
  $email = new fEmail();
  // This sets up fSMTP to connect to the gmail SMTP server
  // with a 5 second timeout. Gmail requires a secure connection.
  $smtp = new fSMTP(sys_var('smtp_server'), sys_var('smtp_port'), TRUE, 5);
  $smtp->authenticate(sys_var('smtp_user'), sys_var('smtp_pass'));
  if ($alt_email) {
    $email_address = usr_var('alt_email',$user->getUserId());
  } else {
    $email_address = $user->getEmail(); 
  }
  $email->addRecipient($email_address, $user->getUsername());
  // Set who the email is from
  $email->setFromEmail(sys_var('email_from'), sys_var('email_from_display'));
  // Set the subject include UTF-8 curly quotes
  $email->setSubject(str_replace('{check_name}', $check->prepareName(), sys_var('email_subject')));
  // Set the body to include a string containing UTF-8
  $state = $status_array[$check_result->getStatus()];
  $email->setHTMLBody("<p>$state Alert for {$check->prepareName()} </p><p>The check returned {$check_result->prepareValue()}</p><p>Warning Threshold is : ". $check->getWarn() . "</p><p>Error Threshold is : ". $check->getError() . '</p><p>View Alert Details : <a href="' . fURL::getDomain() . '/' . CheckResult::makeURL('list',$check_result) . '">'.$check->prepareName()."</a></p>");
  $email->setBody("
  $state Alert for {$check->prepareName()}
The check returned {$check_result->prepareValue()}
Warning Threshold is : ". $check->getWarn() . "
Error Threshold is : ". $check->getError() . "
           ");
  try {  
    $message_id = $email->send($smtp);
  } catch ( fConnectivityException $e) { 
    fCore::debug("email send failed",FALSE);
  }
}
开发者ID:nleskiw,项目名称:Graphite-Tattle,代码行数:33,代码来源:email_plugin.php

示例3: testDebug

 /**
  * @dataProvider debugProvider
  */
 public function testDebug($value, $force, $global, $expected_output)
 {
     ob_start();
     if ($global) {
         fCore::enableDebugging(TRUE);
     }
     fCore::debug($value, $force);
     $output = ob_get_clean();
     $this->assertEquals($expected_output, rtrim($output, "\n"));
 }
开发者ID:nurulimamnotes,项目名称:flourish-old,代码行数:13,代码来源:fCoreTest.php

示例4: hipchat_master_notify

function hipchat_master_notify($check, $check_result, $subscription, $toUser = true)
{
    global $status_array;
    global $debug;
    if (!is_callable('curl_init')) {
        fCore::debug("!!! WARNING !!! function curl_init() not found, probably php-curl is not installed");
    }
    $state = $status_array[$check_result->getStatus()];
    if (strtolower($state) == 'ok') {
        $color = sys_var('hipchat_ok_color');
    } elseif (strtolower($state) == 'warning') {
        $color = sys_var('hipchat_warning_color');
    } elseif (strtolower($state) == 'error') {
        $color = sys_var('hipchat_error_color');
    }
    $url = $GLOBALS['TATTLE_DOMAIN'] . '/' . CheckResult::makeURL('list', $check_result);
    $data = array('color' => $color, 'notify' => sys_var('hipchat_notify') == 'true' ? true : false, 'message_format' => 'html', 'message' => "<b>" . $check->prepareName() . "</b><br />The check returned: {$check_result->getValue()}<br />View Alert Details : <a href=\"" . $url . "\">" . $url . "</a>");
    if ($debug && $toUser == false) {
        $url = 'https://api.hipchat.com/v2/room?auth_token=' . sys_var('hipchat_apikey');
        $c = curl_init();
        curl_setopt($c, CURLOPT_URL, $url);
        curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
        fCore::debug("Rooms: " . curl_exec($c) . "\n", FALSE);
        fCore::debug("URL: " . 'https://api.hipchat.com/v2/room/' . strtolower(sys_var('hipchat_room')) . '/notification?auth_token=' . sys_var('hipchat_apikey') . "\n", FALSE);
        fCore::debug("Data: " . print_r($data, true) . "\n", FALSE);
    }
    if ($toUser == false) {
        $url = 'https://api.hipchat.com/v2/room/' . strtolower(sys_var('hipchat_room')) . '/notification?auth_token=' . sys_var('hipchat_apikey');
    } else {
        $url = 'https://api.hipchat.com/v2/user/' . usr_var('hipchat_user', $subscription->getUserId()) . '/message?auth_token=' . sys_var('hipchat_apikey');
    }
    fCore::debug("HipChat Calling: {$url}", FALSE);
    $c = curl_init();
    curl_setopt($c, CURLOPT_URL, $url);
    curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($c, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen(json_encode($data))));
    curl_setopt($c, CURLOPT_POSTFIELDS, json_encode($data));
    $response = curl_exec($c);
    if ($response === false) {
        fCore::debug("Curl error: " . curl_error($c) . "\n", FALSE);
    }
    echo "\n\nResponse: " . curl_getinfo($c, CURLINFO_HTTP_CODE) . ' - ' . $response . "\n\n";
}
开发者ID:nagyist,项目名称:Tattle,代码行数:43,代码来源:hipchat_plugin.php

示例5: translate

 /**
  * Translates Flourish SQL into the dialect for the current database
  * 
  * @internal
  * 
  * @param  array $statements  The SQL statements to translate
  * @return array  The translated SQL statements all ready for execution. Statements that have been translated will have string key of the number, `:` and the original SQL, all other will have a numeric key.
  */
 public function translate($statements)
 {
     $output = array();
     foreach ($statements as $number => $sql) {
         // These fixes don't need to know about strings
         $new_sql = $this->translateBasicSyntax($sql);
         if (in_array($this->database->getType(), array('mssql', 'oracle', 'db2'))) {
             $new_sql = $this->translateLimitOffsetToRowNumber($new_sql);
         }
         // SQL Server does not like to give unicode results back to PHP without some coersion
         if ($this->database->getType() == 'mssql') {
             $new_sql = $this->fixMSSQLNationalColumns($new_sql);
         }
         // Oracle has this nasty habit of silently translating empty strings to null
         if ($this->database->getType() == 'oracle') {
             $new_sql = $this->fixOracleEmptyStrings($new_sql);
         }
         $extra_statements = array();
         $new_sql = $this->translateCreateTableStatements($new_sql, $extra_statements);
         if ($sql != $new_sql || $extra_statements) {
             fCore::debug(self::compose("Original SQL:%s", "\n" . $sql), $this->debug);
             $translated_sql = $new_sql;
             if ($extra_statements) {
                 $translated_sql .= '; ' . join('; ', $extra_statements);
             }
             fCore::debug(self::compose("Translated SQL:%s", "\n" . $translated_sql), $this->debug);
         }
         $output = array_merge($output, array($number . ':' . $sql => $new_sql), $extra_statements);
     }
     return $output;
 }
开发者ID:JhunCabas,项目名称:material-management,代码行数:39,代码来源:fSQLTranslation.php

示例6: runQuery

 /**
  * Runs a single query and times it, removes any old unbuffered queries before starting
  * 
  * @param  string $sql          The SQL statement to execute
  * @param  string $result_type  The type of result object to return, fResult or fUnbufferedResult
  * @return fResult|fUnbufferedResult  The result for the query
  */
 private function runQuery($sql, $result_type)
 {
     if ($this->unbuffered_result) {
         $this->unbuffered_result->__destruct();
         $this->unbuffered_result = NULL;
     }
     $start_time = microtime(TRUE);
     if (!($result = $this->handleTransactionQueries($sql, $result_type))) {
         $result = new $result_type($this, $this->type == 'mssql' ? $this->schema_info['character_set'] : NULL);
         $result->setSQL($sql);
         if ($result_type == 'fResult') {
             $this->executeQuery($result);
         } else {
             $this->executeUnbufferedQuery($result);
         }
     }
     // Write some debugging info
     $query_time = microtime(TRUE) - $start_time;
     $this->query_time += $query_time;
     fCore::debug(self::compose('Query time was %1$s seconds for:%2$s', $query_time, "\n" . $result->getSQL()), $this->debug);
     if ($this->slow_query_threshold && $query_time > $this->slow_query_threshold) {
         trigger_error(self::compose('The following query took %1$s milliseconds, which is above the slow query threshold of %2$s:%3$s', $query_time, $this->slow_query_threshold, "\n" . $result->getSQL()), E_USER_WARNING);
     }
     return $result;
 }
开发者ID:jsuarez,项目名称:MyDesign,代码行数:32,代码来源:fDatabase.php

示例7: write

 /**
  * Sends commands to the IMAP or POP3 server
  * 
  * @param  string  $command   The command to send
  * @param  integer $expected  The number of lines or regex expected for a POP3 command
  * @return array  The response from the server
  */
 private function write($command, $expected = NULL)
 {
     if (!$this->connection) {
         throw new fProgrammerException('Unable to send data since the connection has already been closed');
     }
     if ($this->type == 'imap') {
         $identifier = 'a' . str_pad($this->command_num++, 4, '0', STR_PAD_LEFT);
         $command = $identifier . ' ' . $command;
     }
     if (substr($command, -2) != "\r\n") {
         $command .= "\r\n";
     }
     if (fCore::getDebug($this->debug)) {
         fCore::debug("Sending:\n" . trim($command), $this->debug);
     }
     $res = fwrite($this->connection, $command);
     if ($res === FALSE) {
         throw new fConnectivityException('Unable to write data to %1$s server %2$s on port %3$s', strtoupper($this->type), $this->host, $this->port);
     }
     if ($this->type == 'imap') {
         return $this->read('#^' . $identifier . '#');
     } elseif ($this->type == 'pop3') {
         return $this->read($expected);
     }
 }
开发者ID:philip,项目名称:flourish,代码行数:32,代码来源:fMailbox.php

示例8: translate

 /**
  * Translates Flourish SQL into the dialect for the current database
  * 
  * @internal
  * 
  * @param  array $statements            The SQL statements to translate
  * @param  array &$rollback_statements  SQL statements to rollback the returned SQL statements if something goes wrong - only applicable for MySQL `ALTER TABLE` statements
  * @return array  The translated SQL statements all ready for execution. Statements that have been translated will have string key of the number, `:` and the original SQL, all other will have a numeric key.
  */
 public function translate($statements, &$rollback_statements = NULL)
 {
     $output = array();
     foreach ($statements as $number => $sql) {
         $new_sql = $this->translateBasicSyntax($sql);
         $new_sql = $this->translateCastClauses($new_sql);
         if (in_array($this->database->getType(), array('mssql', 'oracle', 'db2'))) {
             $new_sql = $this->translateLimitOffsetToRowNumber($new_sql);
         }
         // SQL Server does not like to give unicode results back to PHP without some coersion
         if ($this->database->getType() == 'mssql') {
             $new_sql = $this->fixMSSQLNationalColumns($new_sql);
         }
         if ($this->database->getType() == 'oracle') {
             // Oracle has this nasty habit of silently translating empty strings to null
             $new_sql = $this->fixOracleEmptyStrings($new_sql);
             $new_sql = $this->uppercaseIdentifiers($new_sql);
         }
         if ($this->database->getType() == 'db2') {
             $new_sql = $this->uppercaseIdentifiers($new_sql);
         }
         $extra_statements = array();
         if (preg_match('#^\\s*(CREATE|DROP|ALTER|COMMENT)\\b#i', $new_sql)) {
             if (!isset($this->schema_translation)) {
                 $this->schema_translation = new fSQLSchemaTranslation($this->database);
             }
             list($new_sql, $extra_statements) = $this->schema_translation->translate($new_sql, $rollback_statements);
         }
         if ($sql != $new_sql || $extra_statements) {
             fCore::debug(self::compose("Original SQL:%s", "\n" . $sql), $this->debug);
             $translated_sql = $new_sql;
             if ($extra_statements) {
                 $translated_sql .= '; ' . join('; ', $extra_statements);
             }
             fCore::debug(self::compose("Translated SQL:%s", "\n" . $translated_sql), $this->debug);
         }
         $output = array_merge($output, array($number . ':' . $sql => $new_sql), array_values($extra_statements));
     }
     return $output;
 }
开发者ID:mrjwc,项目名称:printmaster,代码行数:49,代码来源:fSQLTranslation.php

示例9: notify_multiple_users

function notify_multiple_users($user_from, $recipients, $subject, $body)
{
    $email = new fEmail();
    // This sets up fSMTP to connect to the gmail SMTP server
    // with a 5 second timeout. Gmail requires a secure connection.
    $smtp = new fSMTP(sys_var('smtp_server'), sys_var('smtp_port'), sys_var('require_ssl') === 'true' ? TRUE : FALSE, 5);
    if (sys_var('require_auth') === 'true') {
        $smtp->authenticate(sys_var('smtp_user'), sys_var('smtp_pass'));
    }
    // Add the recipients
    foreach ($recipients as $rec) {
        $email->addRecipient($rec['mail'], $rec['name']);
    }
    // Set who the email is from
    $email->setFromEmail($user_from->getEmail(), $user_from->getUsername());
    // Set the subject
    $email->setSubject($subject);
    // Set the body
    $email->setHTMLBody($body);
    $email->setBody($body);
    try {
        $message_id = $email->send($smtp);
    } catch (fConnectivityException $e) {
        fCore::debug($e, FALSE);
        fCore::debug("email send failed", FALSE);
        $e->printMessage();
        $e->printTrace();
    }
}
开发者ID:nagyist,项目名称:Tattle,代码行数:29,代码来源:email_plugin.php

示例10: reset

 /**
  * Resets the configuration of the class
  * 
  * @internal
  * 
  * @return void
  */
 public static function reset()
 {
     if (self::$handles_errors) {
         restore_error_handler();
     }
     if (self::$handles_exceptions) {
         restore_exception_handler();
     }
     if (is_array(self::$captured_errors)) {
         restore_error_handler();
     }
     self::$captured_error_regex = NULL;
     self::$captured_errors_previous_handler = NULL;
     self::$captured_error_types = NULL;
     self::$captured_errors = NULL;
     self::$context_shown = FALSE;
     self::$debug = NULL;
     self::$debug_callback = NULL;
     self::$dynamic_constants = FALSE;
     self::$error_destination = 'html';
     self::$error_message_queue = array();
     self::$exception_destination = 'html';
     self::$exception_handler_callback = NULL;
     self::$exception_handler_parameters = array();
     self::$exception_message = NULL;
     self::$handles_errors = FALSE;
     self::$handles_exceptions = FALSE;
     self::$show_context = TRUE;
 }
开发者ID:russss,项目名称:hackspace-foundation-sites,代码行数:36,代码来源:fCore.php

示例11: setResultsLevel

 /**
  * Creates all Check related URLs for the site
  *
  * @param  string $type  The type of URL to make: 'list', 'add', 'edit', 'delete'
  * @param  Meetup $obj   The Check object for the edit and delete URL types
  * @return string  The URL requested
  */
 public static function setResultsLevel($value, $obj = NULL)
 {
     if ($obj->getOverUnder() == 0) {
         if ($value >= $obj->getError()) {
             $state = 1;
         } elseif ($value >= $obj->getWarn()) {
             $state = 2;
         } else {
             //echo 'all good ' . " $value <br />";
             $state = 0;
         }
         return $state;
     }
     if ($obj->getOverUnder() == 1) {
         if ($value > $obj->getWarn()) {
             $state = 0;
         } elseif ($value > $obj->getError()) {
             $state = 2;
         } else {
             fCore::debug('error state' . " {$value} compared to " . $obj->getError() . "<br />", FALSE);
             $state = 1;
         }
         return $state;
     }
 }
开发者ID:nagyist,项目名称:Tattle,代码行数:32,代码来源:Check.php

示例12: reset

 /**
  * Resets the configuration of the class
  * 
  * @internal
  * 
  * @return void
  */
 public static function reset()
 {
     restore_error_handler();
     restore_exception_handler();
     self::$context_shown = FALSE;
     self::$debug = NULL;
     self::$debug_callback = NULL;
     self::$dynamic_constants = FALSE;
     self::$error_destination = 'html';
     self::$error_message_queue = array();
     self::$exception_destination = 'html';
     self::$exception_handler_callback = NULL;
     self::$exception_handler_parameters = array();
     self::$exception_message = NULL;
     self::$handles_errors = FALSE;
     self::$show_context = TRUE;
 }
开发者ID:philip,项目名称:flourish,代码行数:24,代码来源:fCore.php

示例13: write

 /**
  * Sends raw text/commands to the SMTP server
  * 
  * @param  string         $data    The data or commands to send
  * @param  integer|string $expect  The expected number of lines of response or a regex of the last line
  * @return array  The response from the server
  */
 private function write($data, $expect)
 {
     if (!$this->connection) {
         throw new fProgrammerException('Unable to send data since the connection has already been closed');
     }
     if (substr($data, -2) != "\r\n") {
         $data .= "\r\n";
     }
     if (fCore::getDebug($this->debug)) {
         fCore::debug("Sending:\n" . trim($data), $this->debug);
     }
     $res = fwrite($this->connection, $data);
     if ($res === FALSE || $res === 0) {
         throw new fConnectivityException('Unable to write data to SMTP server %1$s on port %2$s', $this->host, $this->port);
     }
     $response = $this->read($expect);
     return $response;
 }
开发者ID:mrjwc,项目名称:printmaster,代码行数:25,代码来源:fSMTP.php

示例14: translate

 /**
  * Translates Flourish SQL into the dialect for the current database
  * 
  * @internal
  * 
  * @param  array $statements  The SQL statements to translate
  * @param  array $strings     The strings to interpolate back into the SQL statements
  * @return array  The translated SQL statements all ready for execution. Statements that have been translated will have string key of the original SQL, all other will have a numeric key.
  */
 public function translate($statements, $strings)
 {
     $output = array();
     foreach ($statements as $number => $sql) {
         // These fixes don't need to know about strings
         $new_sql = $this->translateBasicSyntax($sql);
         if ($this->database->getType() == 'mssql' || $this->database->getType() == 'oracle') {
             $new_sql = $this->translateLimitOffsetToRowNumber($new_sql);
         }
         // SQL Server does not like to give unicode results back to PHP without some coersion
         if ($this->database->getType() == 'mssql') {
             $new_sql = $this->fixMSSQLNationalColumns($new_sql);
         }
         // Oracle has this nasty habit of silently translating empty strings to null
         if ($this->database->getType() == 'oracle') {
             $new_sql = $this->fixOracleEmptyStrings($new_sql, $strings[$number]);
         }
         // Unescape literal semicolons in the queries
         $sql = preg_replace('#(?<!\\\\)\\\\;#', ';', $sql);
         $new_sql = preg_replace('#(?<!\\\\)\\\\;#', ';', $new_sql);
         $extra_statements = array();
         $new_sql = $this->translateCreateTableStatements($new_sql, $extra_statements);
         // Put the strings back into the SQL
         foreach ($strings[$number] as $index => $string) {
             $string = strtr($string, array('\\' => '\\\\', '$' => '\\$'));
             $sql = preg_replace('#:string_' . $index . '\\b#', $string, $sql, 1);
             $new_sql = preg_replace('#:string_' . $index . '\\b#', $string, $new_sql, 1);
         }
         $new_sql = $this->translateDateFunctions($new_sql);
         if ($sql != $new_sql || $extra_statements) {
             fCore::debug(self::compose("Original SQL:%s", "\n" . $sql), $this->debug);
             $translated_sql = $new_sql;
             if ($extra_statements) {
                 $translated_sql .= '; ' . join('; ', $extra_statements);
             }
             fCore::debug(self::compose("Translated SQL:%s", "\n" . $translated_sql), $this->debug);
         }
         $output = array_merge($output, array($sql => $new_sql), $extra_statements);
     }
     return $output;
 }
开发者ID:jsuarez,项目名称:MyDesign,代码行数:50,代码来源:fSQLTranslation.php

示例15: CheckResult

            fCore::debug("next check is lt then now\n", FALSE);
        } else {
            fCore::debug("not less then now\n", FALSE);
        }
        // If It's been more then the Repeat Delay or the Status has changed
        if ($next_check->lt($end) || $check->getLastCheckStatus() != $result) {
            fCore::debug("Send Notification \n", FALSE);
            fCore::debug("State :" . $result . ":\n", FALSE);
            $check_result = new CheckResult();
            $check_result->setCheckId($check->getCheckId());
            $check_result->setStatus($result);
            $check_result->setValue($check_value);
            $check_result->setState(0);
            $check->setLastCheckStatus($result);
            $check->setLastCheckValue($check_value);
            $check->setLastCheckTime($end);
            $check_result->store();
            $check->store();
            $subscriptions = Subscription::findAll($check->getCheckId());
            foreach ($subscriptions as $subscription) {
                $notify_function = $subscription->getMethod() . '_notify';
                if (function_exists($notify_function)) {
                    $notify_result = $notify_function($check, $check_result, $subscription);
                }
            }
        } else {
            fCore::debug("Skip Notification \n", FALSE);
        }
    }
    fCore::debug("check done moving to next \n\n", FALSE);
}
开发者ID:rberger,项目名称:Graphite-Tattle,代码行数:31,代码来源:processor.php


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