本文整理汇总了PHP中wfLogProfilingData函数的典型用法代码示例。如果您正苦于以下问题:PHP wfLogProfilingData函数的具体用法?PHP wfLogProfilingData怎么用?PHP wfLogProfilingData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wfLogProfilingData函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wfForbidden
function wfForbidden()
{
header('HTTP/1.0 403 Forbidden');
print "<html><body>\n<h1>Access denied</h1>\n<p>You need to log in to access files on this server</p>\n</body></html>";
wfLogProfilingData();
exit;
}
示例2: __destruct
public function __destruct()
{
// Return to real wiki db, so profiling data is preserved
MediaWikiTestCase::teardownTestDB();
// Log profiling data, e.g. in the database or UDP
wfLogProfilingData();
}
示例3: execute
function execute()
{
if (!file_exists('results')) {
mkdir('results');
}
if (!is_dir('results')) {
echo "Unable to create 'results' directory\n";
exit(1);
}
$overallStart = microtime(true);
$reportInterval = 1000;
for ($i = 1; true; $i++) {
$t = -microtime(true);
try {
self::$currentTest = new PPFuzzTest($this);
self::$currentTest->execute();
$passed = 'passed';
} catch (MWException $e) {
$testReport = self::$currentTest->getReport();
$exceptionReport = $e->getText();
$hash = md5($testReport);
file_put_contents("results/ppft-{$hash}.in", serialize(self::$currentTest));
file_put_contents("results/ppft-{$hash}.fail", "Input:\n{$testReport}\n\nException report:\n{$exceptionReport}\n");
print "Test {$hash} failed\n";
$passed = 'failed';
}
$t += microtime(true);
if ($this->verbose) {
printf("Test {$passed} in %.3f seconds\n", $t);
print self::$currentTest->getReport();
}
$reportMetric = (microtime(true) - $overallStart) / $i * $reportInterval;
if ($reportMetric > 25) {
if (substr($reportInterval, 0, 1) === '1') {
$reportInterval /= 2;
} else {
$reportInterval /= 5;
}
} elseif ($reportMetric < 4) {
if (substr($reportInterval, 0, 1) === '1') {
$reportInterval *= 5;
} else {
$reportInterval *= 2;
}
}
if ($i % $reportInterval == 0) {
print "{$i} tests done\n";
/*
$testReport = self::$currentTest->getReport();
$filename = 'results/ppft-' . md5( $testReport ) . '.pass';
file_put_contents( $filename, "Input:\n$testReport\n" );*/
}
}
wfLogProfilingData();
}
示例4: execute
public function execute()
{
wfProfileIn(__METHOD__);
//run the download:
Http::doSessionIdDownload($this->getOption('sid'), $this->getOption('usk'));
// close up shop:
// Execute any deferred updates
wfDoUpdates();
// Log what the user did, for book-keeping purposes.
wfLogProfilingData();
// Shut down the database before exit
wfGetLBFactory()->shutdown();
wfProfileOut(__METHOD__);
}
示例5: run
public function run(array $argv, $exit = true)
{
wfProfileIn(__METHOD__);
$ret = parent::run($argv, false);
wfProfileOut(__METHOD__);
// Return to real wiki db, so profiling data is preserved
MediaWikiTestCase::teardownTestDB();
// Log profiling data, e.g. in the database or UDP
wfLogProfilingData();
if ($exit) {
exit($ret);
} else {
return $ret;
}
}
示例6: wfForbidden
/**
* Issue a standard HTTP 403 Forbidden header and a basic
* error message, then end the script
*/
function wfForbidden()
{
header('HTTP/1.0 403 Forbidden');
header('Vary: Cookie');
header('Content-Type: text/html; charset=utf-8');
echo <<<ENDS
<html>
<body>
<h1>Access Denied</h1>
<p>You need to log in to access files on this server.</p>
</body>
</html>
ENDS;
wfLogProfilingData();
exit;
}
示例7: handle
/**
* Exception handler which simulates the appropriate catch() handling:
*
* try {
* ...
* } catch ( MWException $e ) {
* $e->report();
* } catch ( Exception $e ) {
* echo $e->__toString();
* }
*/
public static function handle($e)
{
global $wgFullyInitialised;
self::report($e);
// Final cleanup
if ($wgFullyInitialised) {
try {
wfLogProfilingData();
// uses $wgRequest, hence the $wgFullyInitialised condition
} catch (Exception $e) {
}
}
// Exit value should be nonzero for the benefit of shell jobs
exit(1);
}
示例8: restInPeace
/**
* Ends this task peacefully
*/
function restInPeace(&$loadBalancer)
{
wfLogProfilingData();
$loadBalancer->closeAll();
wfDebug("Request ended normally\n");
}
示例9: restInPeace
/**
* Ends this task peacefully
*/
function restInPeace()
{
wfLogProfilingData();
// Commit and close up!
$factory = wfGetLBFactory();
$factory->commitMasterChanges();
$factory->shutdown();
wfDebug("Request ended normally\n");
}
示例10: restInPeace
/**
* Ends this task peacefully
* @param string $mode Use 'fast' to always skip job running
*/
public function restInPeace($mode = 'fast')
{
$lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
// Assure deferred updates are not in the main transaction
$lbFactory->commitMasterChanges(__METHOD__);
// Loosen DB query expectations since the HTTP client is unblocked
$trxProfiler = Profiler::instance()->getTransactionProfiler();
$trxProfiler->resetExpectations();
$trxProfiler->setExpectations($this->config->get('TrxProfilerLimits')['PostSend'], __METHOD__);
// Do any deferred jobs
DeferredUpdates::doUpdates('enqueue');
DeferredUpdates::setImmediateMode(true);
// Make sure any lazy jobs are pushed
JobQueueGroup::pushLazyJobs();
// Now that everything specific to this request is done,
// try to occasionally run jobs (if enabled) from the queues
if ($mode === 'normal') {
$this->triggerJobs();
}
// Log profiling data, e.g. in the database or UDP
wfLogProfilingData();
// Commit and close up!
$lbFactory->commitMasterChanges(__METHOD__);
$lbFactory->shutdown(LBFactory::SHUTDOWN_NO_CHRONPROT);
wfDebug("Request ended normally\n");
}
示例11: restInPeace
/**
* Ends this task peacefully
* @param string $mode Use 'fast' to always skip job running
*/
public function restInPeace($mode = 'fast')
{
// Assure deferred updates are not in the main transaction
wfGetLBFactory()->commitMasterChanges(__METHOD__);
// Ignore things like master queries/connections on GET requests
// as long as they are in deferred updates (which catch errors).
Profiler::instance()->getTransactionProfiler()->resetExpectations();
// Do any deferred jobs
DeferredUpdates::doUpdates('enqueue');
// Make sure any lazy jobs are pushed
JobQueueGroup::pushLazyJobs();
// Now that everything specific to this request is done,
// try to occasionally run jobs (if enabled) from the queues
if ($mode === 'normal') {
$this->triggerJobs();
}
// Log profiling data, e.g. in the database or UDP
wfLogProfilingData();
// Commit and close up!
$factory = wfGetLBFactory();
$factory->commitMasterChanges(__METHOD__);
$factory->shutdown(LBFactory::SHUTDOWN_NO_CHRONPROT);
wfDebug("Request ended normally\n");
}
示例12: restInPeace
/**
* Ends this task peacefully
*/
public function restInPeace()
{
// Ignore things like master queries/connections on GET requests
// as long as they are in deferred updates (which catch errors).
Profiler::instance()->getTransactionProfiler()->resetExpectations();
// Do any deferred jobs
DeferredUpdates::doUpdates('commit');
// Make sure any lazy jobs are pushed
JobQueueGroup::pushLazyJobs();
// Log profiling data, e.g. in the database or UDP
wfLogProfilingData();
// Commit and close up!
$factory = wfGetLBFactory();
$factory->commitMasterChanges();
$factory->shutdown();
wfDebug("Request ended normally\n");
}
示例13: wfExceptionHandler
/**
* Exception handler which simulates the appropriate catch() handling:
*
* try {
* ...
* } catch ( MWException $e ) {
* $e->report();
* } catch ( Exception $e ) {
* echo $e->__toString();
* }
*/
function wfExceptionHandler($e)
{
global $wgFullyInitialised;
wfReportException($e);
// Final cleanup, similar to wfErrorExit()
if ($wgFullyInitialised) {
try {
wfLogProfilingData();
// uses $wgRequest, hence the $wgFullyInitialised condition
} catch (Exception $e) {
}
}
// Exit value should be nonzero for the benefit of shell jobs
exit(1);
}
示例14: wfAbruptExit
/**
* Just like exit() but makes a note of it.
* Commits open transactions except if the error parameter is set
*
* @deprecated Please return control to the caller or throw an exception
*/
function wfAbruptExit($error = false)
{
static $called = false;
if ($called) {
exit(-1);
}
$called = true;
$bt = wfDebugBacktrace();
if ($bt) {
for ($i = 0; $i < count($bt); $i++) {
$file = isset($bt[$i]['file']) ? $bt[$i]['file'] : "unknown";
$line = isset($bt[$i]['line']) ? $bt[$i]['line'] : "unknown";
wfDebug("WARNING: Abrupt exit in {$file} at line {$line}\n");
}
} else {
wfDebug("WARNING: Abrupt exit\n");
}
wfLogProfilingData();
if (!$error) {
wfGetLB()->closeAll();
}
exit(-1);
}
示例15: wfAbruptExit
/**
* Just like exit() but makes a note of it.
* Commits open transactions except if the error parameter is set
*
* @obsolete Please return control to the caller or throw an exception
*/
function wfAbruptExit($error = false)
{
global $wgLoadBalancer;
static $called = false;
if ($called) {
exit(-1);
}
$called = true;
if (function_exists('debug_backtrace')) {
// PHP >= 4.3
$bt = debug_backtrace();
for ($i = 0; $i < count($bt); $i++) {
$file = isset($bt[$i]['file']) ? $bt[$i]['file'] : "unknown";
$line = isset($bt[$i]['line']) ? $bt[$i]['line'] : "unknown";
wfDebug("WARNING: Abrupt exit in {$file} at line {$line}\n");
}
} else {
wfDebug('WARNING: Abrupt exit\\n');
}
wfLogProfilingData();
if (!$error) {
$wgLoadBalancer->closeAll();
}
exit(-1);
}