本文整理汇总了PHP中Timer::writeTimings方法的典型用法代码示例。如果您正苦于以下问题:PHP Timer::writeTimings方法的具体用法?PHP Timer::writeTimings怎么用?PHP Timer::writeTimings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Timer
的用法示例。
在下文中一共展示了Timer::writeTimings方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCoverFromEContent
private function getCoverFromEContent()
{
if ($this->configArray['EContent']['library'] && isset($this->id) && is_numeric($this->id)) {
$this->log("Looking for eContent Cover", PEAR_LOG_INFO);
$this->initMemcache();
$this->log("Checking eContent database to see if there is a record for {$this->id}", PEAR_LOG_INFO);
//Check the database to see if there is an existing title
require_once ROOT_DIR . '/sys/eContent/EContentRecord.php';
$epubFile = new EContentRecord();
$epubFile->id = $this->id;
if ($epubFile->find(true)) {
$this->log("Found an eContent record for {$this->id}, source is {$epubFile->source}", PEAR_LOG_INFO);
//Get the cover for the epub if one exists.
if (strcasecmp($epubFile->source, 'OverDrive') == 0 && ($epubFile->cover == null || strlen($epubFile->cover) == 0)) {
$this->log("Record is an OverDrive record that needs cover information fetched.", PEAR_LOG_INFO);
//Get the image from OverDrive
require_once ROOT_DIR . '/Drivers/OverDriveDriverFactory.php';
$overDriveDriver = OverDriveDriverFactory::getDriver();
$filename = $overDriveDriver->getCoverUrl($epubFile);
$this->log("Got OverDrive cover information for {$epubFile->id} {$epubFile->sourceUrl}", PEAR_LOG_INFO);
$this->log("Received filename {$filename}", PEAR_LOG_INFO);
if ($filename != null) {
$epubFile->cover = $filename;
$ret = $epubFile->update();
//Don't update solr for performance reasons
$this->log("Result of saving cover url is {$ret}", PEAR_LOG_INFO);
}
} elseif (preg_match('/Colorado State Gov\\. Docs/si', $epubFile->source) == 1 || $epubFile->source == 'CO State Gov Docs') {
//Cover is colorado state flag
$this->log("Record is a gov docs file.", PEAR_LOG_INFO);
$themeName = $this->configArray['Site']['theme'];
$filename = "interface/themes/{$themeName}/images/state_flag_of_colorado.png";
if ($this->processImageURL($filename, true)) {
return;
}
}
if ($epubFile->cover && strlen($epubFile->cover) > 0) {
$this->log("Cover for the file is specified as {$epubFile->cover}.", PEAR_LOG_INFO);
if (strpos($epubFile->cover, 'http://') === 0) {
$filename = $epubFile->cover;
if ($this->processImageURL($filename, true)) {
$this->timer->writeTimings();
exit;
}
} else {
$filename = $this->bookCoverPath . '/original/' . $epubFile->cover;
$this->localFile = $this->bookCoverPath . '/' . $this->size . '/' . $this->cacheName . '.png';
if (file_exists($filename)) {
if ($this->processImageURL($filename, true)) {
$this->timer->writeTimings();
exit;
}
} else {
$this->log("Did not find econtent cover file {$filename}", PEAR_LOG_ERR);
}
}
}
}
}
$this->log("Did not find a cover based on eContent information.", PEAR_LOG_INFO);
}
示例2: Timer
if (empty($timer)) {
$timer = new Timer(microtime(false));
}
// Retrieve values from configuration file
require_once ROOT_DIR . '/sys/ConfigArray.php';
$configArray = readConfig();
$timer->logTime("Read config");
if (isset($configArray['System']['timings'])) {
$timer->enableTimings($configArray['System']['timings']);
}
//Start a logger
$logger = new Logger();
//Update error handling
if ($configArray['System']['debug']) {
ini_set('display_errors', true);
error_reporting(E_ALL & ~E_DEPRECATED);
}
date_default_timezone_set($configArray['Site']['timezone']);
$timer->logTime("bootstrap");
//Create the QR Code if it doesn't exit
$type = $_REQUEST['type'];
$id = $_REQUEST['id'];
$filename = $configArray['Site']['qrcodePath'] . "/{$type}_{$id}.png";
if (!file_exists($filename)) {
include ROOT_DIR . '/sys/phpqrcode/qrlib.php';
$codeContents = $configArray['Site']['url'] . "/{$type}/{$id}/Home";
QRcode::png($codeContents, $filename, QR_ECLEVEL_L, 3);
}
readfile($filename);
$timer->writeTimings();