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


PHP Hooks::clear方法代码示例

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


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

示例1: setUp

 function setUp()
 {
     global $wgHooks;
     parent::setUp();
     Hooks::clear('MediaWikiHooksTest001');
     unset($wgHooks['MediaWikiHooksTest001']);
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:7,代码来源:HooksTest.php

示例2: finalSetup

 public function finalSetup()
 {
     parent::finalSetup();
     global $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType, $wgMainWANCache;
     global $wgLanguageConverterCacheType, $wgUseDatabaseMessages;
     global $wgLocaltimezone, $wgLocalisationCacheConf;
     global $wgDevelopmentWarnings;
     // Inject test autoloader
     require_once __DIR__ . '/../TestsAutoLoader.php';
     // wfWarn should cause tests to fail
     $wgDevelopmentWarnings = true;
     // Make sure all caches and stashes are either disabled or use
     // in-process cache only to prevent tests from using any preconfigured
     // cache meant for the local wiki from outside the test run.
     // See also MediaWikiTestCase::run() which mocks CACHE_DB and APC.
     // Disabled in DefaultSettings, override local settings
     $wgMainWANCache = $wgMainCacheType = CACHE_NONE;
     // Uses CACHE_ANYTHING in DefaultSettings, use hash instead of db
     $wgMessageCacheType = $wgParserCacheType = $wgSessionCacheType = $wgLanguageConverterCacheType = 'hash';
     // Uses db-replicated in DefaultSettings
     $wgMainStash = 'hash';
     $wgUseDatabaseMessages = false;
     # Set for future resets
     // Assume UTC for testing purposes
     $wgLocaltimezone = 'UTC';
     $wgLocalisationCacheConf['storeClass'] = 'LCStoreNull';
     // Bug 44192 Do not attempt to send a real e-mail
     Hooks::clear('AlternateUserMailer');
     Hooks::register('AlternateUserMailer', function () {
         return false;
     });
     // xdebug's default of 100 is too low for MediaWiki
     ini_set('xdebug.max_nesting_level', 1000);
 }
开发者ID:ngertrudiz,项目名称:mediawiki,代码行数:34,代码来源:phpunit.php

示例3: finalSetup

 public function finalSetup()
 {
     parent::finalSetup();
     global $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType, $wgMainWANCache;
     global $wgLanguageConverterCacheType, $wgUseDatabaseMessages;
     global $wgLocaltimezone, $wgLocalisationCacheConf;
     global $wgDevelopmentWarnings;
     // Inject test autoloader
     require_once __DIR__ . '/../TestsAutoLoader.php';
     // wfWarn should cause tests to fail
     $wgDevelopmentWarnings = true;
     $wgMainCacheType = CACHE_NONE;
     $wgMainWANCache = CACHE_NONE;
     $wgMessageCacheType = CACHE_NONE;
     $wgParserCacheType = CACHE_NONE;
     $wgLanguageConverterCacheType = CACHE_NONE;
     $wgUseDatabaseMessages = false;
     # Set for future resets
     // Assume UTC for testing purposes
     $wgLocaltimezone = 'UTC';
     $wgLocalisationCacheConf['storeClass'] = 'LCStoreNull';
     // Bug 44192 Do not attempt to send a real e-mail
     Hooks::clear('AlternateUserMailer');
     Hooks::register('AlternateUserMailer', function () {
         return false;
     });
     // xdebug's default of 100 is too low for MediaWiki
     ini_set('xdebug.max_nesting_level', 1000);
 }
开发者ID:MediaWiki-stable,项目名称:1.26.1,代码行数:29,代码来源:phpunit.php

示例4: finalSetup

 public function finalSetup()
 {
     parent::finalSetup();
     global $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType, $wgMainWANCache;
     global $wgMainStash;
     global $wgLanguageConverterCacheType, $wgUseDatabaseMessages;
     global $wgLocaltimezone, $wgLocalisationCacheConf;
     global $wgDevelopmentWarnings;
     global $wgSessionProviders;
     global $wgJobTypeConf;
     global $wgAuthManagerConfig, $wgAuth, $wgDisableAuthManager;
     // Inject test autoloader
     require_once __DIR__ . '/../TestsAutoLoader.php';
     // wfWarn should cause tests to fail
     $wgDevelopmentWarnings = true;
     // Make sure all caches and stashes are either disabled or use
     // in-process cache only to prevent tests from using any preconfigured
     // cache meant for the local wiki from outside the test run.
     // See also MediaWikiTestCase::run() which mocks CACHE_DB and APC.
     // Disabled in DefaultSettings, override local settings
     $wgMainWANCache = $wgMainCacheType = CACHE_NONE;
     // Uses CACHE_ANYTHING in DefaultSettings, use hash instead of db
     $wgMessageCacheType = $wgParserCacheType = $wgSessionCacheType = $wgLanguageConverterCacheType = 'hash';
     // Uses db-replicated in DefaultSettings
     $wgMainStash = 'hash';
     // Use memory job queue
     $wgJobTypeConf = ['default' => ['class' => 'JobQueueMemory', 'order' => 'fifo']];
     $wgUseDatabaseMessages = false;
     # Set for future resets
     // Assume UTC for testing purposes
     $wgLocaltimezone = 'UTC';
     $wgLocalisationCacheConf['storeClass'] = 'LCStoreNull';
     // Generic MediaWiki\Session\SessionManager configuration for tests
     // We use CookieSessionProvider because things might be expecting
     // cookies to show up in a FauxRequest somewhere.
     $wgSessionProviders = [['class' => MediaWiki\Session\CookieSessionProvider::class, 'args' => [['priority' => 30, 'callUserSetCookiesHook' => true]]]];
     // Generic AuthManager configuration for testing
     $wgAuthManagerConfig = ['preauth' => [], 'primaryauth' => [['class' => MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider::class, 'args' => [['authoritative' => false]]], ['class' => MediaWiki\Auth\LocalPasswordPrimaryAuthenticationProvider::class, 'args' => [['authoritative' => true]]]], 'secondaryauth' => []];
     $wgAuth = $wgDisableAuthManager ? new AuthPlugin() : new MediaWiki\Auth\AuthManagerAuthPlugin();
     // Bug 44192 Do not attempt to send a real e-mail
     Hooks::clear('AlternateUserMailer');
     Hooks::register('AlternateUserMailer', function () {
         return false;
     });
     // xdebug's default of 100 is too low for MediaWiki
     ini_set('xdebug.max_nesting_level', 1000);
     // Bug T116683 serialize_precision of 100
     // may break testing against floating point values
     // treated with PHP's serialize()
     ini_set('serialize_precision', 17);
     // TODO: we should call MediaWikiTestCase::prepareServices( new GlobalVarConfig() ) here.
     // But PHPUnit may not be loaded yet, so we have to wait until just
     // before PHPUnit_TextUI_Command::main() is executed at the end of this file.
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:54,代码来源:phpunit.php

示例5: deregisterListedHooks

 /**
  * @since  2.0
  *
  * @return MwHooksHandler
  */
 public function deregisterListedHooks()
 {
     $listOfHooks = array_merge($this->listOfSmwHooks, $this->getHookRegistry()->getHandlerList());
     foreach ($listOfHooks as $hook) {
         // MW 1.19
         if (method_exists('Hooks', 'clear')) {
             \Hooks::clear($hook);
         }
         if (!isset($GLOBALS['wgHooks'][$hook])) {
             continue;
         }
         $this->wgHooks[$hook] = $GLOBALS['wgHooks'][$hook];
         $GLOBALS['wgHooks'][$hook] = array();
     }
     return $this;
 }
开发者ID:jongfeli,项目名称:SemanticMediaWiki,代码行数:21,代码来源:MwHooksHandler.php

示例6: finalSetup

 public function finalSetup()
 {
     parent::finalSetup();
     global $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType, $wgMainWANCache;
     global $wgMainStash;
     global $wgLanguageConverterCacheType, $wgUseDatabaseMessages;
     global $wgLocaltimezone, $wgLocalisationCacheConf;
     global $wgDevelopmentWarnings;
     global $wgSessionProviders;
     global $wgJobTypeConf;
     // Inject test autoloader
     require_once __DIR__ . '/../TestsAutoLoader.php';
     // wfWarn should cause tests to fail
     $wgDevelopmentWarnings = true;
     // Make sure all caches and stashes are either disabled or use
     // in-process cache only to prevent tests from using any preconfigured
     // cache meant for the local wiki from outside the test run.
     // See also MediaWikiTestCase::run() which mocks CACHE_DB and APC.
     // Disabled in DefaultSettings, override local settings
     $wgMainWANCache = $wgMainCacheType = CACHE_NONE;
     // Uses CACHE_ANYTHING in DefaultSettings, use hash instead of db
     $wgMessageCacheType = $wgParserCacheType = $wgSessionCacheType = $wgLanguageConverterCacheType = 'hash';
     // Uses db-replicated in DefaultSettings
     $wgMainStash = 'hash';
     // Use memory job queue
     $wgJobTypeConf = array('default' => array('class' => 'JobQueueMemory', 'order' => 'fifo'));
     $wgUseDatabaseMessages = false;
     # Set for future resets
     // Assume UTC for testing purposes
     $wgLocaltimezone = 'UTC';
     $wgLocalisationCacheConf['storeClass'] = 'LCStoreNull';
     // Generic MediaWiki\Session\SessionManager configuration for tests
     // We use CookieSessionProvider because things might be expecting
     // cookies to show up in a FauxRequest somewhere.
     $wgSessionProviders = array(array('class' => 'MediaWiki\\Session\\CookieSessionProvider', 'args' => array(array('priority' => 30, 'callUserSetCookiesHook' => true))));
     // Bug 44192 Do not attempt to send a real e-mail
     Hooks::clear('AlternateUserMailer');
     Hooks::register('AlternateUserMailer', function () {
         return false;
     });
     // xdebug's default of 100 is too low for MediaWiki
     ini_set('xdebug.max_nesting_level', 1000);
     // Bug T116683 serialize_precision of 100
     // may break testing against floating point values
     // treated with PHP's serialize()
     ini_set('serialize_precision', 17);
 }
开发者ID:paladox,项目名称:2,代码行数:47,代码来源:phpunit.php

示例7: testNewStyleHookInteraction

 public function testNewStyleHookInteraction()
 {
     global $wgHooks;
     $a = new NothingClass();
     $b = new NothingClass();
     // make sure to start with a clean slate
     Hooks::clear('MediaWikiHooksTest001');
     unset($wgHooks['MediaWikiHooksTest001']);
     $wgHooks['MediaWikiHooksTest001'][] = $a;
     $this->assertTrue(Hooks::isRegistered('MediaWikiHooksTest001'), 'Hook registered via $wgHooks should be noticed by Hooks::isRegistered');
     Hooks::register('MediaWikiHooksTest001', $b);
     $this->assertEquals(2, count(Hooks::getHandlers('MediaWikiHooksTest001')), 'Hooks::getHandlers() should return hooks registered via wgHooks as well as Hooks::register');
     $foo = 'quux';
     $bar = 'qaax';
     Hooks::run('MediaWikiHooksTest001', array(&$foo, &$bar));
     $this->assertEquals(1, $a->calls, 'Hooks::run() should run hooks registered via wgHooks as well as Hooks::register');
     $this->assertEquals(1, $b->calls, 'Hooks::run() should run hooks registered via wgHooks as well as Hooks::register');
     // clean up
     Hooks::clear('MediaWikiHooksTest001');
     unset($wgHooks['MediaWikiHooksTest001']);
 }
开发者ID:nischayn22,项目名称:mediawiki-core,代码行数:21,代码来源:HooksTest.php

示例8: hookMailer

 protected function hookMailer($func = null)
 {
     \Hooks::clear('AlternateUserMailer');
     if ($func) {
         \Hooks::register('AlternateUserMailer', $func);
         // Safety
         \Hooks::register('AlternateUserMailer', function () {
             return false;
         });
     } else {
         \Hooks::register('AlternateUserMailer', function () {
             $this->fail('AlternateUserMailer hook called unexpectedly');
             return false;
         });
     }
     return new \ScopedCallback(function () {
         \Hooks::clear('AlternateUserMailer');
         \Hooks::register('AlternateUserMailer', function () {
             return false;
         });
     });
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:22,代码来源:TemporaryPasswordPrimaryAuthenticationProviderTest.php

示例9: finalSetup

 public function finalSetup()
 {
     parent::finalSetup();
     global $wgMainCacheType, $wgMessageCacheType, $wgParserCacheType;
     global $wgLanguageConverterCacheType, $wgUseDatabaseMessages;
     global $wgLocaltimezone, $wgLocalisationCacheConf;
     global $wgDevelopmentWarnings;
     // wfWarn should cause tests to fail
     $wgDevelopmentWarnings = true;
     $wgMainCacheType = CACHE_NONE;
     $wgMessageCacheType = CACHE_NONE;
     $wgParserCacheType = CACHE_NONE;
     $wgLanguageConverterCacheType = CACHE_NONE;
     $wgUseDatabaseMessages = false;
     # Set for future resets
     // Assume UTC for testing purposes
     $wgLocaltimezone = 'UTC';
     $wgLocalisationCacheConf['storeClass'] = 'LCStore_Null';
     // Bug 44192 Do not attempt to send a real e-mail
     Hooks::clear('AlternateUserMailer');
     Hooks::register('AlternateUserMailer', function () {
         return false;
     });
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:24,代码来源:phpunit.php

示例10: setupInterwikis

 /**
  * Insert hardcoded interwiki in the lookup table.
  *
  * This function insert a set of well known interwikis that are used in
  * the parser tests. They can be considered has fixtures are injected in
  * the interwiki cache by using the 'InterwikiLoadPrefix' hook.
  * Since we are not interested in looking up interwikis in the database,
  * the hook completely replace the existing mechanism (hook returns false).
  *
  * @return closure for teardown
  */
 private function setupInterwikis()
 {
     # Hack: insert a few Wikipedia in-project interwiki prefixes,
     # for testing inter-language links
     Hooks::register('InterwikiLoadPrefix', function ($prefix, &$iwData) {
         static $testInterwikis = ['local' => ['iw_url' => 'http://doesnt.matter.org/$1', 'iw_api' => '', 'iw_wikiid' => '', 'iw_local' => 0], 'wikipedia' => ['iw_url' => 'http://en.wikipedia.org/wiki/$1', 'iw_api' => '', 'iw_wikiid' => '', 'iw_local' => 0], 'meatball' => ['iw_url' => 'http://www.usemod.com/cgi-bin/mb.pl?$1', 'iw_api' => '', 'iw_wikiid' => '', 'iw_local' => 0], 'memoryalpha' => ['iw_url' => 'http://www.memory-alpha.org/en/index.php/$1', 'iw_api' => '', 'iw_wikiid' => '', 'iw_local' => 0], 'zh' => ['iw_url' => 'http://zh.wikipedia.org/wiki/$1', 'iw_api' => '', 'iw_wikiid' => '', 'iw_local' => 1], 'es' => ['iw_url' => 'http://es.wikipedia.org/wiki/$1', 'iw_api' => '', 'iw_wikiid' => '', 'iw_local' => 1], 'fr' => ['iw_url' => 'http://fr.wikipedia.org/wiki/$1', 'iw_api' => '', 'iw_wikiid' => '', 'iw_local' => 1], 'ru' => ['iw_url' => 'http://ru.wikipedia.org/wiki/$1', 'iw_api' => '', 'iw_wikiid' => '', 'iw_local' => 1], 'mi' => ['iw_url' => 'http://mi.wikipedia.org/wiki/$1', 'iw_api' => '', 'iw_wikiid' => '', 'iw_local' => 1], 'mul' => ['iw_url' => 'http://wikisource.org/wiki/$1', 'iw_api' => '', 'iw_wikiid' => '', 'iw_local' => 1]];
         if (array_key_exists($prefix, $testInterwikis)) {
             $iwData = $testInterwikis[$prefix];
         }
         // We only want to rely on the above fixtures
         return false;
     });
     // hooks::register
     return function () {
         // Tear down
         Hooks::clear('InterwikiLoadPrefix');
     };
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:29,代码来源:ParserTestRunner.php


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