本文整理汇总了PHP中Cake\Error\Debugger类的典型用法代码示例。如果您正苦于以下问题:PHP Debugger类的具体用法?PHP Debugger怎么用?PHP Debugger使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Debugger类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: _outputMessage
protected function _outputMessage($template)
{
$error = $this->controller->viewVars['error'];
$data = [];
$data['class'] = 'Error';
$data['code'] = $error->getCode();
$data['url'] = '/' . $this->controller->request->url;
$data['message'] = $error->getMessage();
$data['errors'] = $this->controller->viewVars['errors'];
if (Configure::read('debug')) {
$data['DEBUG']['trace'] = Debugger::formatTrace($error->getTrace(), ['format' => 'array', 'args' => false]);
$queryLog = $this->_getQueryLog();
if ($queryLog) {
$data['DEBUG']['queryLog'] = $queryLog;
}
}
$jsonOptions = JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT;
if (Configure::read('debug')) {
$jsonOptions = $jsonOptions | JSON_PRETTY_PRINT;
}
$this->controller->response->type('json');
$this->controller->response->body(json_encode($data, $jsonOptions));
$this->controller->response->statusCode($data['code']);
return $this->controller->response;
}
开发者ID:pwerken,项目名称:va-void,代码行数:25,代码来源:ApiExceptionRenderer.php
示例2: __construct
/**
* {@inheritDoc}
*/
public function __construct(array $config = [])
{
if (Configure::read('debug')) {
Debugger::checkSecurityKeys();
}
parent::config($config);
}
开发者ID:JesseDarellMoore,项目名称:CS499,代码行数:10,代码来源:WeakPasswordHasher.php
示例3: _createStreamDataWithEntity
public function _createStreamDataWithEntity($entity, $entity_type)
{
// if(!$entity_type){
// $entity_type = get_class($entity);
// }
$entity_type_p = $entity_type . 's';
// debug($entity);
// $game = $this->_contains($game)->first();
$success = $entity->format(null, 'feed_push');
if (!$success) {
Debugger::log('It failed after formatting the game');
return false;
}
$base_data = ["object" => $entity_type . ":" . $entity->id, 'type' => "feed-" . strtolower($entity_type_p), 'foreign_id' => $entity_type . ":" . $entity->id, 'display' => $entity->display];
if ($entity_type == 'Game') {
$specific_data = ["verb" => strtolower($entity->game_type_name), 'first_user_image' => $entity->winner_image, 'first_user_id' => $entity->winner_id, 'first_user_score' => $entity->winner_points, 'second_user_image' => $entity->loser_image, 'second_user_id' => $entity->loser_id, 'second_user_score' => $entity->loser_points, 'game_type_name' => $entity->game_type_name, 'time' => $entity->created];
} else {
if ($entity_type == 'Friendship') {
$specific_data = ["verb" => "friend", 'first_user_id' => $entity->first_user_id, 'first_user_image' => $entity->first_user_image, 'second_user_id' => $entity->second_user_id, 'second_user_image' => $entity->second_user_image, 'time' => $entity->modified];
} else {
return false;
}
}
$base_data = array_merge($base_data, $specific_data);
return $base_data;
}
开发者ID:abf6ug,项目名称:statbro,代码行数:26,代码来源:StreamComponent.php
示例4: start
/**
* Start an benchmarking timer.
*
* @param string $name The name of the timer to start.
* @param string $message A message for your timer
* @return boolean Always true
*/
public static function start($name = null, $message = null)
{
$start = microtime(true);
if (!$name) {
$named = false;
$calledFrom = debug_backtrace();
$_name = $name = Debugger::trimpath($calledFrom[0]['file']) . ' line ' . $calledFrom[0]['line'];
} else {
$named = true;
}
if (!$message) {
$message = $name;
}
$_name = $name;
$i = 1;
while (isset(self::$_timers[$name])) {
$i++;
$name = $_name . ' #' . $i;
}
if ($i > 1) {
$message .= ' #' . $i;
}
self::$_timers[$name] = array('start' => $start, 'message' => $message, 'named' => $named);
return true;
}
开发者ID:meotimdihia,项目名称:cakephp-test-elasticsearch,代码行数:32,代码来源:DebugTimer.php
示例5: addCall
/**
* Add a HTTP call to the data
*
* @param Request $request Call request
* @param Response $response Call response
* @param float $time duration of the call
*/
public static function addCall($request, $response, $time = null)
{
$calls = static::config('calls');
$trace = Debugger::trace(['start' => 2]);
$calls[] = ['request' => ['uri' => (string) $request->getUri(), 'body' => $request->body(), 'method' => $request->getMethod(), 'headers' => $request->getHeaders(), 'content-type' => $request->getHeader('Content-Type')], 'response' => ['body' => $response->body(), 'status_code' => $response->getStatusCode(), 'headers' => $response->getHeaders(), 'content-type' => $response->getHeader('Content-Type')], 'time' => $time, 'trace' => $trace];
static::drop('calls');
static::config('calls', $calls);
}
开发者ID:dorxy,项目名称:debug_http,代码行数:15,代码来源:ClientCallPanel.php
示例6: getHtml
/**
* get the body for htmll message
*
* @access private
* @author sakuragawa
*/
private function getHtml($message, $file, $line, $context = null)
{
$params = Router::getRequest();
$trace = Debugger::trace(array('start' => 2, 'format' => 'base'));
$session = isset($_SESSION) ? $_SESSION : array();
$msg = array('<p><strong>', $message, '</strong></p>', '<p>', $file . '(' . $line . ')', '</p>', '', '<h2>', 'Backtrace:', '</h2>', '', '<pre>', self::dumper($trace), '</pre>', '', '<h2>', 'Request:', '</h2>', '', '<h3>URL</h3>', $this->url(), '<h3>Client IP</h3>', $this->getClientIp(), '<h3>Referer</h3>', env('HTTP_REFERER'), '<h3>Parameters</h3>', self::dumper($params), '<h3>Cake root</h3>', APP, '', '<h2>', 'Environment:', '</h2>', '', self::dumper($_SERVER), '', '<h2>', 'Session:', '</h2>', '', self::dumper($session), '', '<h2>', 'Cookie:', '</h2>', '', self::dumper($_COOKIE), '', '<h2>', 'Context:', '</h2>', '', self::dumper($context), '');
return join("", $msg);
}
开发者ID:fusic,项目名称:encount,代码行数:14,代码来源:Mail.php
示例7: addCall
/**
* Add a HTTP call to the data
*
* @param $request
* @param $response
* @param $time
*/
public static function addCall($request, $response, $time = null)
{
$calls = static::config('calls');
$trace = Debugger::trace(['start' => 2]);
$calls[] = ['request' => $request, 'response' => $response, 'time' => $time, 'trace' => $trace];
static::drop('calls');
static::config('calls', $calls);
}
开发者ID:Oxicode,项目名称:debug_http,代码行数:15,代码来源:ClientCallPanel.php
示例8: change
/**
* Change Method.
*
* Write your reversible migrations using this method.
*
* More information on writing migrations is available here:
* http://docs.phinx.org/en/latest/migrations.html#the-abstractmigration-class
*
* @return void
*/
public function change()
{
$table = $this->table('queued_tasks');
try {
$adapter = new MysqlAdapter([]);
if ($adapter->getSqlType('text', 'longtext')) {
$table->changeColumn('data', 'text', ['limit' => MysqlAdapter::TEXT_LONG, 'null' => true, 'default' => null]);
}
} catch (Exception $e) {
Debugger::dump($e->getMessage());
}
}
开发者ID:dereuromark,项目名称:cakephp-queue,代码行数:22,代码来源:20161319000000_increase_data_size.php
示例9: createAdmin
/**
* @param string $userId
* @return bool
*/
public function createAdmin($userId)
{
$teamMembership = TableRegistry::get('TeamMemberships');
$adminship = new TeamMembership(['role' => 'admin', 'team_id' => $this->id, 'member_id' => $userId]);
$isCurrentMember = $teamMembership->find()->where(['member_id' => $userId, 'team_id' => $this->id])->first();
Debugger::log($isCurrentMember);
if (!empty($isCurrentMember)) {
$adminship->id = $isCurrentMember->id;
}
if (!$teamMembership->save($adminship)) {
return false;
}
return true;
}
开发者ID:abf6ug,项目名称:statbro,代码行数:18,代码来源:Team.php
示例10: _getErrorData
/**
* Helper method used to generate extra debugging data into the error template
*
* @return array debugging data
*/
protected function _getErrorData()
{
$data = [];
$viewVars = $this->controller->viewVars;
if (!empty($viewVars['_serialize'])) {
foreach ($viewVars['_serialize'] as $v) {
$data[$v] = $viewVars[$v];
}
}
if (!empty($viewVars['error']) && Configure::read('debug')) {
$data['exception'] = ['class' => get_class($viewVars['error']), 'code' => $viewVars['error']->getCode(), 'message' => $viewVars['error']->getMessage()];
if (!isset($data['trace'])) {
$data['trace'] = Debugger::formatTrace($viewVars['error']->getTrace(), ['format' => 'array', 'args' => false]);
}
}
return $data;
}
开发者ID:friendsofcake,项目名称:crud,代码行数:22,代码来源:ExceptionRenderer.php
示例11: main
/**
* Make tasks callable
*
* @return void
*/
public function main()
{
if (!empty($this->params['dry-run'])) {
$this->out('<warning>Dry-run mode enabled!</warning>', 1, Shell::QUIET);
}
$exclude = ['.git', '.svn', 'vendor', 'Vendor', 'webroot', 'tmp', 'logs'];
if (empty($this->params['plugin']) && !empty($this->params['namespace']) && $this->params['namespace'] === 'App') {
$exclude[] = 'plugins';
$exclude[] = 'Plugin';
}
$files = $this->Stage->files($exclude);
foreach ($files as $file) {
$this->out(sprintf('<info>Processing %s</info>', Debugger::trimPath($file)));
$this->process($file);
}
$this->Stage->commit();
}
开发者ID:cakephp,项目名称:upgrade,代码行数:22,代码来源:ChangeTrait.php
示例12: record
/**
* Stores a memory point in the internal tracker.
* Takes a optional message name which can be used to identify the memory point.
* If no message is supplied a debug_backtrace will be done to identify the memory point.
*
* @param string $message Message to identify this memory point.
* @return bool
*/
public static function record($message = null)
{
$memoryUse = self::getCurrent();
if (!$message) {
$trace = debug_backtrace();
$message = Debugger::trimPath($trace[0]['file']) . ' line ' . $trace[0]['line'];
}
if (isset(self::$_points[$message])) {
$originalMessage = $message;
$i = 1;
while (isset(self::$_points[$message])) {
$i++;
$message = $originalMessage . ' #' . $i;
}
}
self::$_points[$message] = $memoryUse;
return true;
}
开发者ID:cakephp,项目名称:debug_kit,代码行数:26,代码来源:DebugMemory.php
示例13: all
/**
* All command.
*
* @return void
*/
public function all()
{
if (!empty($this->params['dry-run'])) {
$this->out('<warning>Dry-run mode enabled!</warning>', 1, Shell::QUIET);
}
$exclude = ['.git', '.svn', 'vendor', 'Vendor', 'webroot', 'tmp', 'logs'];
if (empty($this->params['plugin']) && !empty($this->params['namespace']) && $this->params['namespace'] === 'App') {
$exclude[] = 'plugins';
$exclude[] = 'Plugin';
}
$files = $this->Stage->files($exclude);
$actions = $this->_getActions();
foreach ($actions as $action) {
$this->out(sprintf('<info>*** Upgrade step %s ***</info>', $action));
if (!empty($this->params['interactive'])) {
$continue = $this->in('Continue with `' . $action . '`?', array('y', 'n', 'q'), 'y');
if ($continue === 'q') {
return $this->error('Aborted. Changes are not commited.');
}
if ($continue === 'n') {
$this->out('Skipping this step.');
continue;
}
}
foreach ($files as $file) {
$this->out(sprintf('<info> * Processing %s</info>', Debugger::trimPath($file)), 1, Shell::VERBOSE);
$this->{$action}->Stage = $this->Stage;
$this->{$action}->process($file);
if (!empty($this->params['interactive'])) {
$this->Stage->commit();
$this->Stage->clear();
}
}
}
if (empty($this->params['interactive'])) {
$this->Stage->commit();
}
}
开发者ID:ndm2,项目名称:upgrade,代码行数:43,代码来源:UpgradeShell.php
示例14: import
public function import()
{
if ($this->request->is('post')) {
if ($this->request->data['submissionFile'] == '') {
$this->set('file_status', 'No file submitted, try again.');
} elseif ($this->request->data['submissionFile']) {
$this->set('file_status', 'File submitted.');
Debugger::dump($this->request->data['submissionFile']);
Debugger::dump($this->request->data['table']);
if ($this->request->data['table'] == 0) {
Debugger::dump($this->request->data['submissionFile']);
} elseif ($this->request->data['table'] == 1) {
} elseif ($this->request->data['table'] == 2) {
} else {
$this->Flash->error('Unexpected table value');
}
$this->Flash->success('File successfully uploaded, Importing...');
} else {
$this->set('file_status', 'Please submit a file.');
}
} else {
$this->set('file_status', 'Please submit a file.');
}
}
开发者ID:JesseDarellMoore,项目名称:CS499,代码行数:24,代码来源:AdminDataController.php
示例15: debug
/**
* Prints out debug information about given variable.
*
* Only runs if debug level is greater than zero.
*
* @param boolean $var Variable to show debug information for.
* @param boolean $showHtml If set to true, the method prints the debug data in a browser-friendly way.
* @param boolean $showFrom If set to true, the method prints from where the function was called.
* @return void
* @link http://book.cakephp.org/2.0/en/development/debugging.html#basic-debugging
* @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#debug
*/
public static function debug($var, $showHtml = null, $showFrom = true)
{
if (Configure::read('debug') > 0) {
// App::uses('Debugger', 'Utility');
$file = '';
$line = '';
$lineInfo = '';
if ($showFrom) {
$trace = Debugger::trace(array('start' => 1, 'depth' => 2, 'format' => 'array'));
$file = str_replace(array(CAKE_CORE_INCLUDE_PATH, ROOT), '', $trace[0]['file']);
$line = $trace[0]['line'];
}
$html = <<<HTML
<div class="cake-debug-output">
<pre class="cake-debug">
%s
</pre>
</div>
HTML;
$text = <<<TEXT
%s
########## DEBUG ##########
%s
###########################
TEXT;
$template = $html;
if (php_sapi_name() === 'cli' || $showHtml === false) {
$template = $text;
if ($showFrom) {
$lineInfo = sprintf('%s (line %s)', $file, $line);
}
}
if ($showHtml === null && $template !== $text) {
$showHtml = true;
}
$var = Debugger::exportVar($var, 25);
if ($showHtml) {
$template = $html;
$var = htmlspecialchars($var);
if ($showFrom) {
$lineInfo = sprintf('<span><strong>%s</strong> (line <strong>%s</strong>)</span>', $file, $line);
}
}
printf($template, $var);
}
}
开发者ID:OrigamiStructures,项目名称:foldingTime,代码行数:59,代码来源:dmDebug.php
示例16: main
/**
* Start the shell and interactive console.
*
* @return int|void
*/
public function main()
{
$sa_table = TableRegistry::get('Friendships');
$fitbit_accounts = $sa_table->find()->matching('Froms.SocialAccounts', function ($q) {
return $q->where(['provider' => 'Fitbit']);
})->contain(['Tos']);
$game = TableRegistry::get('Games');
$controller = new AppController();
$stream = $controller->loadComponent('Stream');
$tm_table = TableRegistry::get('TempMembers');
debug(Time::now()->i18nFormat('yyyy-MM-dd 00:00:00'));
$lr_table = TableRegistry::get('LinkedRecords');
foreach ($fitbit_accounts as $fitbit_account) {
//find all pairings of fitbit friends
if (empty($social_accounts = $fitbit_account['to']['social_accounts'])) {
continue;
}
$fitbit_social_account = false;
foreach ($social_accounts as $social_account) {
if ($social_account->provider == 'Fitbit') {
$fitbit_social_account = $social_account->id;
}
}
if (!$fitbit_social_account) {
continue;
}
//
//find todays linked record
$to = $lr_table->find()->where(['social_account_id' => $fitbit_social_account, 'associated_date' => Time::now()->i18nFormat('yyyy-MM-dd 00:00:00')]);
if (!$to->first()) {
continue;
}
//
// debug($to->first());
// return;
$to_mem = ['member_id' => $fitbit_account->to->id, 'points' => null, 'role' => 'member', 'linked_record_id' => $to->first()->id];
if (empty($social_accounts = $fitbit_account['from']['social_accounts'])) {
continue;
}
$fitbit_social_account = false;
foreach ($social_accounts as $social_account) {
if ($social_account->provider == 'Fitbit') {
$fitbit_social_account = $social_account->id;
}
}
if (!$fitbit_social_account) {
continue;
}
$from = $lr_table->find()->where(['social_account_id' => $fitbit_social_account, 'associated_date' => Time::now()->i18nFormat('yyyy-MM-dd 00:00:00')]);
if (!$from->first()) {
continue;
}
$from_mem = ['member_id' => $fitbit_account->from->id, 'points' => null, 'role' => 'member', 'linked_record_id' => $from->first()->id];
$game_array = ['status' => 'complete', 'score_type' => 'score', 'game_type_id' => '81e376fa-9f08-4814-82e7-00a2cbf1935b', 'game_memberships' => [$to_mem, $from_mem]];
$new_game = $game->newEntity($game_array);
if ($game->save($new_game)) {
$base_data = $stream->_createStreamData($new_game->id, 'Game');
Debugger::log($base_data);
if ($base_data) {
if (!$tm_table->exists(['id' => $base_data['first_user_id']])) {
$stream->_pushToStream($base_data, $base_data['first_user_id']);
}
if (!$tm_table->exists(['id' => $base_data['second_user_id']])) {
$stream->_pushToStream($base_data, $base_data['second_user_id']);
}
}
}
}
}
开发者ID:abf6ug,项目名称:statbro,代码行数:74,代码来源:CreateFitbitGamesShell.php
示例17: afterUninstall
/**
* Triggered after plugin is removed from DB and after its directory was removed.
*
* @param \Cake\Event\Event $event
* @return void
*/
public function afterUninstall(Event $event)
{
Debugger::log('afterUninstall: ' . $this->_line());
}
开发者ID:quickapps-plugins,项目名称:space-oddity,代码行数:10,代码来源:SpaceOddityHook.php
示例18: checkMinMaxValuesAndSendToastNotifications
/**
* @param $http
* @param $Notifier
*/
private function checkMinMaxValuesAndSendToastNotifications($Notifier, $tick_names_and_values)
{
$stocksAffectedMax = array();
$stocksAffectedMin = array();
$valueOfStocksAffectedMax = array();
$valueOfStocksAffectedMin = array();
for ($i = 0; $i < sizeof($tick_names_and_values); $i++) {
$stockAffectedMax = $this->Stocks->find()->where(['maximum <=' => $tick_names_and_values[$i][1], 'tick_name =' => $tick_names_and_values[$i][0]])->toArray();
$stockAffectedMin = $this->Stocks->find()->where(['minimum >=' => $tick_names_and_values[$i][1], 'tick_name =' => $tick_names_and_values[$i][0]])->toArray();
for ($a = 0; $a < sizeof($stockAffectedMax); $a++) {
$stocksAffectedMax[] = $stockAffectedMax[$a];
$valueOfStocksAffectedMax[] = $tick_names_and_values[$i][1];
}
for ($a = 0; $a < sizeof($stockAffectedMin); $a++) {
$stocksAffectedMin[] = $stockAffectedMin[$a];
$valueOfStocksAffectedMin[] = $tick_names_and_values[$i][1];
}
}
Debugger::dump('stocksAffectedMax: ');
Debugger::dump($stocksAffectedMax);
Debugger::dump('stocksAffectedMin: ');
Debugger::dump($stocksAffectedMin);
for ($i = 0; $i < sizeof($stocksAffectedMax); $i++) {
Debugger::dump('$stocksAffectedMax[' . $i . ']');
Debugger::dump($stocksAffectedMax[$i]);
$id = $stocksAffectedMax[$i]['device_id'];
$device = $this->Devices->get($id, ['contain' => []]);
$channelURI = $device['name'];
Debugger::dump($channelURI);
//$MyToastXML = '<toast><visual><binding template="ToastText02"><text id="1">'.$stocksAffectedMax[$i]['tick_name'].' atingiu máximo'.'</text><text id="2">VALOR</text></binding></visual></toast>';
//$responseToSendMsg = $Notifier->Send($channelURI, TemplateToast::ToastText01($stocksAffectedMax[$i]['tick_name'] . " atingiu máximo!"));
$responseToSendMsg = $Notifier->Send($channelURI, TemplateToast::ToastText02($stocksAffectedMax[$i]['tick_name'] . " atingiu máximo!", $valueOfStocksAffectedMax[$i], TemplateToast::NotificationMail));
//$responseToSendMsg = $Notifier->Send($channelURI,$MyToastXML);
Debugger::dump($responseToSendMsg);
}
for ($i = 0; $i < sizeof($stocksAffectedMin); $i++) {
Debugger::dump('$stocksAffectedMin[' . $i . ']');
Debugger::dump($stocksAffectedMin[$i]);
$id = $stocksAffectedMin[$i]['device_id'];
$device = $this->Devices->get($id, ['contain' => []]);
$channelURI = $device['name'];
Debugger::dump($channelURI);
//$MyToastXML = '<toast><visual><binding template="ToastText02"><text id="1">'.$stocksAffectedMin[$i]['tick_name'].' atingiu mínimo'.'</text><text id="2">VALOR</text></binding></visual></toast>';
//$responseToSendMsg = $Notifier->Send($channelURI, TemplateToast::ToastText01($stocksAffectedMin[$i]['tick_name'] . " atingiu mínimo!"));
$responseToSendMsg = $Notifier->Send($channelURI, TemplateToast::ToastText02($stocksAffectedMin[$i]['tick_name'] . " atingiu mínimo!", $valueOfStocksAffectedMin[$i], TemplateToast::NotificationMail));
//$responseToSendMsg = $Notifier->Send($channelURI,$MyToastXML);
Debugger::dump($responseToSendMsg);
}
}
开发者ID:luisfilipe46,项目名称:Stock-Exchange-System-Server,代码行数:53,代码来源:FileShell.php
示例19: commit
/**
* Write staged changes
*
* If it's a dry run though - only show what will be done, don't do anything
*
* @param string $path file path
* @return void
*/
public function commit($path = null)
{
if (!$path) {
foreach (array_keys($this->_staged['change']) as $path) {
$this->commit($path);
}
foreach ($this->_staged['move'] as $path => $to) {
if (isset($this->_staged['change'][$path])) {
continue;
}
$this->commit($path);
}
foreach ($this->_staged['delete'] as $path) {
$this->commit($path);
}
$Folder = new Folder(TMP . 'upgrade');
$Folder->delete();
return;
}
$dryRun = !empty($this->params['dry-run']);
$isMove = isset($this->_staged['move'][$path]);
$isChanged = isset($this->_staged['change'][$path]) && count($this->_staged['change'][$path]) > 1;
$isDelete = in_array($path, $this->_staged['delete']);
if (!$isMove && !$isChanged && !$isDelete) {
return;
}
$gitCd = sprintf('cd %s && ', escapeshellarg(dirname($path)));
if ($isDelete) {
$this->out(sprintf('<info>Delete %s</info>', Debugger::trimPath($path)));
if ($dryRun) {
return true;
}
if (!empty($this->params['git'])) {
exec($gitCd . sprintf('git rm -f %s', escapeshellarg($path)));
return;
}
if (is_dir($path)) {
$Folder = new Folder($path);
return $Folder->delete();
}
$File = new File($path, true);
return $File->delete();
}
if ($isMove && !$isChanged) {
$to = $this->_staged['move'][$path];
$this->out(sprintf('<info>Move %s to %s</info>', Debugger::trimPath($path), Debugger::trimPath($to)));
if ($dryRun || !file_exists($path)) {
return true;
}
if (!empty($this->params['git'])) {
return $this->_gitMove($gitCd, $path, $to);
}
if (is_dir($path)) {
$Folder = new Folder($path);
return $Folder->move($to);
}
$File = new File($to, true);
return $File->write(file_get_contents($path)) && unlink($path);
}
$start = reset($this->_staged['change'][$path]);
end($this->_staged['change'][$path]);
$final = end($this->_staged['change'][$path]);
$oPath = TMP . 'upgrade' . DS . $start;
$uPath = TMP . 'upgrade' . DS . $final;
exec('git diff --no-index ' . escapeshellarg($oPath) . ' ' . escapeshellarg($uPath), $output);
$output = implode($output, "\n");
$i = strrpos($output, $final);
$diff = substr($output, $i + 41);
if ($isMove) {
$to = $this->_staged['move'][$path];
$this->out(sprintf('<info>Move %s to %s and update</info>', Debugger::trimPath($path), Debugger::trimPath($to)));
} else {
$this->out(sprintf('<info>Update %s</info>', Debugger::trimPath($path)));
}
$this->out($diff, 1, $dryRun ? Shell::NORMAL : SHELL::VERBOSE);
if ($dryRun || !file_exists($path)) {
return true;
}
if ($isMove) {
if (!empty($this->params['git'])) {
$this->_gitMove($gitCd, $path, $to);
} else {
unlink($path);
}
$path = $to;
}
$File = new File($path, true);
return $File->write(file_get_contents($uPath));
}
开发者ID:cakephp,项目名称:upgrade,代码行数:97,代码来源:StageTask.php
示例20: render
/**
* Renders the response for the exception.
*
* @return \Cake\Network\Response The response to be sent.
*/
public function render()
{
$exception = $this->error;
$code = $this->_code($exception);
$method = $this->_method($exception);
$template = $this->_template($exception, $method, $code);
$unwrapped = $this->_unwrap($exception);
$isDebug = Configure::read('debug');
if (($isDebug || $exception instanceof HttpException) && method_exists($this, $method)) {
return $this->_customMethod($method, $unwrapped);
}
$message = $this->_message($exception, $code);
$url = $this->controller->request->here();
if (method_exists($exception, 'responseHeader')) {
$this->controller->response->header($exception->responseHeader());
}
$this->controller->response->statusCode($code);
$viewVars = ['message' => $message, 'url' => h($url), 'error' => $unwrapped, 'code' => $code, '_serialize' => ['message', 'url', 'code']];
if ($isDebug) {
$viewVars['trace'] = Debugger::formatTrace($unwrapped->getTrace(), ['format' => 'array', 'args' => false]);
$viewVars['_serialize'][] = 'trace';
}
$this->controller->set($viewVars);
if ($unwrapped instanceof CakeException && $isDebug) {
$this->controller->set($unwrapped->getAttributes());
}
return $this->_outputMessage($template);
}
开发者ID:JesseDarellMoore,项目名称:CS499,代码行数:33,代码来源:ExceptionRenderer.php
注:本文中的Cake\Error\Debugger类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论