• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP set_debugging函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_debugging

 public function test_debugging()
 {
     global $CFG;
     $this->resetAfterTest();
     debugging('hokus');
     $this->assertDebuggingCalled();
     debugging('pokus');
     $this->assertDebuggingCalled('pokus');
     debugging('pokus', DEBUG_MINIMAL);
     $this->assertDebuggingCalled('pokus', DEBUG_MINIMAL);
     $this->assertDebuggingNotCalled();
     debugging('a');
     debugging('b', DEBUG_MINIMAL);
     debugging('c', DEBUG_DEVELOPER);
     $debuggings = $this->getDebuggingMessages();
     $this->assertCount(3, $debuggings);
     $this->assertSame('a', $debuggings[0]->message);
     $this->assertSame(DEBUG_NORMAL, $debuggings[0]->level);
     $this->assertSame('b', $debuggings[1]->message);
     $this->assertSame(DEBUG_MINIMAL, $debuggings[1]->level);
     $this->assertSame('c', $debuggings[2]->message);
     $this->assertSame(DEBUG_DEVELOPER, $debuggings[2]->level);
     $this->resetDebugging();
     $this->assertDebuggingNotCalled();
     $debuggings = $this->getDebuggingMessages();
     $this->assertCount(0, $debuggings);
     set_debugging(DEBUG_NONE);
     debugging('hokus');
     $this->assertDebuggingNotCalled();
     set_debugging(DEBUG_DEVELOPER);
 }
开发者ID:rushi963,项目名称:moodle,代码行数:31,代码来源:advanced_test.php


示例2: cron_run

/**
 * Execute cron tasks
 */
function cron_run()
{
    global $DB, $CFG, $OUTPUT;
    if (CLI_MAINTENANCE) {
        echo "CLI maintenance mode active, cron execution suspended.\n";
        exit(1);
    }
    if (moodle_needs_upgrading()) {
        echo "Moodle upgrade pending, cron execution suspended.\n";
        exit(1);
    }
    require_once $CFG->libdir . '/adminlib.php';
    require_once $CFG->libdir . '/gradelib.php';
    if (!empty($CFG->showcronsql)) {
        $DB->set_debug(true);
    }
    if (!empty($CFG->showcrondebugging)) {
        set_debugging(DEBUG_DEVELOPER, true);
    }
    set_time_limit(0);
    $starttime = microtime();
    // Increase memory limit
    raise_memory_limit(MEMORY_EXTRA);
    // Emulate normal session - we use admin accoutn by default
    cron_setup_user();
    // Start output log
    $timenow = time();
    mtrace("Server Time: " . date('r', $timenow) . "\n\n");
    // Run cleanup core cron jobs, but not every time since they aren't too important.
    // These don't have a timer to reduce load, so we'll use a random number
    // to randomly choose the percentage of times we should run these jobs.
    $random100 = rand(0, 100);
    if ($random100 < 20) {
        // Approximately 20% of the time.
        mtrace("Running clean-up tasks...");
        cron_trace_time_and_memory();
        // Delete users who haven't confirmed within required period
        if (!empty($CFG->deleteunconfirmed)) {
            $cuttime = $timenow - $CFG->deleteunconfirmed * 3600;
            $rs = $DB->get_recordset_sql("SELECT *\n                                             FROM {user}\n                                            WHERE confirmed = 0 AND firstaccess > 0\n                                                  AND firstaccess < ?", array($cuttime));
            foreach ($rs as $user) {
                delete_user($user);
                // we MUST delete user properly first
                $DB->delete_records('user', array('id' => $user->id));
                // this is a bloody hack, but it might work
                mtrace(" Deleted unconfirmed user for " . fullname($user, true) . " ({$user->id})");
            }
            $rs->close();
        }
        // Delete users who haven't completed profile within required period
        if (!empty($CFG->deleteincompleteusers)) {
            $cuttime = $timenow - $CFG->deleteincompleteusers * 3600;
            $rs = $DB->get_recordset_sql("SELECT *\n                                             FROM {user}\n                                            WHERE confirmed = 1 AND lastaccess > 0\n                                                  AND lastaccess < ? AND deleted = 0\n                                                  AND (lastname = '' OR firstname = '' OR email = '')", array($cuttime));
            foreach ($rs as $user) {
                if (isguestuser($user) or is_siteadmin($user)) {
                    continue;
                }
                delete_user($user);
                mtrace(" Deleted not fully setup user {$user->username} ({$user->id})");
            }
            $rs->close();
        }
        // Delete old logs to save space (this might need a timer to slow it down...)
        if (!empty($CFG->loglifetime)) {
            // value in days
            $loglifetime = $timenow - $CFG->loglifetime * 3600 * 24;
            $DB->delete_records_select("log", "time < ?", array($loglifetime));
            mtrace(" Deleted old log records");
        }
        // Delete old backup_controllers and logs.
        $loglifetime = get_config('backup', 'loglifetime');
        if (!empty($loglifetime)) {
            // Value in days.
            $loglifetime = $timenow - $loglifetime * 3600 * 24;
            // Delete child records from backup_logs.
            $DB->execute("DELETE FROM {backup_logs}\n                           WHERE EXISTS (\n                               SELECT 'x'\n                                 FROM {backup_controllers} bc\n                                WHERE bc.backupid = {backup_logs}.backupid\n                                  AND bc.timecreated < ?)", array($loglifetime));
            // Delete records from backup_controllers.
            $DB->execute("DELETE FROM {backup_controllers}\n                          WHERE timecreated < ?", array($loglifetime));
            mtrace(" Deleted old backup records");
        }
        // Delete old cached texts
        if (!empty($CFG->cachetext)) {
            // Defined in config.php
            $cachelifetime = time() - $CFG->cachetext - 60;
            // Add an extra minute to allow for really heavy sites
            $DB->delete_records_select('cache_text', "timemodified < ?", array($cachelifetime));
            mtrace(" Deleted old cache_text records");
        }
        if (!empty($CFG->usetags)) {
            require_once $CFG->dirroot . '/tag/lib.php';
            tag_cron();
            mtrace(' Executed tag cron');
        }
        // Context maintenance stuff
        context_helper::cleanup_instances();
        mtrace(' Cleaned up context instances');
        context_helper::build_all_paths(false);
//.........这里部分代码省略.........
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:101,代码来源:cronlib.php


示例3: reset_debugging

 /**
  * Resets the list of debugging messages.
  */
 public static function reset_debugging()
 {
     self::$debuggings = array();
     set_debugging(DEBUG_DEVELOPER);
 }
开发者ID:sumitnegi933,项目名称:Moodle_lms_New,代码行数:8,代码来源:util.php


示例4: test_set_debugging

 public function test_set_debugging()
 {
     global $CFG;
     $this->resetAfterTest();
     $this->assertEquals(DEBUG_DEVELOPER, $CFG->debug);
     $this->assertTrue($CFG->debugdeveloper);
     $this->assertNotEmpty($CFG->debugdisplay);
     set_debugging(DEBUG_DEVELOPER, true);
     $this->assertEquals(DEBUG_DEVELOPER, $CFG->debug);
     $this->assertTrue($CFG->debugdeveloper);
     $this->assertNotEmpty($CFG->debugdisplay);
     set_debugging(DEBUG_DEVELOPER, false);
     $this->assertEquals(DEBUG_DEVELOPER, $CFG->debug);
     $this->assertTrue($CFG->debugdeveloper);
     $this->assertEmpty($CFG->debugdisplay);
     set_debugging(-1);
     $this->assertEquals(-1, $CFG->debug);
     $this->assertTrue($CFG->debugdeveloper);
     set_debugging(DEBUG_ALL);
     $this->assertEquals(DEBUG_ALL, $CFG->debug);
     $this->assertFalse($CFG->debugdeveloper);
     set_debugging(DEBUG_NORMAL);
     $this->assertEquals(DEBUG_NORMAL, $CFG->debug);
     $this->assertFalse($CFG->debugdeveloper);
     set_debugging(DEBUG_MINIMAL);
     $this->assertEquals(DEBUG_MINIMAL, $CFG->debug);
     $this->assertFalse($CFG->debugdeveloper);
     set_debugging(DEBUG_NONE);
     $this->assertEquals(DEBUG_NONE, $CFG->debug);
     $this->assertFalse($CFG->debugdeveloper);
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:31,代码来源:weblib_test.php


示例5: upgrade_handle_exception

/**
 * upgrade logging functions
 */
function upgrade_handle_exception($ex, $plugin = null) {
    global $CFG;

    // rollback everything, we need to log all upgrade problems
    abort_all_db_transactions();

    $info = get_exception_info($ex);

    // First log upgrade error
    upgrade_log(UPGRADE_LOG_ERROR, $plugin, 'Exception: ' . get_class($ex), $info->message, $info->backtrace);

    // Always turn on debugging - admins need to know what is going on
    set_debugging(DEBUG_DEVELOPER, true);

    default_exception_handler($ex, true, $plugin);
}
开发者ID:jtibbetts,项目名称:moodle,代码行数:19,代码来源:upgradelib.php


示例6: test_output_capture_error_debugdeveloper

 public function test_output_capture_error_debugdeveloper()
 {
     // With DEBUG_DEVELOPER set, we should throw an exception.
     set_debugging(DEBUG_DEVELOPER);
     $this->helper_test_dirty_output(true);
 }
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:6,代码来源:ajaxlib_test.php


示例7: test_problematic_events

 public function test_problematic_events()
 {
     global $CFG;
     $event1 = \core_tests\event\problematic_event1::create(array('context' => \context_system::instance()));
     $this->assertDebuggingNotCalled();
     $this->assertNull($event1->xxx);
     $this->assertDebuggingCalled();
     $event2 = \core_tests\event\problematic_event1::create(array('xxx' => 0, 'context' => \context_system::instance()));
     $this->assertDebuggingCalled();
     set_debugging(DEBUG_NONE);
     $event3 = \core_tests\event\problematic_event1::create(array('xxx' => 0, 'context' => \context_system::instance()));
     $this->assertDebuggingNotCalled();
     set_debugging(DEBUG_DEVELOPER);
     $event4 = \core_tests\event\problematic_event1::create(array('context' => \context_system::instance(), 'other' => array('a' => 1)));
     $event4->trigger();
     $this->assertDebuggingNotCalled();
     $event5 = \core_tests\event\problematic_event1::create(array('context' => \context_system::instance(), 'other' => (object) array('a' => 1)));
     $this->assertDebuggingNotCalled();
     $event5->trigger();
     $this->assertDebuggingCalled();
     $url = new moodle_url('/admin/');
     $event6 = \core_tests\event\problematic_event1::create(array('context' => \context_system::instance(), 'other' => array('a' => $url)));
     $this->assertDebuggingNotCalled();
     $event6->trigger();
     $this->assertDebuggingCalled();
     // Check that whole float numbers do not trigger debugging messages.
     $event7 = \core_tests\event\unittest_executed::create(array('courseid' => 1, 'context' => \context_system::instance(), 'other' => array('wholenumber' => 90.0, 'numberwithdecimals' => 54.7656, 'sample' => 1)));
     $event7->trigger();
     $this->assertDebuggingNotCalled();
     $event = \core_tests\event\problematic_event2::create(array());
     $this->assertDebuggingNotCalled();
     $event = \core_tests\event\problematic_event2::create(array('context' => \context_system::instance()));
     $this->assertDebuggingCalled();
     $event = \core_tests\event\problematic_event3::create(array('other' => 1));
     $this->assertDebuggingNotCalled();
     $event = \core_tests\event\problematic_event3::create(array());
     $this->assertDebuggingCalled();
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:38,代码来源:event_test.php


示例8: test_get_record_sql

 public function test_get_record_sql()
 {
     $DB = $this->tdb;
     $dbman = $DB->get_manager();
     $table = $this->get_test_table();
     $tablename = $table->getName();
     $table->add_field('id', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, XMLDB_SEQUENCE, null);
     $table->add_field('course', XMLDB_TYPE_INTEGER, '10', null, XMLDB_NOTNULL, null, '0');
     $table->add_key('primary', XMLDB_KEY_PRIMARY, array('id'));
     $dbman->create_table($table);
     $DB->insert_record($tablename, array('course' => 3));
     $DB->insert_record($tablename, array('course' => 2));
     // Standard use.
     $record = $DB->get_record_sql("SELECT * FROM {{$tablename}} WHERE id = ?", array(2));
     $this->assertInstanceOf('stdClass', $record);
     $this->assertEquals(2, $record->course);
     $this->assertEquals(2, $record->id);
     // Backwards compatibility with $ignoremultiple.
     $this->assertFalse((bool) IGNORE_MISSING);
     $this->assertTrue((bool) IGNORE_MULTIPLE);
     // Record not found - ignore.
     $this->assertFalse($DB->get_record_sql("SELECT * FROM {{$tablename}} WHERE id = ?", array(666), IGNORE_MISSING));
     $this->assertFalse($DB->get_record_sql("SELECT * FROM {{$tablename}} WHERE id = ?", array(666), IGNORE_MULTIPLE));
     // Record not found error.
     try {
         $DB->get_record_sql("SELECT * FROM {{$tablename}} WHERE id = ?", array(666), MUST_EXIST);
         $this->fail("Exception expected");
     } catch (dml_missing_record_exception $e) {
         $this->assertTrue(true);
     }
     $this->assertNotEmpty($DB->get_record_sql("SELECT * FROM {{$tablename}}", array(), IGNORE_MISSING));
     $this->assertDebuggingCalled();
     set_debugging(DEBUG_MINIMAL);
     $this->assertNotEmpty($DB->get_record_sql("SELECT * FROM {{$tablename}}", array(), IGNORE_MISSING));
     $this->assertDebuggingNotCalled();
     set_debugging(DEBUG_DEVELOPER);
     // Multiple matches ignored.
     $this->assertNotEmpty($DB->get_record_sql("SELECT * FROM {{$tablename}}", array(), IGNORE_MULTIPLE));
     // Multiple found error.
     try {
         $DB->get_record_sql("SELECT * FROM {{$tablename}}", array(), MUST_EXIST);
         $this->fail("Exception expected");
     } catch (dml_multiple_records_exception $e) {
         $this->assertTrue(true);
     }
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:46,代码来源:dml_test.php


示例9: test_statslib_progress_no_debug

 /**
  * Test progress output when debug is off.
  */
 public function test_statslib_progress_no_debug()
 {
     set_debugging(DEBUG_NONE);
     $this->expectOutputString('.');
     stats_progress('init');
     stats_progress('1');
     $this->resetDebugging();
 }
开发者ID:Hirenvaghasiya,项目名称:moodle,代码行数:11,代码来源:statslib_test.php


示例10: test_problematic_events

 public function test_problematic_events()
 {
     global $CFG;
     $event1 = \core_tests\event\problematic_event1::create(array('context' => \context_system::instance()));
     $this->assertDebuggingNotCalled();
     $this->assertNull($event1->xxx);
     $this->assertDebuggingCalled();
     $event2 = \core_tests\event\problematic_event1::create(array('xxx' => 0, 'context' => \context_system::instance()));
     $this->assertDebuggingCalled();
     set_debugging(DEBUG_NONE);
     $event3 = \core_tests\event\problematic_event1::create(array('xxx' => 0, 'context' => \context_system::instance()));
     $this->assertDebuggingNotCalled();
     set_debugging(DEBUG_DEVELOPER);
     $event4 = \core_tests\event\problematic_event1::create(array('context' => \context_system::instance(), 'other' => array('a' => 1)));
     $event4->trigger();
     $this->assertDebuggingNotCalled();
     $event5 = \core_tests\event\problematic_event1::create(array('context' => \context_system::instance(), 'other' => (object) array('a' => 1)));
     $this->assertDebuggingNotCalled();
     $event5->trigger();
     $this->assertDebuggingCalled();
     $url = new moodle_url('/admin/');
     $event6 = \core_tests\event\problematic_event1::create(array('context' => \context_system::instance(), 'other' => array('a' => $url)));
     $this->assertDebuggingNotCalled();
     $event6->trigger();
     $this->assertDebuggingCalled();
     $event = \core_tests\event\problematic_event2::create(array());
     $this->assertDebuggingNotCalled();
     $event = \core_tests\event\problematic_event2::create(array('context' => \context_system::instance()));
     $this->assertDebuggingCalled();
     $event = \core_tests\event\problematic_event3::create(array('other' => 1));
     $this->assertDebuggingNotCalled();
     $event = \core_tests\event\problematic_event3::create(array());
     $this->assertDebuggingCalled();
 }
开发者ID:eamador,项目名称:moodle-course-custom-fields,代码行数:34,代码来源:event_test.php


示例11: define

 * # 5 minutes past 4am
 * 5 4 * * * $sudo -u www-data /usr/bin/php /var/www/moodle/auth/cas/cli/sync_users.php
 *
 * Notes:
 *   - it is required to use the web server account when executing PHP CLI scripts
 *   - you need to change the "www-data" to match the apache user account
 *   - use "su" if "sudo" not available
 *   - If you have a large number of users, you may want to raise the memory limits
 *     by passing -d momory_limit=256M
 *   - For debugging & better logging, you are encouraged to use in the command line:
 *     -d log_errors=1 -d error_reporting=E_ALL -d display_errors=0 -d html_errors=0
 *
 * Performance notes:
 * We have optimized it as best as we could for PostgreSQL and MySQL, with 27K students
 * we have seen this take 10 minutes.
 *
 * @package    auth_cas
 * @copyright  2007 Jerome Gutierrez - based on code by Martin Langhoff
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
define('CLI_SCRIPT', true);
require dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php';
require_once $CFG->dirroot . '/course/lib.php';
// Ensure errors are well explained
set_debugging(DEBUG_DEVELOPER, true);
if (!is_enabled_auth('cas')) {
    error_log('[AUTH CAS] ' . get_string('pluginnotenabled', 'auth_ldap'));
    die;
}
$casauth = get_auth_plugin('cas');
$casauth->sync_users(true);
开发者ID:bobpuffer,项目名称:moodleUCLA-LUTH,代码行数:31,代码来源:sync_users.php


示例12: test_hash_key

 /**
  * Test the hash_key functionality.
  */
 public function test_hash_key()
 {
     $this->resetAfterTest();
     set_debugging(DEBUG_ALL);
     // First with simplekeys
     $instance = cache_config_testing::instance(true);
     $instance->phpunit_add_definition('phpunit/hashtest', array('mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', 'area' => 'hashtest', 'simplekeys' => true));
     $factory = cache_factory::instance();
     $definition = $factory->create_definition('phpunit', 'hashtest');
     $result = cache_helper::hash_key('test', $definition);
     $this->assertEquals('test-' . $definition->generate_single_key_prefix(), $result);
     try {
         cache_helper::hash_key('test/test', $definition);
         $this->fail('Invalid key was allowed, you should see this.');
     } catch (coding_exception $e) {
         $this->assertEquals('test/test', $e->debuginfo);
     }
     // Second without simple keys
     $instance->phpunit_add_definition('phpunit/hashtest2', array('mode' => cache_store::MODE_APPLICATION, 'component' => 'phpunit', 'area' => 'hashtest2', 'simplekeys' => false));
     $definition = $factory->create_definition('phpunit', 'hashtest2');
     $result = cache_helper::hash_key('test', $definition);
     $this->assertEquals(sha1($definition->generate_single_key_prefix() . '-test'), $result);
     $result = cache_helper::hash_key('test/test', $definition);
     $this->assertEquals(sha1($definition->generate_single_key_prefix() . '-test/test'), $result);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:28,代码来源:administration_helper_test.php


示例13: tool_phpunit_header

         tool_phpunit_header();
         echo $OUTPUT->box_start('generalbox');
         echo '<pre>';
         echo "Reinitialising test database:\n\n";
         chdir($CFG->dirroot);
         ignore_user_abort(true);
         passthru("php {$CFG->admin}/tool/phpunit/cli/util.php --drop", $code);
         passthru("php {$CFG->admin}/tool/phpunit/cli/util.php --buildconfig", $code);
         passthru("php {$CFG->admin}/tool/phpunit/cli/util.php --install", $code);
         chdir($oldcwd);
         echo '</pre>';
         echo $OUTPUT->box_end();
         if ($code != 0) {
             tool_phpunit_problem('Can not initialize database');
         }
         set_debugging(DEBUG_NONE, false);
         // Hack: no redirect warning, we really want to redirect.
         redirect(new moodle_url($PAGE->url, array('execute' => 1, 'tespath' => $testpath, 'testclass' => $testclass, 'sesskey' => sesskey())), 'Reloading page');
         die;
     } else {
         tool_phpunit_header();
         echo $OUTPUT->box_start('generalbox');
         echo '<pre>';
         echo "Error: {$code}\n\n";
         echo implode("\n", $output);
         echo '</pre>';
         echo $OUTPUT->box_end();
         tool_phpunit_problem('Can not execute tests');
         die;
     }
 }
开发者ID:bobpuffer,项目名称:moodleUCLA-LUTH,代码行数:31,代码来源:webrunner.php


示例14: cron_run

/**
 * Execute cron tasks
 */
function cron_run()
{
    global $DB, $CFG, $OUTPUT;
    if (CLI_MAINTENANCE) {
        echo "CLI maintenance mode active, cron execution suspended.\n";
        exit(1);
    }
    if (moodle_needs_upgrading()) {
        echo "Moodle upgrade pending, cron execution suspended.\n";
        exit(1);
    }
    require_once $CFG->libdir . '/adminlib.php';
    if (!empty($CFG->showcronsql)) {
        $DB->set_debug(true);
    }
    if (!empty($CFG->showcrondebugging)) {
        set_debugging(DEBUG_DEVELOPER, true);
    }
    core_php_time_limit::raise();
    $starttime = microtime();
    // Increase memory limit
    raise_memory_limit(MEMORY_EXTRA);
    // Emulate normal session - we use admin accoutn by default
    cron_setup_user();
    // Start output log
    $timenow = time();
    mtrace("Server Time: " . date('r', $timenow) . "\n\n");
    // Run all scheduled tasks.
    while (!\core\task\manager::static_caches_cleared_since($timenow) && ($task = \core\task\manager::get_next_scheduled_task($timenow))) {
        mtrace("Execute scheduled task: " . $task->get_name());
        cron_trace_time_and_memory();
        $predbqueries = null;
        $predbqueries = $DB->perf_get_queries();
        $pretime = microtime(1);
        try {
            get_mailer('buffer');
            $task->execute();
            if ($DB->is_transaction_started()) {
                throw new coding_exception("Task left transaction open");
            }
            if (isset($predbqueries)) {
                mtrace("... used " . ($DB->perf_get_queries() - $predbqueries) . " dbqueries");
                mtrace("... used " . (microtime(1) - $pretime) . " seconds");
            }
            mtrace("Scheduled task complete: " . $task->get_name());
            \core\task\manager::scheduled_task_complete($task);
        } catch (Exception $e) {
            if ($DB && $DB->is_transaction_started()) {
                error_log('Database transaction aborted automatically in ' . get_class($task));
                $DB->force_transaction_rollback();
            }
            if (isset($predbqueries)) {
                mtrace("... used " . ($DB->perf_get_queries() - $predbqueries) . " dbqueries");
                mtrace("... used " . (microtime(1) - $pretime) . " seconds");
            }
            mtrace("Scheduled task failed: " . $task->get_name() . "," . $e->getMessage());
            if ($CFG->debugdeveloper) {
                if (!empty($e->debuginfo)) {
                    mtrace("Debug info:");
                    mtrace($e->debuginfo);
                }
                mtrace("Backtrace:");
                mtrace(format_backtrace($e->getTrace(), true));
            }
            \core\task\manager::scheduled_task_failed($task);
        }
        get_mailer('close');
        unset($task);
    }
    // Run all adhoc tasks.
    while (!\core\task\manager::static_caches_cleared_since($timenow) && ($task = \core\task\manager::get_next_adhoc_task($timenow))) {
        mtrace("Execute adhoc task: " . get_class($task));
        cron_trace_time_and_memory();
        $predbqueries = null;
        $predbqueries = $DB->perf_get_queries();
        $pretime = microtime(1);
        try {
            get_mailer('buffer');
            $task->execute();
            if ($DB->is_transaction_started()) {
                throw new coding_exception("Task left transaction open");
            }
            if (isset($predbqueries)) {
                mtrace("... used " . ($DB->perf_get_queries() - $predbqueries) . " dbqueries");
                mtrace("... used " . (microtime(1) - $pretime) . " seconds");
            }
            mtrace("Adhoc task complete: " . get_class($task));
            \core\task\manager::adhoc_task_complete($task);
        } catch (Exception $e) {
            if ($DB && $DB->is_transaction_started()) {
                error_log('Database transaction aborted automatically in ' . get_class($task));
                $DB->force_transaction_rollback();
            }
            if (isset($predbqueries)) {
                mtrace("... used " . ($DB->perf_get_queries() - $predbqueries) . " dbqueries");
                mtrace("... used " . (microtime(1) - $pretime) . " seconds");
            }
//.........这里部分代码省略.........
开发者ID:educakanchay,项目名称:campus,代码行数:101,代码来源:cronlib.php


示例15: get_event_infos

 /**
  * Return the info about an event.
  *
  * The key 'name' is added to contain the readable name of the event.
  * It is done here because debugging is turned off and some events use
  * deprecated strings.
  *
  * @param  string $class The name of the event class.
  * @return array|false
  */
 public static function get_event_infos($class)
 {
     global $CFG;
     $infos = false;
     // We need to disable debugging as some events can be deprecated.
     $debuglevel = $CFG->debug;
     $debugdisplay = $CFG->debugdisplay;
     set_debugging(0, false);
     // Check that the event exists, and is not an abstract event.
     if (method_exists($class, 'get_static_info')) {
         $ref = new \ReflectionClass($class);
         if (!$ref->isAbstract()) {
             $infos = $class::get_static_info();
             $infos['name'] = $class::get_name();
         }
     }
     // Restore debugging.
     set_debugging($debuglevel, $debugdisplay);
     return $infos;
 }
开发者ID:antoniorodrigues,项目名称:redes-digitais,代码行数:30,代码来源:rule_event.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP set_decrypt_mode函数代码示例发布时间:2022-05-15
下一篇:
PHP set_debug函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap