本文整理汇总了PHP中CakeLog::write方法的典型用法代码示例。如果您正苦于以下问题:PHP CakeLog::write方法的具体用法?PHP CakeLog::write怎么用?PHP CakeLog::write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CakeLog
的用法示例。
在下文中一共展示了CakeLog::write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onProductBought
public function onProductBought($event)
{
$this->Product->id = $event->data['product']['id'];
$this->Product->recursive = 2;
$product = $this->Product->read();
if ($product[$this->Product->WebhostingProduct->alias]['id'] === null) {
return;
}
$this->Product->WebhostingProduct->HostGroup->id = $product['HostGroup']['id'];
$this->Product->WebhostingProduct->HostGroup->recursive = 2;
$hostGroup = $this->Product->WebhostingProduct->HostGroup->read();
$WebhostingProvider = BasicWebhostingProvider::get($hostGroup['Host'][0]['Provider']['class']);
$webhostingPackage = $this->WebhostingPackage->createFromWebhostingProduct($product['WebhostingProduct'], $event->data['customer']['id'], $hostGroup['Host'][0]['id']);
$webhostingDetails = $WebhostingProvider->createPackage($webhostingPackage['WebhostingPackage']['id']);
if ($webhostingDetails === false) {
CakeLog::write(LOG_ERROR, __d('pltfrm', 'Webhosting provider %1$s could not create webhosting package with id %2$d owned by %3$s', $hostGroup['Host'][0]['Provider']['class'], $webhostingPackage['WebhostingPackage']['id'], $webhostingPackage['Customer']['name']), array('webhosting', 'pltfrm'));
return false;
}
$eventData = array();
$eventData['webhosting']['id'] = $webhostingPackage['WebhostingPackage']['id'];
$eventData['details'] = $webhostingDetails;
$eventData['metadata'] = array();
$webhostingCreatedEvent = new CakeEvent('Webhosting.created', $this, $eventData);
CakeEventManager::instance()->dispatch($webhostingCreatedEvent);
CakeLog::write(LOG_INFO, __d('pltfrm', 'Webhosting provider %1$s created webhosting package with id %2$d', $hostGroup['Host'][0]['Provider']['class'], $webhostingPackage['WebhostingPackage']['id']), array('webhosting', 'pltfrm'));
if (isset($event->data['order'])) {
$this->OrderProduct->changeStatus('delivered', $event->data['order']['product_id']);
}
return true;
}
示例2: after_add
/**
* after_countup
*
* @param mixed $event
*/
public function after_add($event)
{
CakeLog::write('info', sprintf("Slide added. id=%s key=%s", $event->data['id'], $event->data['key']));
$this->SimpleQueue = ClassRegistry::init('SQS.SimpleQueue');
$this->SimpleQueue->send('extract', array('id' => $event->data['id'], 'key' => $event->data['key']));
return true;
}
示例3: send
/**
* Sends out email via Mandrill
*
* @return array Return the Mandrill
*/
public function send(CakeEmail $email)
{
$this->_Email = $email;
$this->_config = $this->_Email->config() + (array) Configure::read('Mandrill');
if (empty($this->_config['apiKey'])) {
throw new InternalErrorException('No API key');
}
if (empty($this->_config['uri'])) {
$this->_config['uri'] = static::API_URL;
}
$include = ['from', 'to', 'cc', 'bcc', 'replyTo', 'subject'];
$this->_headers = $this->_Email->getHeaders($include);
$message = $this->_buildMessage();
$request = ['header' => ['Accept' => 'application/json', 'Content-Type' => 'application/json']];
$template = $this->_Email->template();
if ($template['template'] && !empty($this->_config['useTemplate'])) {
$messageUri = $this->_config['uri'] . "messages/send-template.json";
} else {
$messageUri = $this->_config['uri'] . "messages/send.json";
}
// Perform the http connection
$returnMandrill = $this->_post($messageUri, $message, $request);
// Parse mandrill results
$result = json_decode($returnMandrill, true);
if (!empty($this->_config['log'])) {
CakeLog::write('mandrill', print_r($result, true));
}
$headers = $this->_headersToString($this->_headers);
return array_merge(['Mandrill' => $result], ['headers' => $headers, 'message' => $message]);
}
示例4: changeStatus
public function changeStatus(Model $Model, $status, $id = null, $force = false)
{
if ($id === null) {
$id = $Model->getID();
}
if ($id === false) {
return false;
}
$force = true;
$Model->id = $id;
if (!$Model->exists()) {
throw new NotFoundException();
}
if ($force !== true) {
$modelData = $Model->read();
if ($modelData[$Model->alias]['status'] === $status) {
CakeLog::write(LOG_WARNING, __d('webshop', 'The status of %1$s with id %2$d is already set to %3$s. Not making a change', strtolower(Inflector::humanize(Inflector::underscore($Model->name))), $id, $status), array('webshop'));
return false;
}
} else {
CakeLog::write(LOG_WARNING, __d('webshop', 'Status change of %1$s with id %2$d is being forced to %3$s', strtolower(Inflector::humanize(Inflector::underscore($Model->name))), $id, $status), array('webshop'));
}
$Model->saveField('status', $status);
CakeLog::write(LOG_INFO, __d('webshop', 'Changed status of %1$s with id %2$d to %3$s', strtolower(Inflector::humanize(Inflector::underscore($Model->name))), $id, $status), array('webshop'));
$eventData = array();
$eventData[Inflector::underscore($Model->name)]['id'] = $id;
$eventData[Inflector::underscore($Model->name)]['status'] = $status;
$overallEvent = new CakeEvent($Model->name . '.statusChanged', $this, $eventData);
$specificEvent = new CakeEvent($Model->name . '.statusChangedTo' . Inflector::camelize($status), $this, $eventData);
CakeEventManager::instance()->dispatch($overallEvent);
CakeEventManager::instance()->dispatch($specificEvent);
return true;
}
示例5: convertToMo
public static function convertToMo($source, $destination)
{
Converter::admin_clear_cache();
$shellCmd = 'msgfmt -cv -o ' . $destination . ' ' . $source . ' 2>&1';
$result = shell_exec($shellCmd);
CakeLog::write('debug', 'Translation : ' . $result . 'Path : ' . $destination);
}
示例6: forgotPassword
public function forgotPassword()
{
$this->layout = '';
CakeLog::write('info', 'In PasswordController,forgotPassword()');
$email = trim($this->request->data['email']);
$password = '';
if (!empty($email)) {
$this->loadModel('User');
$userInfo = $this->User->find('first', array('conditions' => array('txt_email' => $email)));
if ($userInfo) {
$password = base64_decode($userInfo['User']['txt_pswd']);
} else {
$this->Session->write('forgot_pswd_msg', 'Invalid Email Id');
$this->redirect('/Password/forgot_password');
}
$this->Email->smtpOptions = array('port' => '587', 'timeout' => '30', 'host' => 'ideaclicks.in', 'username' => 'innovation@ideaclicks.in', 'password' => 'C204LaValle#', 'client' => 'ideaclicks.in', 'tls' => true);
$message = "Welcome to IdeaClicks !\n\r" . "Your Password is :" . $password . "\n\rYou can login using this URL : " . "www.ideaclicks.in" . "\n\rHappy innovation !" . "\n\rTeam IdeaClicks.";
$this->Email->delivery = 'smtp';
$this->Email->from = 'innovation@ideaclicks.in';
$this->Email->to = $email;
$this->Email->subject = 'IdeaClicks : Your Password';
$this->Email->send($message);
$this->Session->write('forgot_pswd_msg', 'Email has been Send');
CakeLog::write('info', 'In PasswordController,Email has been Send');
}
}
示例7: upload
/**
* Uploads data specified by the uploadify DOM element.
*
* @param array $options Associative array of options.
*/
function upload($options = array())
{
if (!empty($_FILES)) {
$file_data = isset($_REQUEST["fileDataName"]) ? $_REQUEST["fileDataName"] : "Filedata";
$temp_file = $_FILES[$file_data]['tmp_name'];
$target_path = $this->get_target_folder($options);
if (!file_exists($target_path)) {
CakeLog::write("debug", "Creating directory: {$target_path}");
$old = umask(0);
mkdir($target_path, 0777, true);
umask($old);
}
$filename_prefix = isset($options["filename_prefix"]) ? $options["filename_prefix"] : "";
$target_file = str_replace('//', '/', $target_path) . "/{$filename_prefix}" . $_FILES[$file_data]['name'];
// $fileTypes = str_replace('*.','',$_REQUEST['fileext']);
// $fileTypes = str_replace(';','|',$fileTypes);
// $typesArray = split('\|',$fileTypes);
// $fileParts = pathinfo($_FILES[$file_data]['name']);
// if (in_array($fileParts['extension'],$typesArray)) {
// Uncomment the following line if you want to make the directory if it doesn't exist
// mkdir(str_replace('//','/',$target_path), 0755, true);
$success = move_uploaded_file($temp_file, $target_file);
return $success ? $target_file : $success;
//echo str_replace($_SERVER['DOCUMENT_ROOT'],'',$target_file);
// } else {
// echo 'Invalid file type.';
// }
}
}
示例8: setup
public function setup($environment = null)
{
if (Configure::read('Environment.setup')) {
return;
}
$current = $environment === null ? 'development' : $environment;
if (empty($environment)) {
foreach ($this->environments as $name => $config) {
if ($this->_cliMatch($name) || $this->_match($config['params'])) {
$current = $name;
break;
}
}
}
$config = array_merge($this->environments[$current]['config'], array('Environment.name' => $current));
foreach ($config as $param => $value) {
if (isset($this->_configMap[$param])) {
$param = $this->_configMap[$param];
}
Configure::write($param, $value);
}
if (is_callable($this->environments[$current]['callable'])) {
$this->environments[$current]['callable']();
}
if (Configure::read('debug') > 0) {
App::uses('CakeLog', 'Log');
if (class_exists('CakeLog')) {
CakeLog::write(LOG_INFO, $current);
Configure::write('Environment.setup', true);
}
}
}
示例9: log
/**
* Overwrite log to write log files in Cake tmp/logs/.
*
* @param string $msg
* @return void
*/
public function log($msg)
{
if (!$this->debug) {
return;
}
CakeLog::write('mandrill', $msg);
}
示例10: processSubscription
public function processSubscription()
{
if (!$this->request->is('post') || !isset($this->request->data['bt_signature']) || !isset($this->request->data['bt_payload'])) {
$this->response->statusCode(404);
return $this->response;
}
$webhookNotification = Braintree_WebhookNotification::parse($this->request->data['bt_signature'], $this->request->data['bt_payload']);
if (!isset($webhookNotification->subscription)) {
$this->response->statusCode(404);
return $this->response;
}
CakeLog::write('debug', __d('billing', '%s Braintree webhook for subscription %s: %s', $webhookNotification->timestamp, $webhookNotification->subscription->id, $webhookNotification->kind));
$braintreeSubscription = $webhookNotification->subscription;
CakeLog::write('debug', json_encode($webhookNotification->subscription));
$subscription = $this->BillingSubscription->findByRemoteSubscriptionId($braintreeSubscription->id);
if (empty($subscription)) {
$this->response->statusCode(404);
return $this->response;
}
switch ($braintreeSubscription->status) {
case 'Canceled':
$result = $this->BillingSubscription->cancel($subscription['BillingSubscription']['id']);
break;
default:
$result = true;
}
if ($result) {
$this->response->statusCode(200);
} else {
$this->response->statusCode(500);
}
return $this->response;
}
示例11: throwError
protected function throwError($mustacheError = '')
{
if (Configure::write('debug') > 0) {
return debug(compact('mustacheError'));
}
return CakeLog::write('error', compact('mustacheError'));
}
示例12: _setLanguage
private function _setLanguage()
{
if ($this->Cookie->read('lang')) {
CakeLog::write('Language', 'Cookie');
Configure::write('Config.language', $this->Cookie->read('lang'));
$this->Session->write('Config.language', $this->Cookie->read('lang'));
} else {
if ($this->Session->check('Config.Language')) {
CakeLog::write('Language', 'Session');
Configure::write('Config.language', $this->Session->read('Config.Language'));
$this->Cookie->write('lang', $this->params['language'], false, '20 days');
} else {
CakeLog::write('Language', 'Else');
$this->Session->write('Config.language', Configure::read('Config.Language'));
$this->Cookie->write('lang', Configure::read('Config.Language'), false, '20 days');
}
}
if (isset($this->params['language'])) {
CakeLog::write('Language', 'Params set');
//then update the value in Session and the one in Cookie
$this->Session->write('Config.language', $this->params['language']);
$this->Cookie->write('lang', $this->params['language'], false, '20 days');
Configure::write('Config.language', $this->Cookie->read('lang'));
} else {
CakeLog::write('Language', 'Params not set');
}
}
示例13: updateSubscribersCount
public function updateSubscribersCount($data = null)
{
$this->set($data);
$conditions = es('Subscription.feed_id = %s', $this->id);
$n = $this->Subscription->findCount($conditions);
CakeLog::write(LOG_INFO, "subscribers: {$n}");
return $this->saveField('subscribers_count', $n);
}
示例14: before
public function before($method)
{
Configure::write('Database.logSQL', 0);
$msg = sprintf('(%s::%s)', get_class($this), $method);
CakeLog::write(LOG_INFO, $msg);
parent::before($method);
Configure::write('Database.logSQL', 2);
}
示例15: testBeforeRender
/**
* testBeforeRender
*
* @return void
*/
public function testBeforeRender()
{
$controller = new Controller();
CakeLog::write('error', 'Test');
$result = $this->panel->beforeRender($controller);
$this->assertInstanceOf('DebugKitLogListener', $result);
$this->assertTrue(isset($result->logs));
$this->assertCount(1, $result->logs['error']);
}