当前位置: 首页>>代码示例>>PHP>>正文


PHP CakeLog::error方法代码示例

本文整理汇总了PHP中CakeLog::error方法的典型用法代码示例。如果您正苦于以下问题:PHP CakeLog::error方法的具体用法?PHP CakeLog::error怎么用?PHP CakeLog::error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CakeLog的用法示例。


在下文中一共展示了CakeLog::error方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: runBookProcess

 /**
  * launches the book build process
  * @param int $chaucerBookId
  * @return boolean
  */
 public function runBookProcess()
 {
     $bookSource = $this->getBookSourceType();
     if (!$bookSource) {
         throw new Exception("Book {$this->bookId} not found in chaucer database.");
     }
     $objProcessor = $this->getBookProcessor($bookSource);
     if (is_object($objProcessor)) {
         $objProcessor->progressBookId = $this->updateBookId;
         $objProcessor->completedState = $this->completedState;
         $objProcessor->uploadedFiles = $this->sourceFiles;
         try {
             return $objProcessor->process();
         } catch (Exception $e) {
             $msg = trim($e->getMessage());
             if (strlen($msg) > 0) {
                 if (substr($msg, 0, 1) == '[') {
                     $displayMsg = substr($msg, strpos($msg, ']') + 1);
                 } else {
                     $displayMsg = $msg;
                 }
             }
             if (is_object($objProcessor->progress)) {
                 CakeLog::error($e->getMessage());
                 $objProcessor->processError($displayMsg);
             } else {
                 trigger_error($e->getMessage(), E_USER_ERROR);
             }
         }
     } else {
         throw new Exception('[ProcessQueue::runBookProcess] Unknown book source');
     }
     return false;
 }
开发者ID:skypeter1,项目名称:webapps,代码行数:39,代码来源:ImportBookManager.php

示例2: execute

 /**
  * Starts a new background task by passing some data to it with a priority
  *
  * @param string $taskName name of the task to be executed
  * @param mixed $data info to be passed to background task
  * @param sting $priority null for normal or either "low" or "high"
  * @return boolean success
  **/
 public static function execute($taskName, $data = null, $priority = null)
 {
     if (!empty($priority)) {
         $priority = strtolower($priority);
         if (!in_array($priority, array('low', 'high'))) {
             throw new InvalidArgumentException(sprintf('%s is not a valid priority, only accepting low and high', $priority));
         }
     }
     $prefix = Configure::read('Gearman.prefix');
     if ($prefix) {
         $taskName = $prefix . '_' . $taskName;
     }
     $data = json_encode($data);
     CakeLog::debug(sprintf('Creating background job: %s', $taskName), array('gearman'));
     if ($priority == 'low') {
         $job = static::client()->doLowBackground($taskName, $data);
     }
     if ($priority == 'high') {
         $job = static::client()->doHighBackground($taskName, $data);
     }
     if (empty($priority)) {
         $job = static::client()->doBackground($taskName, $data);
     }
     if (static::client()->returnCode() !== GEARMAN_SUCCESS) {
         CakeLog::error(sprintf('Could not create background job for task %s and data %s. Got %s (%s)', $taskName, $data, $job, static::client()->error()), array('gearman'));
         return false;
     }
     return true;
 }
开发者ID:lorenzo,项目名称:cakephp-gearman,代码行数:37,代码来源:GearmanQueue.php

示例3: saveQuestionnaireBlocksSetting

 /**
  * Save questionnaire settings
  *
  * @param array $data received post data
  * @return bool True on success, false on failure
  * @throws InternalErrorException
  */
 public function saveQuestionnaireBlocksSetting($data)
 {
     $this->loadModels(['BlockRolePermission' => 'Blocks.BlockRolePermission']);
     //トランザクションBegin
     $this->setDataSource('master');
     $dataSource = $this->getDataSource();
     $dataSource->begin();
     try {
         if (!$this->validateQuestionnaireBlocksSetting($data)) {
             return false;
         }
         foreach ($data[$this->BlockRolePermission->alias] as $value) {
             if (!$this->BlockRolePermission->validateBlockRolePermissions($value)) {
                 $this->validationErrors = Hash::merge($this->validationErrors, $this->BlockRolePermission->validationErrors);
                 return false;
             }
         }
         if (!$this->save(null, false)) {
             throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
         }
         foreach ($data[$this->BlockRolePermission->alias] as $value) {
             if (!$this->BlockRolePermission->saveMany($value, ['validate' => false])) {
                 throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
             }
         }
         //トランザクションCommit
         $dataSource->commit();
     } catch (Exception $ex) {
         //トランザクションRollback
         $dataSource->rollback();
         CakeLog::error($ex);
         throw $ex;
     }
     return true;
 }
开发者ID:Onasusweb,项目名称:Questionnaires,代码行数:42,代码来源:QuestionnaireBlocksSetting.php

示例4: view

 /**
  * view
  *
  * @return void
  * @throws Exception
  */
 public function view()
 {
     if (!Current::read('Block.id')) {
         $this->autoRender = false;
         return;
     }
     $isAccessed = 'block_key_' . Current::read('Block.key');
     //AccessCounterFrameSettingデータ取得
     $counterFrameSetting = $this->AccessCounterFrameSetting->getAccessCounterFrameSetting(true);
     $this->set('accessCounterFrameSetting', $counterFrameSetting['AccessCounterFrameSetting']);
     //AccessCounterデータ取得
     $accessCounter = $this->AccessCounter->getAccessCounter(true);
     // カウントアップ処理
     if (!$this->Session->read($isAccessed)) {
         try {
             $this->AccessCounter->updateCountUp($accessCounter);
             $accessCounter['AccessCounter']['count']++;
             // アクセス情報を記録
             $this->Session->write($isAccessed, CakeSession::read('Config.userAgent'));
         } catch (Exception $ex) {
             CakeLog::error($ex);
             throw $ex;
         }
     }
     $this->set('accessCounter', $accessCounter['AccessCounter']);
 }
开发者ID:Onasusweb,项目名称:AccessCounters,代码行数:32,代码来源:AccessCountersController.php

示例5: execute

 public static function execute($command, $cwd = null, $env = null, $allowSudo = true)
 {
     $descriptorspec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"), 2 => array("pipe", "w"));
     \CakeLog::debug("Executing command: {$command}");
     if (!empty($cwd)) {
         \CakeLog::debug("--> cwd = {$cwd}");
     }
     // Execute command
     $process = proc_open($command, $descriptorspec, $pipes, $cwd, $env);
     if (!is_resource($process)) {
         \CakeLog::error("Could not execute command: {$command}");
         throw new Exception("Could not execute command: {$command}");
     }
     // close stdin
     fclose($pipes[0]);
     $stdout = $stderr = $buffer = $errbuf = "";
     while (($buffer = fgets($pipes[1], 1024)) != NULL || ($errbuf = fgets($pipes[2], 1024)) != NULL) {
         if (!empty($buffer)) {
             $stdout .= $buffer;
             \CakeLog::debug('--> stdout: ' . trim($buffer));
         }
         if (!empty($errbuf)) {
             $stderr .= $errbuf;
             \CakeLog::error('--> stderr: ' . trim($errbuf));
         }
     }
     fclose($pipes[1]);
     fclose($pipes[2]);
     $exit_code = proc_close($process);
     \CakeLog::debug("--> exit_code: {$exit_code}");
     unset($pipes[0], $pipes[1], $pipes[2], $pipes);
     unset($descriptorspec[0], $descriptorspec[1], $descriptorspec[2], $descriptorspec);
     return compact('stdout', 'stderr', 'exit_code', 'command', 'cwd', 'env');
 }
开发者ID:nodesagency,项目名称:Platform-Common-Plugin,代码行数:34,代码来源:Command.php

示例6: uninstallPlugin

 /**
  * Uninstall plugin
  *
  * @param Model $model Model using this behavior
  * @param array $data Plugin data
  * @return bool True on success
  * @throws InternalErrorException
  */
 public function uninstallPlugin(Model $model, $data)
 {
     $model->loadModels(['Plugin' => 'PluginManager.Plugin', 'PluginsRole' => 'PluginManager.PluginsRole', 'PluginsRoom' => 'PluginManager.PluginsRoom']);
     //トランザクションBegin
     $model->setDataSource('master');
     $dataSource = $model->getDataSource();
     $dataSource->begin();
     if (is_string($data)) {
         $key = $data;
     } else {
         $key = $data[$model->alias]['key'];
     }
     try {
         //Pluginの削除
         if (!$model->deleteAll(array($model->alias . '.key' => $key), false)) {
             throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
         }
         //PluginsRoomの削除
         if (!$model->PluginsRoom->deleteAll(array($model->PluginsRoom->alias . '.plugin_key' => $key), false)) {
             throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
         }
         //PluginsRoleの削除
         if (!$model->PluginsRole->deleteAll(array($model->PluginsRole->alias . '.plugin_key' => $key), false)) {
             throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
         }
         //トランザクションCommit
         $dataSource->commit();
     } catch (Exception $ex) {
         //トランザクションRollback
         $dataSource->rollback();
         CakeLog::error($ex);
         throw $ex;
     }
     return true;
 }
开发者ID:Onasusweb,项目名称:PluginManager,代码行数:43,代码来源:PluginBehavior.php

示例7: 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;
 }
开发者ID:NetCommons3,项目名称:Notifications,代码行数:31,代码来源:Notification.php

示例8: saveUserAttributesOrder

 /**
  * Move Order UserAttributes
  *
  * @param array $data received post data
  * @return bool True on success, false on validation errors
  * @throws InternalErrorException
  */
 public function saveUserAttributesOrder($data)
 {
     //トランザクションBegin
     $this->setDataSource('master');
     $dataSource = $this->getDataSource();
     $dataSource->begin();
     try {
         ////バリデーション
         //$indexes = array_keys($data['LinkOrders']);
         //foreach ($indexes as $i) {
         //	if (! $this->validateLinkOrder($data['LinkOrders'][$i])) {
         //		return false;
         //	}
         //}
         //
         ////登録処理
         //foreach ($indexes as $i) {
         //	if (! $this->save($data['LinkOrders'][$i], false, false)) {
         //		throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
         //	}
         //}
         //トランザクションCommit
         $dataSource->commit();
     } catch (Exception $ex) {
         //トランザクションRollback
         $dataSource->rollback();
         CakeLog::error($ex);
         throw $ex;
     }
     return true;
 }
开发者ID:Onasusweb,项目名称:UserAttributes,代码行数:38,代码来源:UserAttributeSetting.php

示例9: saveBlogFrameSetting

 /**
  * save blog
  *
  * @param array $data received post data
  * @return mixed On success Model::$data if its not empty or true, false on failure
  * @throws InternalErrorException
  */
 public function saveBlogFrameSetting($data)
 {
     $this->loadModels(['BlogFrameSetting' => 'Blogs.BlogFrameSetting']);
     //トランザクションBegin
     $dataSource = $this->getDataSource();
     $dataSource->begin();
     try {
         //バリデーション
         if (!$this->validateBlogFrameSetting($data)) {
             $dataSource->rollback();
             return false;
         }
         //登録処理
         if (!($resultData = $this->save(null, false))) {
             throw new InternalErrorException(__d('net_commons', 'Internal Server Error'));
         }
         //トランザクションCommit
         $dataSource->commit();
     } catch (Exception $ex) {
         //トランザクションRollback
         $dataSource->rollback();
         CakeLog::error($ex);
         throw $ex;
     }
     return $resultData;
 }
开发者ID:Onasusweb,项目名称:Blogs,代码行数:33,代码来源:BlogFrameSetting.php

示例10: loadAllFixtures

 /**
  * Load a list of $fixtures into a $source
  *
  * @param string $source The name of your datasource (e.g. default)
  * @param array $fixtures An array of fixtures - same format as in CakeTest $fixtures
  * @return void
  */
 public function loadAllFixtures($source, $fixtures)
 {
     $this->_initDb($source);
     $this->_loadFixtures($fixtures);
     CakeLog::debug('Begin fixture import');
     CakeLog::debug('');
     $nested = $this->_db->useNestedTransactions;
     $this->_db->useNestedTransactions = false;
     $this->_db->begin();
     foreach ($fixtures as $f) {
         CakeLog::debug(sprintf('Working on %s', $f));
         if (empty($this->_loaded[$f])) {
             CakeLog::notice('-> Can not find it in the loaded array.. weird');
             continue;
         }
         $fixture = $this->_loaded[$f];
         CakeLog::debug(sprintf('-> Found fixture: %s', get_class($fixture)));
         $this->_setupTable($fixture, $this->_db, true);
         CakeLog::debug('-> Created table "OK"');
         if ($fixture->insert($this->_db)) {
             CakeLog::debug('-> Inserted fixture data "OK"');
         } else {
             CakeLog::error('-> Inserted fixture data "ERROR"');
         }
         CakeLog::debug('');
     }
     $this->_db->commit();
     $this->_useNestedTransactions = $nested;
     CakeLog::debug('Done!');
 }
开发者ID:nodesagency,项目名称:Platform-Common-Plugin,代码行数:37,代码来源:FixtureLoaderShell.php

示例11: lookup

 public function lookup($url)
 {
     $results = $this->http->get($url);
     if (!$results->isOk()) {
         CakeLog::error("GooglePlayApi::lookup: Error: {$url} {$results->reasonPhrase} {$results->body}");
         return false;
     }
     $results = $this->parseHtml($results->body);
     return $results;
 }
开发者ID:tektoh,项目名称:app_description,代码行数:10,代码来源:GooglePlayApi.php

示例12: rotate

 public function rotate()
 {
     try {
         $this->_rotate($this->config);
     } catch (Exception $e) {
         CakeLog::error('LogRotation::rotate() - ' . $e->getMessage(), 'backend');
         return false;
     }
     return true;
 }
开发者ID:fm-labs,项目名称:cakephp-backend,代码行数:10,代码来源:LogRotation.php

示例13: saveTest

 public function saveTest()
 {
     $data['Test'] = $this->request->data;
     //        CakeLog::error(print_r($data, true));
     if ($this->Test->save($data)) {
         $this->Session->setFlash('Your post has been saved.');
         $this->redirect(array('controller' => 'departments', 'action' => 'viewTime', $data['Test']['department_id']));
     } else {
         $this->Session->setFlash('Unable to add your post.');
         CakeLog::error($this->Test->validationErrors);
     }
 }
开发者ID:skydel,项目名称:universal-online-exam,代码行数:12,代码来源:TestsController.php

示例14: parse

 public function parse()
 {
     libxml_clear_errors();
     $xml_string = trim(file_get_contents($this->path));
     try {
         $this->xml = new SimpleXMLElement($xml_string);
         return true;
     } catch (Exception $e) {
         CakeLog::error("Unable to parse TOC: " . implode(', ', libxml_get_errors()));
         return false;
     }
 }
开发者ID:skypeter1,项目名称:webapps,代码行数:12,代码来源:Epub2TocReader.php

示例15: create

 public function create($db)
 {
     $ok = parent::create($db);
     // Workaround: CakeSchema cannot create FULLTEXT fixtures, so we change the table manually after creation
     if ($ok) {
         $query = "ALTER TABLE `{$this->table}` ADD FULLTEXT INDEX `data` (`data` ASC)";
         try {
             $db->rawQuery($query);
             $this->created[] = $db->configKeyName;
         } catch (Exception $e) {
             $msg = __d('cake_dev', 'Fixture creation for "%s" failed "%s"', $this->table, $e->getMessage());
             CakeLog::error($msg);
             trigger_error($msg, E_USER_WARNING);
             return false;
         }
         return true;
     }
     return false;
 }
开发者ID:klarkc,项目名称:Searchable-Behaviour-for-CakePHP,代码行数:19,代码来源:SearchIndexFixture.php


注:本文中的CakeLog::error方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。