本文整理汇总了PHP中Debug::message方法的典型用法代码示例。如果您正苦于以下问题:PHP Debug::message方法的具体用法?PHP Debug::message怎么用?PHP Debug::message使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Debug
的用法示例。
在下文中一共展示了Debug::message方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: query
public function query($sql, $errorLevel = E_USER_ERROR)
{
if (isset($_REQUEST['previewwrite']) && in_array(strtolower(substr($sql, 0, strpos($sql, ' '))), array('insert', 'update', 'delete', 'replace'))) {
Debug::message("Will execute: {$sql}");
return;
}
if (isset($_REQUEST['showqueries'])) {
$starttime = microtime(true);
}
// @todo This is a very ugly hack to rewrite the update statement of SiteTree::doPublish()
// @see SiteTree::doPublish() There is a hack for MySQL already, maybe it's worth moving this to SiteTree or that other hack to Database...
if (preg_replace('/[\\W\\d]*/i', '', $sql) == 'UPDATESiteTree_LiveSETSortSiteTreeSortFROMSiteTreeWHERESiteTree_LiveIDSiteTreeIDANDSiteTree_LiveParentID') {
preg_match('/\\d+/i', $sql, $matches);
$sql = 'UPDATE "SiteTree_Live"
SET "Sort" = (SELECT "SiteTree"."Sort" FROM "SiteTree" WHERE "SiteTree_Live"."ID" = "SiteTree"."ID")
WHERE "ParentID" = ' . $matches[0];
}
@($handle = $this->dbConn->query($sql));
if (isset($_REQUEST['showqueries'])) {
$endtime = round(microtime(true) - $starttime, 4);
Debug::message("\n{$sql}\n{$endtime}ms\n", false);
}
DB::$lastQuery = $handle;
if (!$handle && $errorLevel) {
$msg = $this->dbConn->errorInfo();
$this->databaseError("Couldn't run query: {$sql} | " . $msg[2], $errorLevel);
}
return new SQLitePDOQuery($this, $handle);
}
示例2: getNestedController
public function getNestedController()
{
if ($this->urlParams['URLSegment']) {
$SQL_URLSegment = Convert::raw2sql($this->urlParams['URLSegment']);
if (Translatable::is_enabled()) {
$child = Translatable::get_one("SiteTree", "URLSegment = '{$SQL_URLSegment}'");
} else {
$child = DataObject::get_one("SiteTree", "URLSegment = '{$SQL_URLSegment}'");
}
if (!$child) {
$child = $this->get404Page();
}
if ($child) {
if (isset($_REQUEST['debug'])) {
Debug::message("Using record #{$child->ID} of type {$child->class} with URL {$this->urlParams['URLSegment']}");
}
$controllerClass = "{$child->class}_Controller";
if ($this->urlParams['Action'] && ClassInfo::exists($controllerClass . '_' . $this->urlParams['Action'])) {
$controllerClass = $controllerClass . '_' . $this->urlParams['Action'];
}
if (ClassInfo::exists($controllerClass)) {
$controller = new $controllerClass($child);
} else {
$controller = $child;
}
$controller->setURLParams($this->urlParams);
return $controller;
} else {
die("The requested page couldn't be found.");
}
} else {
user_error("ModelAsController not geting a URLSegment. It looks like the site isn't redirecting to home", E_USER_ERROR);
}
}
示例3: run
public function run($request)
{
// Are there members with a clear text password?
$posts = DataObject::get("BlogEntry");
$count = 0;
$commentCount = 0;
foreach ($posts as $post) {
// Delete comments
if (class_exists('Comments')) {
$comments = $post->Comments();
foreach ($comments as $comment) {
$comment->Delete();
$commentCount++;
}
}
$count++;
$post->deleteFromStage('Live');
$post->delete();
}
if ($count) {
Debug::message("Deleted {$count} posts");
} else {
Debug::message("No posts deleted");
}
if ($commentCount) {
Debug::message("Deleted {$commentCount} comments");
}
}
示例4: updateInfo
function updateInfo($percent, $infoText, $debug = true) {
global $command_line;
if ($debug) {
Debug::message($infoText, Debug::WARNING);
}
$percentageText = ($percent == 1)? '100': sprintf('%2.0f', $percent * 100);
if (isset($command_line) and $command_line) {
if ($percent < 0) {
$percentageText = ' * ';
} else {
$percentageText .= '%';
}
echo $percentageText, ' ', $infoText, "\n";
} else {
echo '<script>';
if ($percent >= 0) {
echo 'document.getElementById("progress-bar").style="width:' . ($percent * 100) . '%;";', "\n",
'document.getElementById("progress-bar").innerHTML ="' . $percentageText . '%";', "\n";
}
if ($percent == 1) {
echo 'document.getElementById("progress-bar").className = "progress-bar progress-bar-striped";';
}
echo 'document.getElementById("progressbar-info").innerHTML="' . addslashes($infoText) . '";</script>';
}
// This is for the buffer achieve the minimum size in order to flush data
// echo str_repeat(' ', 1024 * 64);
// Send output to browser immediately
flush();
}
示例5: run
/**
* 静态方法 启用框架的入口方法
*/
public static function run()
{
self::debug();
//启用Debug模块
self::pathinfo();
//启用pathinfo
self::initfile();
//检测并初始化系统
$controler_src = C('APP_PATH') . '/Action/' . $_GET['m'] . 'Action.class.php';
$runfile = C('RUN_PATH') . '/Action/' . $_GET['m'] . 'Action.class.php';
if (file_exists($controler_src)) {
self::touch($runfile, strip_whitespace(file_get_contents($controler_src)), C('DEBUG'));
$m = $_GET['m'] . 'Action';
$tmp = new $m();
Debug::addmsg("当前访问的控制器类: {$controler_src}");
method_exists($tmp, 'init') ? $tmp->init() : '';
method_exists($tmp, $_GET['a']) ? $tmp->{$_GET}['a']() : Debug::addmsg('<font color="red">当前访问的控制器类: ' . $controler_src . ' 不存在 ' . $_GET['a'] . ' 操作</font>');
} else {
Debug::addmsg("<font color='red'>当前访问的控制器类: {$controler_src} 不存在!</font>");
}
if (C('DEBUG')) {
//DEBGU检测输出
Debug::message();
}
}
示例6: query
/**
*
* @param string $sql
* @param integer $errorLevel
* @return SS_Query
*/
public function query($sql, $errorLevel = E_USER_ERROR)
{
$query = parent::query($sql, $errorLevel);
if (isset($_REQUEST['showqueries']) && Director::isDev()) {
$count = 1 + (int) Config::inst()->get('MySQLDebuggableDatabase', 'queries_count');
Config::inst()->update('MySQLDebuggableDatabase', 'queries_count', $count);
Debug::message(PHP_EOL . 'Query Counts: ' . $count . PHP_EOL, false);
}
return $query;
}
示例7: message
/**
* Output a message
*
* @param string $message
* @param int $verbosity Verbosity required to display this message (1 is default)
*/
public function message($message, $verbosity = 1)
{
if ($this->quiet) {
return;
}
if ($this->verbosity >= 0 && $this->verbosity < $verbosity) {
return;
}
Debug::message(date('Y-m-d H:i:s') . ': ' . $message, false);
}
示例8: run
public function run($request)
{
$result = $this->validateConfig();
if ($result->valid()) {
Debug::message("Fluent config is valid!", false);
} else {
Debug::message(sprintf("Fluent config invalid: %d errors found!", count($result->messageList())), false);
foreach ($result->messageList() as $message) {
Debug::message($message, false);
}
}
}
示例9: transform
public function transform($item, $parentObject, $duplicateStrategy)
{
if (Director::is_cli()) {
Debug::message("Parent: #{$parentObject->ID}, {$parentObject->Title}");
Debug::message($item->AbsoluteURL);
}
// Sleep for 100ms to reduce load on the remote server
usleep(100 * 1000);
// Extract content from the page
$contentFields = $this->getContentFieldsAndSelectors($item);
// Default value for Title
if (empty($contentFields['Title'])) {
$contentFields['Title'] = array('content' => $item->Name);
}
// Default value for URL segment
if (empty($contentFields['URLSegment'])) {
$urlSegment = str_replace('/', '', $item->Name);
$urlSegment = preg_replace('/\\.[^.]*$/', '', $urlSegment);
$urlSegment = str_replace('.', '-', $item->Name);
$contentFields['URLSegment'] = array('content' => $urlSegment);
}
$schema = $item->getSource()->getSchemaForURL($item->AbsoluteURL);
$pageType = $schema->DataType;
if (!$pageType) {
throw new Exception('Pagetype for migration schema is empty!');
}
// Create a page with the appropriate fields
$page = new $pageType(array());
$existingPage = SiteTree::get_by_link($item->getExternalId());
if ($existingPage && $duplicateStrategy === 'Overwrite') {
if (get_class($existingPage) !== $pageType) {
$existingPage->ClassName = $pageType;
$existingPage->write();
}
if ($existingPage) {
$page = $existingPage;
}
}
$page->StaticSiteContentSourceID = $item->getSource()->ID;
$page->StaticSiteURL = $item->AbsoluteURL;
$page->ParentID = $parentObject ? $parentObject->ID : 0;
foreach ($contentFields as $k => $v) {
$page->{$k} = $v['content'];
}
$page->write();
if (Director::is_cli()) {
Debug::message("#{$page->Title}");
Debug::message("#{$page->ID} child of #{$page->ID}");
}
return new TransformResult($page, $item->stageChildren());
}
示例10: run
function run($request)
{
if ($this->isFreeToLock()) {
if ($this->getLock()) {
//try to get the lock, but do nothing if someone else is quicker and gets it first
//do stuff
$this->releaseLock();
} else {
Debug::message('Aborting because another process acquired lock before this process could.', false);
}
} else {
Debug::message('Aborting because of existing lock.', false);
}
}
示例11: run
/**
* This is the main method to build the master string tables with the original strings.
* It will search for existent modules that use the i18n feature, parse the _t() calls
* and write the resultant files in the lang folder of each module.
*
* @uses DataObject->collectI18nStatics()
*
* @param SS_HTTPRequest $request
*/
public function run($request)
{
increase_time_limit_to();
$collector = i18nTextCollector::create($request->getVar('locale'));
$merge = $this->getIsMerge($request);
// Custom writer
$writerName = $request->getVar('writer');
if ($writerName) {
$writer = Injector::inst()->get($writerName);
$collector->setWriter($writer);
}
// Get restrictions
$restrictModules = $request->getVar('module') ? explode(',', $request->getVar('module')) : null;
$collector->run($restrictModules, $merge);
Debug::message(__CLASS__ . " completed!", false);
}
示例12: updateInfo
function updateInfo($percent, $infoText, $debug = true)
{
if ($debug) {
Debug::message($infoText, Debug::WARNING);
}
echo '<script language="javascript">';
if ($percent >= 0) {
echo 'document.getElementById("progressbar-inner").style="width:' . $percent * 100 . '%;";';
}
echo 'document.getElementById("progressbar-info").innerHTML="' . addslashes($infoText) . '";</script>
';
// This is for the buffer achieve the minimum size in order to flush data
// echo str_repeat(' ', 1024 * 64);
// Send output to browser immediately
flush();
}
示例13: getNestedController
public function getNestedController() {
if($this->urlParams['URLSegment']) {
$SQL_URLSegment = Convert::raw2sql($this->urlParams['URLSegment']);
$child = SiteTree::get_by_url($SQL_URLSegment);
if(!$child) {
if($child = $this->findOldPage($SQL_URLSegment)) {
$url = Controller::join_links(
Director::baseURL(),
$child->URLSegment,
$this->urlParams['Action'],
$this->urlParams['ID'],
$this->urlParams['OtherID']
);
$response = new HTTPResponse();
$response->redirect($url, 301);
return $response;
}
$child = $this->get404Page();
}
if($child) {
if(isset($_REQUEST['debug'])) Debug::message("Using record #$child->ID of type $child->class with URL {$this->urlParams['URLSegment']}");
$controllerClass = "{$child->class}_Controller";
if($this->urlParams['Action'] && ClassInfo::exists($controllerClass.'_'.$this->urlParams['Action'])) {
$controllerClass = $controllerClass.'_'.$this->urlParams['Action'];
}
if(ClassInfo::exists($controllerClass)) {
$controller = new $controllerClass($child);
} else {
$controller = $child;
}
return $controller;
} else {
return new HTTPResponse("The requested page couldn't be found.",404);
}
} else {
user_error("ModelAsController not geting a URLSegment. It looks like the site isn't redirecting to home", E_USER_ERROR);
}
}
示例14: init
public function init()
{
parent::init();
$canAccess = Director::isDev() || Director::is_cli() || Permission::check("ADMIN");
if (!$canAccess) {
return Security::permissionFailure($this);
}
if (!self::$default_reporter) {
self::set_reporter(Director::is_cli() ? 'CliDebugView' : 'DebugView');
}
if (!PhpUnitWrapper::has_php_unit()) {
die("Please install PHPUnit using pear");
}
if (!isset($_GET['flush']) || !$_GET['flush']) {
Debug::message("WARNING: Manifest not flushed. " . "Add flush=1 as an argument to discover new classes or files.\n", false);
}
}
示例15: RegisterRoutes
/**
* Registers all cached routes with silverstripe
*/
public function RegisterRoutes()
{
$cachePath = $this->getCacheFilePath();
if (!file_exists($cachePath)) {
return Debug::message('DateLink route cache file could not be found. This can be generated by using /dev/build');
}
$document = new DOMDocument();
$document->load($cachePath);
foreach ($document->getElementsByTagName('route') as $route) {
$link = $route->getElementsByTagName('link')->item(0)->nodeValue;
$parentID = $route->getElementsByTagName('page_id')->item(0)->nodeValue;
$years = $route->getElementsByTagName('year');
foreach ($years as $year) {
$this->registerRoute($link, $parentID, $year->nodeValue);
}
}
}