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

PHP events_trigger_legacy函数代码示例

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

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



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

示例1: events_trigger

/**
 * Function to call all event handlers when triggering an event
 *
 * @deprecated since 2.6
 *
 * @param string $eventname name of the event
 * @param mixed $eventdata event data object
 * @return int number of failed events
 */
function events_trigger($eventname, $eventdata)
{
    debugging('events_trigger() is deprecated, please use new events instead', DEBUG_DEVELOPER);
    return events_trigger_legacy($eventname, $eventdata);
}
开发者ID:evltuma,项目名称:moodle,代码行数:14,代码来源:deprecatedlib.php


示例2: trigger

 /**
  * Trigger event.
  */
 public final function trigger()
 {
     global $CFG;
     if ($this->restored) {
         throw new \coding_exception('Can not trigger restored event');
     }
     if ($this->triggered or $this->dispatched) {
         throw new \coding_exception('Can not trigger event twice');
     }
     $this->validate_before_trigger();
     $this->triggered = true;
     if (isset($CFG->loglifetime) and $CFG->loglifetime != -1) {
         if ($data = $this->get_legacy_logdata()) {
             call_user_func_array('add_to_log', $data);
         }
     }
     if (PHPUNIT_TEST and \phpunit_util::is_redirecting_events()) {
         $this->dispatched = true;
         \phpunit_util::event_triggered($this);
         return;
     }
     \core\event\manager::dispatch($this);
     $this->dispatched = true;
     if ($legacyeventname = static::get_legacy_eventname()) {
         events_trigger_legacy($legacyeventname, $this->get_legacy_eventdata());
     }
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:30,代码来源:base.php


示例3: trigger

 /**
  * Trigger event.
  */
 public final function trigger()
 {
     global $CFG;
     if ($this->restored) {
         throw new \coding_exception('Can not trigger restored event');
     }
     if ($this->triggered or $this->dispatched) {
         throw new \coding_exception('Can not trigger event twice');
     }
     $this->validate_before_trigger();
     $this->triggered = true;
     if (isset($CFG->loglifetime) and $CFG->loglifetime != -1) {
         if ($data = $this->get_legacy_logdata()) {
             $manager = get_log_manager();
             if (method_exists($manager, 'legacy_add_to_log')) {
                 if (is_array($data[0])) {
                     // Some events require several entries in 'log' table.
                     foreach ($data as $d) {
                         call_user_func_array(array($manager, 'legacy_add_to_log'), $d);
                     }
                 } else {
                     call_user_func_array(array($manager, 'legacy_add_to_log'), $data);
                 }
             }
         }
     }
     if (PHPUNIT_TEST and \phpunit_util::is_redirecting_events()) {
         $this->dispatched = true;
         \phpunit_util::event_triggered($this);
         return;
     }
     \core\event\manager::dispatch($this);
     $this->dispatched = true;
     if ($legacyeventname = static::get_legacy_eventname()) {
         events_trigger_legacy($legacyeventname, $this->get_legacy_eventdata());
     }
 }
开发者ID:CCIE-FIUSAC,项目名称:moodle,代码行数:40,代码来源:base.php


示例4: groups_delete_groupings

/**
 * Delete all groupings from course
 *
 * @param int $courseid
 * @param bool $showfeedback
 * @return bool success
 */
function groups_delete_groupings($courseid, $showfeedback = false)
{
    global $DB, $OUTPUT;
    $groupings = $DB->get_recordset_select('groupings', 'courseid = ?', array($courseid));
    foreach ($groupings as $grouping) {
        groups_delete_grouping($grouping);
    }
    // Invalidate the grouping cache for the course.
    cache_helper::invalidate_by_definition('core', 'groupdata', array(), array($courseid));
    // TODO MDL-41312 Remove events_trigger_legacy('groups_groupings_deleted').
    // This event is kept here for backwards compatibility, because it cannot be
    // translated to a new event as it is wrong.
    events_trigger_legacy('groups_groupings_deleted', $courseid);
    if ($showfeedback) {
        echo $OUTPUT->notification(get_string('deleted') . ' - ' . get_string('groupings', 'group'), 'notifysuccess');
    }
    return true;
}
开发者ID:rushi963,项目名称:moodle,代码行数:25,代码来源:lib.php


示例5: test_events_trigger__failed_instant

 /**
  * Tests events_trigger_legacy() function when instant handler fails.
  */
 public function test_events_trigger__failed_instant()
 {
     global $CFG;
     events_update_definition('unittest');
     $this->assertDebuggingCalled(self::DEBUGGING_MSG, DEBUG_DEVELOPER);
     $olddebug = $CFG->debug;
     $this->assertEquals(1, events_trigger_legacy('test_instant', 'fail'), 'fail first event: %s');
     $this->assertDebuggingCalled(self::DEBUGGING_MSG, DEBUG_DEVELOPER);
     $this->assertEquals(1, events_trigger_legacy('test_instant', 'ok'), 'this one should fail too: %s');
     $this->assertDebuggingNotCalled();
     $this->assertEquals(0, events_cron('test_instant'), 'all events should stay in queue: %s');
     // events_cron + one for each dispatched event.
     $this->assertDebuggingCalledCount(3);
     $this->assertEquals(2, events_pending_count('test_instant'), 'two events should in queue: %s');
     $this->assertDebuggingCalled('events_pending_count() has been deprecated along with all Events 1 API in favour of Events 2' . ' API, please use it instead.', DEBUG_DEVELOPER);
     $this->assertEquals(0, eventslib_sample_function_handler('status'), 'verify no event dispatched yet: %s');
     eventslib_sample_function_handler('ignorefail');
     // Ignore "fail" eventdata from now on.
     $this->assertEquals(1, events_trigger_legacy('test_instant', 'ok'), 'this one should go to queue directly: %s');
     $this->assertDebuggingNotCalled();
     $this->assertEquals(3, events_pending_count('test_instant'), 'three events should in queue: %s');
     $this->assertDebuggingCalled('events_pending_count() has been deprecated along with all Events 1 API in favour of Events 2' . ' API, please use it instead.', DEBUG_DEVELOPER);
     $this->assertEquals(0, eventslib_sample_function_handler('status'), 'verify previous event was not dispatched: %s');
     $this->assertEquals(3, events_cron('test_instant'), 'all events should be dispatched: %s');
     // events_cron + one for each dispatched event.
     $this->assertDebuggingCalledCount(4);
     $this->assertEquals(3, eventslib_sample_function_handler('status'), 'verify three events were dispatched: %s');
     $this->assertEquals(0, events_pending_count('test_instant'), 'no events should in queue: %s');
     $this->assertDebuggingCalled('events_pending_count() has been deprecated along with all Events 1 API in favour of Events 2' . ' API, please use it instead.', DEBUG_DEVELOPER);
     $this->assertEquals(0, events_trigger_legacy('test_instant', 'ok'), 'this event should be dispatched immediately: %s');
     $this->assertDebuggingCalled(self::DEBUGGING_MSG, DEBUG_DEVELOPER);
     $this->assertEquals(4, eventslib_sample_function_handler('status'), 'verify event was dispatched: %s');
     $this->assertEquals(0, events_pending_count('test_instant'), 'no events should in queue: %s');
     $this->assertDebuggingCalled('events_pending_count() has been deprecated along with all Events 1 API in favour of Events 2' . ' API, please use it instead.', DEBUG_DEVELOPER);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:38,代码来源:eventslib_test.php


示例6: events_trigger

/**
 * Function to call all event handlers when triggering an event
 *
 * @deprecated since 2.6
 *
 * @param string $eventname name of the event
 * @param mixed $eventdata event data object
 * @return int number of failed events
 */
function events_trigger($eventname, $eventdata)
{
    // TODO: uncomment after conversion of all events in standard distribution
    // debugging('events_trigger() is deprecated, please use new events instead', DEBUG_DEVELOPER);
    return events_trigger_legacy($eventname, $eventdata);
}
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:15,代码来源:deprecatedlib.php


示例7: test_events_trigger__failed_instant

 /**
  * Tests events_trigger_legacy() function when instant handler fails.
  */
 public function test_events_trigger__failed_instant()
 {
     global $CFG;
     $olddebug = $CFG->debug;
     $this->assertEquals(1, events_trigger_legacy('test_instant', 'fail'), 'fail first event: %s');
     $this->assertEquals(1, events_trigger_legacy('test_instant', 'ok'), 'this one should fail too: %s');
     $this->assertEquals(0, events_cron('test_instant'), 'all events should stay in queue: %s');
     $this->assertDebuggingCalled();
     $this->assertEquals(2, events_pending_count('test_instant'), 'two events should in queue: %s');
     $this->assertEquals(0, eventslib_sample_function_handler('status'), 'verify no event dispatched yet: %s');
     eventslib_sample_function_handler('ignorefail');
     // Ignore "fail" eventdata from now on.
     $this->assertEquals(1, events_trigger_legacy('test_instant', 'ok'), 'this one should go to queue directly: %s');
     $this->assertEquals(3, events_pending_count('test_instant'), 'three events should in queue: %s');
     $this->assertEquals(0, eventslib_sample_function_handler('status'), 'verify previous event was not dispatched: %s');
     $this->assertEquals(3, events_cron('test_instant'), 'all events should be dispatched: %s');
     $this->assertEquals(3, eventslib_sample_function_handler('status'), 'verify three events were dispatched: %s');
     $this->assertEquals(0, events_pending_count('test_instant'), 'no events should in queue: %s');
     $this->assertEquals(0, events_trigger_legacy('test_instant', 'ok'), 'this event should be dispatched immediately: %s');
     $this->assertEquals(4, eventslib_sample_function_handler('status'), 'verify event was dispatched: %s');
     $this->assertEquals(0, events_pending_count('test_instant'), 'no events should in queue: %s');
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:25,代码来源:eventslib_test.php


示例8: process_stage_queueorwait

 /**
  * Processes the 'queueornext' stage of the export
  *
  * @return bool whether or not to process the next stage. this is important as the control function is called recursively.
  */
 public function process_stage_queueorwait()
 {
     $wait = $this->instance->get_export_config('wait');
     if (empty($wait)) {
         // TODO MDL-42541 Removing usage of events_trigger().
         events_trigger_legacy('portfolio_send', $this->id);
         $this->queued = true;
         return $this->process_stage_finished(true);
     }
     return true;
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:16,代码来源:exporter.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP events_uninstall函数代码示例发布时间:2022-05-15
下一篇:
PHP events_trigger函数代码示例发布时间: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