本文整理汇总了PHP中CakeLog::info方法的典型用法代码示例。如果您正苦于以下问题:PHP CakeLog::info方法的具体用法?PHP CakeLog::info怎么用?PHP CakeLog::info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CakeLog
的用法示例。
在下文中一共展示了CakeLog::info方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ping
/**
* PING
*
* @param string|null $url pingのURL(テストで使用する)
* @return mixed fsockopenの結果
*/
public function ping($url = null)
{
//サイトの生死確認
$errno = 0;
$errstr = null;
if (!$url) {
$url = self::NOTIFICATION_PING_URL;
}
CakeLog::info('Execute ping ' . $url);
try {
$resource = fsockopen($url, 80, $errno, $errstr, 3);
} catch (Exception $ex) {
$resource = false;
CakeLog::error($ex);
}
if (!$resource) {
CakeLog::info('Failure ping ' . $url);
$result = false;
} else {
fclose($resource);
$result = true;
CakeLog::info('Success ping ' . $url);
}
return $result;
}
示例2: updateBower
/**
* Bower update
*
* @param Model $model Model using this behavior
* @param string $plugin Plugin namespace
* @param string $option It is '' or '--save'. '--save' is used install.
* @return bool True on success
*/
public function updateBower(Model $model, $plugin, $option = '')
{
if (!$plugin) {
return false;
}
$pluginPath = ROOT . DS . 'app' . DS . 'Plugin' . DS . Inflector::camelize($plugin) . DS;
if (!file_exists($pluginPath . 'bower.json')) {
return true;
}
$file = new File($pluginPath . 'bower.json');
$bower = json_decode($file->read(), true);
$file->close();
foreach ($bower['dependencies'] as $package => $version) {
CakeLog::info(sprintf('[bower] Start bower install %s#%s for %s', $package, $version, $plugin));
$messages = array();
$ret = null;
exec(sprintf('cd %s && `which bower` --allow-root install %s#%s %s', ROOT, $package, $version, $option), $messages, $ret);
// Write logs
if (Configure::read('debug')) {
foreach ($messages as $message) {
CakeLog::info(sprintf('[bower] %s', $message));
}
}
CakeLog::info(sprintf('[bower] Successfully bower install %s#%s for %s', $package, $version, $plugin));
}
return true;
}
示例3: beforeActivation
/**
* onActivate will be called if this returns true
*
* @param object $controller Controller
* @return boolean
*/
public function beforeActivation(&$controller)
{
if (!CakePlugin::loaded('Imagine')) {
$plugins = App::objects('plugins');
if (in_array('Imagine', $plugins)) {
$plugin = new CroogoPlugin();
$plugin->addBootstrap('Imagine');
CakePlugin::load('Imagine');
CakeLog::info('Imagine plugin added to bootstrap');
}
}
return true;
}
示例4: runMigration
/**
* Plugin migration
*
* @param Model $model Model using this behavior
* @param string $plugin Plugin key
* @return bool True on success
*/
public function runMigration(Model $model, $plugin = null)
{
if (!$plugin) {
return false;
}
$connections = array('master');
$plugin = Inflector::camelize($plugin);
foreach ($connections as $connection) {
CakeLog::info(sprintf('[migration] Start migrating %s for %s connection', $plugin, $connection));
$messages = array();
$ret = null;
exec(sprintf('cd %s && app/Console/cake Migrations.migration run all -p %s -c %s -i %s', ROOT, $plugin, $connection, $connection), $messages, $ret);
// Write logs
if (Configure::read('debug')) {
foreach ($messages as $message) {
CakeLog::info(sprintf('[migration] %s', $message));
}
}
CakeLog::info(sprintf('[migration] Successfully migrated %s for %s connection', $plugin, $connection));
}
return true;
}
示例5: handleBookState
public function handleBookState($bookState)
{
$ret = false;
switch ($bookState) {
case BookData::FILES_STATE_NONE:
CakeLog::info('[BookFilesManager::handleBookState] Book File Add State None: ' . $this->bookId);
$this->completedState = BookData::FILES_STATE_INIT;
$ret = true;
break;
case BookData::FILES_STATE_INIT:
CakeLog::info('[BookFilesManager::handleBookState] Copying Files to Book Directory: ' . $this->bookId);
$this->completedState = BookData::FILES_STATE_COPIED;
$objProcessor = new BookFilesProcessor($this->bookId);
$objProcessor->importFiles = $this->options['files'];
if (count($objProcessor->importFiles) > 0) {
$ret = $objProcessor->process();
} else {
$ret = true;
}
break;
case BookData::FILES_STATE_COPIED:
CakeLog::info('[BookFilesManager::handleBookState] Files Copied: ' . $this->bookId);
$this->completedState = BookData::FILES_STATE_COMPLETE;
$ret = true;
break;
case BookData::FILES_STATE_COMPLETE:
CakeLog::info('[BookFilesManager::handleBookState] File add Complete: ' . $this->bookId);
$bookItem = $this->bookData->getBookItem(true);
$bookItem['ChChaucerBookVersion']['processing_progress'] = 1.0;
$this->bookData->saveBookVersion($bookItem);
$this->setComplete();
$ret = true;
break;
}
return $ret;
}
示例6: logMe
private function logMe($msg)
{
CakeLog::info($msg, 'sensors');
}
示例7: delete
public function delete($id = null)
{
if (AuthComponent::user('role') != 'admin') {
throw new ForbiddenException("Você não tem permissão para executar esta ação.");
}
$this->User->id = $id;
if (!$this->User->exists()) {
throw new NotFoundException(__('Invalid user'));
}
if ($this->User->delete()) {
# Store log
CakeLog::info('The user ' . AuthComponent::user('username') . ' (ID: ' . AuthComponent::user('id') . ') deleted user (ID: ' . $this->User->id . ')', 'users');
$this->Session->setFlash(__('User deleted'), 'flash_success');
$this->redirect('/home');
}
$this->Session->setFlash(__('User was not deleted'), 'flash_fail');
$this->redirect('/home');
}
示例8: info
public function info($message)
{
CakeLog::info($message, $this->scope);
}
示例9: customerCreate
/**
* The customerCreate method prepares data for Stripe_Customer::create and attempts to
* create a customer.
*
* @param array $data The data passed directly to Stripe's API.
* @return array $customer if success, string $error if failure.
*/
public function customerCreate($data)
{
// for API compatibility with version 1.x of this component
if (isset($data['stripeToken'])) {
$data['card'] = $data['stripeToken'];
unset($data['stripeToken']);
}
Stripe::setApiKey($this->key);
$error = null;
try {
$customer = Stripe_Customer::create($data);
} catch (Stripe_CardError $e) {
$body = $e->getJsonBody();
$err = $body['error'];
CakeLog::error('Customer::Stripe_CardError: ' . $err['type'] . ': ' . $err['code'] . ': ' . $err['message'], 'stripe');
$error = $err['message'];
} catch (Stripe_InvalidRequestError $e) {
$body = $e->getJsonBody();
$err = $body['error'];
CakeLog::error('Customer::Stripe_InvalidRequestError: ' . $err['type'] . ': ' . $err['message'], 'stripe');
$error = $err['message'];
} catch (Stripe_AuthenticationError $e) {
CakeLog::error('Customer::Stripe_AuthenticationError: API key rejected!', 'stripe');
$error = 'Payment processor API key error.';
} catch (Stripe_ApiConnectionError $e) {
CakeLog::error('Customer::Stripe_ApiConnectionError: Stripe could not be reached.', 'stripe');
$error = 'Network communication with payment processor failed, try again later';
} catch (Stripe_Error $e) {
CakeLog::error('Customer::Stripe_Error: Stripe could be down.', 'stripe');
$error = 'Payment processor error, try again later.';
} catch (Exception $e) {
CakeLog::error('Customer::Exception: Unknown error.', 'stripe');
$error = 'There was an error, try again later.';
}
if ($error !== null) {
// an error is always a string
return (string) $error;
}
CakeLog::info('Customer: customer id ' . $customer->id, 'stripe');
return $this->_formatResult($customer);
}
示例10: init_db
/**
* ステップ 3
* データベース設定
*
* @return void
*/
public function init_db()
{
$this->set('pageTitle', __d('install', 'Database Settings'));
// Destroy session in order to handle ping request
$this->Session->destroy();
$this->set('masterDB', $this->InstallUtil->chooseDBByEnvironment());
$this->set('errors', array());
$this->set('validationErrors', array());
if ($this->request->is('post')) {
set_time_limit(1800);
if ($this->request->data['prefix'] && substr($this->request->data['prefix'], -1, 1) !== '_') {
$this->request->data['prefix'] .= '_';
}
if ($this->InstallUtil->validatesDBConf($this->request->data)) {
$this->InstallUtil->saveDBConf($this->request->data);
} else {
$this->set('validationErrors', $this->InstallUtil->validationErrors);
$this->response->statusCode(400);
$this->set('errors', [__d('net_commons', 'Failed on validation errors. Please check the input data.')]);
CakeLog::info('[ValidationErrors] ' . $this->request->here());
if (Configure::read('debug')) {
CakeLog::info(var_export($this->InstallUtil->validationErrors, true));
}
return;
}
if (!$this->InstallUtil->createDB($this->request->data)) {
$this->response->statusCode(400);
CakeLog::info('Failed to create database.');
$this->set('errors', [__d('install', 'Failed to create database.')]);
return;
}
// Install migrations
$plugins = array_unique(array_merge(App::objects('plugins'), array_map('basename', glob(ROOT . DS . 'app' . DS . 'Plugin' . DS . '*', GLOB_ONLYDIR))));
if (!$this->InstallUtil->installMigrations('master', $plugins)) {
$this->response->statusCode(400);
CakeLog::error('Failed to install migrations');
$this->set('errors', [__d('install', 'Failed to install migrations.')]);
return;
}
$this->redirect(array('action' => 'init_admin_user', '?' => ['language' => Configure::read('Config.language')]));
}
}
示例11: updateComposer
/**
* Composer update
*
* @param Model $model Model using this behavior
* @param string $package Plugin namespace
* @param string $option It is 'update' or 'require --dev'. 'require --dev' is used install.
* @return bool True on success
*/
public function updateComposer(Model $model, $package, $option = 'update')
{
static $hhvm = null;
if (!$package) {
return false;
}
if (!isset($hhvm)) {
// Use hhvm only if php version greater than 5.5.0 and hhvm installed
// @see https://github.com/facebook/hhvm/wiki/OSS-PHP-Frameworks-Unit-Testing
$gt55 = version_compare(phpversion(), '5.5.0', '>=');
exec('which hhvm', $messages, $ret);
$hhvm = $gt55 && $ret === 0 ? 'hhvm -vRepo.Central.Path=/var/run/hhvm/hhvm.hhbc' : '';
}
CakeLog::info(sprintf('[composer] Start composer %s %s', $option, $package));
$messages = array();
$ret = null;
$cmd = sprintf('export COMPOSER_HOME=%s && cd %s && %s `which composer` %s %s 2>&1', ROOT, ROOT, $hhvm, $option, $package);
exec($cmd, $messages, $ret);
// Write logs
if (Configure::read('debug') || $ret !== 0) {
foreach ($messages as $message) {
CakeLog::info(sprintf('[composer] %s', $message));
}
}
if ($ret !== 0) {
return false;
}
CakeLog::info(sprintf('[composer] Successfully composer %s %s', $option, $package));
return true;
}
示例12: _copyFonts
/**
* Copy font files used by admin ui
*
* @throws Exception
*/
protected function _copyFonts()
{
$fontAwesomePath = WWW_ROOT . 'fontAwesome';
if (!file_exists($fontAwesomePath)) {
if (!$this->_clone) {
throw new Exception('You don\'t have "fontAwesome" in ' . WWW_ROOT);
}
CakeLog::info('Cloning FontAwesome...</info>');
exec('git clone git://github.com/FortAwesome/Font-Awesome ' . $fontAwesomePath);
}
chdir($fontAwesomePath);
exec('git checkout -f master');
$targetPath = WWW_ROOT . 'font' . DS;
$Folder = new Folder($targetPath, true);
$fontPath = WWW_ROOT . 'fontAwesome' . DS . 'font';
$Folder = new Folder($fontPath);
$files = $Folder->read();
if (empty($files[1])) {
CakeLog::error('No font files found');
$this->_stop();
}
foreach ($files[1] as $file) {
$File = new File($fontPath . DS . $file);
$newFile = $targetPath . $file;
if ($File->copy($newFile)) {
$text = __('Font: %s copied', $file);
CakeLog::info($text);
} else {
$text = __('File: %s not copied', $file);
CakeLog::error($text);
}
}
}
示例13: __setDefaultAuthenticator
/**
* Set authenticator
*
* @return void
**/
private function __setDefaultAuthenticator()
{
$plugin = Inflector::camelize($this->request->offsetGet('plugin'));
$scheme = strtr(Inflector::camelize($this->request->offsetGet('plugin')), array('Auth' => ''));
$callee = array(sprintf('Auth%sAppController', $scheme), '_getAuthenticator');
if (is_callable($callee)) {
$authenticator = call_user_func($callee);
$this->Auth->authenticate = array($authenticator => array());
CakeLog::info(sprintf('Will load %s authenticator', $authenticator), true);
} else {
CakeLog::info(sprintf('Unknown authenticator %s.%s', $plugin, $scheme), true);
}
}
示例14: cardUpdate
public function cardUpdate($data, $fields = null)
{
Stripe::setApiKey($this->key);
$error = null;
try {
$customer = Stripe_Customer::retrieve($data['customer_id']);
//update card
$customer->source = $data['stripeToken'];
$customer->save();
} catch (Stripe_CardError $e) {
$body = $e->getJsonBody();
$err = $body['error'];
CakeLog::error('Customer::Stripe_CardError: ' . $err['type'] . ': ' . $err['code'] . ': ' . $err['message'], 'stripe');
$error = $err['message'];
} catch (Stripe_InvalidRequestError $e) {
$body = $e->getJsonBody();
$err = $body['error'];
CakeLog::error('Customer::Stripe_InvalidRequestError: ' . $err['type'] . ': ' . $err['message'], 'stripe');
$error = $err['message'];
} catch (Stripe_AuthenticationError $e) {
CakeLog::error('Customer::Stripe_AuthenticationError: API key rejected!', 'stripe');
$error = 'Payment processor API key error.';
} catch (Stripe_ApiConnectionError $e) {
CakeLog::error('Customer::Stripe_ApiConnectionError: Stripe could not be reached.', 'stripe');
$error = 'Network communication with payment processor failed, try again later';
} catch (Stripe_Error $e) {
CakeLog::error('Customer::Stripe_Error: Stripe could be down.', 'stripe');
$error = 'Payment processor error, try again later.';
} catch (Exception $e) {
CakeLog::error('Customer::Exception: Unknown error.', 'stripe');
$error = 'There was an error, try again later.';
}
if ($error !== null) {
// an error is always a string
return (string) $error;
}
CakeLog::info('Update Card: customer id ' . $customer->id, 'stripe');
return $this->_formatResult($customer, $fields);
}
示例15: _copyFonts
/**
* Copy font files used by admin ui
*
* @throws Exception
*/
protected function _copyFonts()
{
$croogoPath = CakePlugin::path('Croogo');
$fontAwesomePath = $croogoPath . 'webroot' . DS . 'fontAwesome';
if (!file_exists($fontAwesomePath)) {
if (!$this->_clone) {
throw new Exception('You don\'t have "fontAwesome" in ' . WWW_ROOT);
}
CakeLog::info('Cloning FontAwesome...');
$command = sprintf('git clone -b %s %s %s', escapeshellarg($this->_tags['fontAwesome']), escapeshellarg($this->_repos['fontAwesome']), escapeshellarg($fontAwesomePath));
CakeLog::info("\t{$command}");
exec($command);
}
chdir($fontAwesomePath);
exec(sprintf('git checkout -f %s', escapeshellarg($this->_tags['fontAwesome'])));
$targetPath = $croogoPath . 'webroot' . DS . 'font' . DS;
$Folder = new Folder($targetPath, true);
$fontPath = $croogoPath . 'webroot' . DS . 'fontAwesome' . DS . 'font';
$Folder = new Folder($fontPath);
$files = $Folder->read();
if (empty($files[1])) {
CakeLog::error('No font files found');
$this->_stop();
}
foreach ($files[1] as $file) {
$File = new File($fontPath . DS . $file);
$newFile = $targetPath . $file;
$displayFilename = str_replace(APP, '', $newFile);
if ($File->copy($newFile)) {
$text = __d('croogo', 'Font: %s copied', $displayFilename);
CakeLog::info($text);
} else {
$text = __d('croogo', 'File: %s not copied', $file);
CakeLog::error($text);
}
}
}