本文整理汇总了PHP中DeferredUpdates::forceDeferral方法的典型用法代码示例。如果您正苦于以下问题:PHP DeferredUpdates::forceDeferral方法的具体用法?PHP DeferredUpdates::forceDeferral怎么用?PHP DeferredUpdates::forceDeferral使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DeferredUpdates
的用法示例。
在下文中一共展示了DeferredUpdates::forceDeferral方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forceDeferral
/**
* @note This method is intended for testing purposes
* @param bool $value Whether to *always* defer updates, even in CLI mode
* @since 1.27
*/
public static function forceDeferral($value)
{
self::$forceDeferral = $value;
}
示例2: testAsyncWrites
public function testAsyncWrites()
{
$be = TestingAccessWrapper::newFromObject(new FileBackendMultiWrite(array('name' => 'localtesting', 'wikiId' => wfWikiId() . mt_rand(), 'backends' => array(array('name' => 'multitesting0', 'class' => 'MemoryFileBackend', 'isMultiMaster' => false), array('name' => 'multitesting1', 'class' => 'MemoryFileBackend', 'isMultiMaster' => true)), 'replication' => 'async')));
DeferredUpdates::forceDeferral(true);
$p = 'container/test-cont/file.txt';
$be->quickCreate(array('dst' => "mwstore://localtesting/{$p}", 'content' => 'cattitude'));
$this->assertEquals(false, $be->backends[0]->getFileContents(array('src' => "mwstore://multitesting0/{$p}")), "File not yet written to backend 0");
$this->assertEquals('cattitude', $be->backends[1]->getFileContents(array('src' => "mwstore://multitesting1/{$p}")), "File already written to backend 1");
DeferredUpdates::doUpdates();
DeferredUpdates::forceDeferral(false);
$this->assertEquals('cattitude', $be->backends[0]->getFileContents(array('src' => "mwstore://multitesting0/{$p}")), "File now written to backend 0");
}