本文整理汇总了PHP中watchdog_exception函数的典型用法代码示例。如果您正苦于以下问题:PHP watchdog_exception函数的具体用法?PHP watchdog_exception怎么用?PHP watchdog_exception使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了watchdog_exception函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new DrupalStyle($input, $output);
$module = $input->getArgument('module');
$module_handler = $this->getModuleHandler();
if ($module != 'all') {
$modules = [$module];
} else {
$modules = $module_handler->getImplementations('cron');
}
foreach ($modules as $module) {
if ($module_handler->implementsHook($module, 'cron')) {
$io->info(sprintf($this->trans('commands.cron.execute.messages.executing-cron'), $module));
try {
$module_handler->invoke($module, 'cron');
} catch (\Exception $e) {
watchdog_exception('cron', $e);
$io->error($e->getMessage());
}
} else {
$io->warning(sprintf($this->trans('commands.cron.execute.messages.module-invalid'), $module));
}
}
$this->getChain()->addCommand('cache:rebuild', ['cache' => 'all']);
}
开发者ID:eleaga,项目名称:DrupalConsole,代码行数:25,代码来源:ExecuteCommand.php
示例2: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new DrupalStyle($input, $output);
$modules = $input->getArgument('module');
$module_handler = $this->getDrupalService('module_handler');
$lock = $this->getDrupalService('lock');
// Try to acquire cron lock.
if (!$lock->acquire('cron', 900.0)) {
$io->warning($this->trans('commands.cron.execute.messages.lock'));
return;
}
if (in_array('all', $modules)) {
$modules = $module_handler->getImplementations('cron');
}
foreach ($modules as $module) {
if ($module_handler->implementsHook($module, 'cron')) {
$io->info(sprintf($this->trans('commands.cron.execute.messages.executing-cron'), $module));
try {
$module_handler->invoke($module, 'cron');
} catch (\Exception $e) {
watchdog_exception('cron', $e);
$io->error($e->getMessage());
}
} else {
$io->warning(sprintf($this->trans('commands.cron.execute.messages.module-invalid'), $module));
}
}
// Set last time cron was executed
\Drupal::state()->set('system.cron_last', REQUEST_TIME);
// Release cron lock.
$lock->release('cron');
$this->get('chain_queue')->addCommand('cache:rebuild', ['cache' => 'all']);
$io->success($this->trans('commands.cron.execute.messages.success'));
}
开发者ID:mnico,项目名称:DrupalConsole,代码行数:34,代码来源:ExecuteCommand.php
示例3: alterItems
public function alterItems(array &$items)
{
// Prevent session information from being saved while indexing.
drupal_save_session(FALSE);
// Force the current user to anonymous to prevent access bypass in search
// indexes.
$original_user = $GLOBALS['user'];
$GLOBALS['user'] = drupal_anonymous_user();
$entity_type = $this->index->getEntityType();
$entity_handler = panelizer_entity_plugin_get_handler($entity_type);
foreach ($items as &$item) {
$entity_id = entity_id($entity_type, $item);
$item->search_api_panelizer_content = NULL;
$item->search_api_panelizer_title = NULL;
try {
if ($render_info = $entity_handler->render_entity($item, 'page_manager')) {
$item->search_api_panelizer_content = $render_info['content'];
$item->search_api_panelizer_title = !empty($render_info['title']) ? $render_info['title'] : NULL;
}
} catch (Exception $e) {
watchdog_exception('panelizer', $e, 'Error indexing Panelizer content for %entity_type with ID %entity_id', array('%entity_type' => $entity_type, '%entity_id' => $entity_id));
}
}
// Restore the user.
$GLOBALS['user'] = $original_user;
drupal_save_session(TRUE);
}
开发者ID:michael-wojcik,项目名称:open_eggheads,代码行数:27,代码来源:PanelizerSearchApiAlterCallback.class.php
示例4: execute
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new DrupalStyle($input, $output);
$modules = $input->getArgument('module');
if (!$this->lock->acquire('cron', 900.0)) {
$io->warning($this->trans('commands.cron.execute.messages.lock'));
return 1;
}
if (in_array('all', $modules)) {
$modules = $this->moduleHandler->getImplementations('cron');
}
foreach ($modules as $module) {
if (!$this->moduleHandler->implementsHook($module, 'cron')) {
$io->warning(sprintf($this->trans('commands.cron.execute.messages.module-invalid'), $module));
continue;
}
try {
$io->info(sprintf($this->trans('commands.cron.execute.messages.executing-cron'), $module));
$this->moduleHandler->invoke($module, 'cron');
} catch (\Exception $e) {
watchdog_exception('cron', $e);
$io->error($e->getMessage());
}
}
$this->state->set('system.cron_last', REQUEST_TIME);
$this->lock->release('cron');
$this->chainQueue->addCommand('cache:rebuild', ['cache' => 'all']);
$io->success($this->trans('commands.cron.execute.messages.success'));
return 0;
}
开发者ID:ddrozdik,项目名称:DrupalConsole,代码行数:33,代码来源:ExecuteCommand.php
示例5: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
/** @var \Drupal\search_api\ServerInterface $server */
$server = $this->getEntity();
try {
$server->deleteAllItems();
drupal_set_message($this->t('All indexed data was successfully deleted from the server.'));
} catch (SearchApiException $e) {
drupal_set_message($this->t('Indexed data could not be cleared for some indexes. Check the logs for details.'), 'error');
}
$failed_reindexing = array();
$properties = array('status' => TRUE, 'read_only' => FALSE);
foreach ($server->getIndexes($properties) as $index) {
try {
$index->reindex();
} catch (SearchApiException $e) {
$args = array('%index' => $index->label());
watchdog_exception('search_api', $e, '%type while clearing index %index: @message in %function (line %line of %file).', $args);
$failed_reindexing[] = $index->label();
}
}
if ($failed_reindexing) {
$args = array('@indexes' => implode(', ', $failed_reindexing));
drupal_set_message($this->t('Failed to mark the following indexes for reindexing: @indexes. Check the logs for details.', $args), 'warning');
}
$form_state->setRedirect('entity.search_api_server.canonical', array('search_api_server' => $server->id()));
}
开发者ID:curveagency,项目名称:intranet,代码行数:30,代码来源:ServerClearConfirmForm.php
示例6: buildForm
/**
* {@inheritdoc}
*/
public function buildForm(array $form, FormStateInterface $form_state, ServerInterface $search_api_server = NULL)
{
$form['#title'] = $this->t('List of configuration files found');
try {
// Retrieve the list of available files.
$files_list = SearchApiSolrUtility::getServerFiles($search_api_server);
if (empty($files_list)) {
$form['info']['#markup'] = $this->t('No files found.');
return $form;
}
$form['files_tabs'] = array('#type' => 'vertical_tabs');
// Generate a fieldset for each file.
foreach ($files_list as $file_name => $file_info) {
$file_date = format_date(strtotime($file_info['modified']));
$escaped_file_name = SafeMarkup::checkPlain($file_name);
$form['files'][$file_name] = array('#type' => 'details', '#title' => $escaped_file_name, '#group' => 'files_tabs');
$data = '<h3>' . $escaped_file_name . '</h3>';
$data .= '<p><em>' . $this->t('Last modified: @time.', array('@time' => $file_date)) . '</em></p>';
if ($file_info['size'] > 0) {
$file_data = $search_api_server->getBackend()->getFile($file_name);
$data .= '<pre><code>' . SafeMarkup::checkPlain($file_data->getBody()) . '</code></pre>';
} else {
$data .= '<p><em>' . $this->t('The file is empty.') . '</em></p>';
}
$form['files'][$file_name]['data']['#markup'] = $data;
}
} catch (SearchApiException $e) {
watchdog_exception('search_api_solr', $e, '%type while retrieving config files of Solr server @server: !message in %function (line %line of %file).', array('@server' => $search_api_server->label()));
$form['info']['#markup'] = $this->t('An error occured while trying to load the list of files.');
}
return $form;
}
开发者ID:curveagency,项目名称:intranet,代码行数:35,代码来源:SolrConfigForm.php
示例7: execute
/**
* {@inheritdoc}
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new DrupalStyle($input, $output);
$styles = $input->getArgument('styles');
$result = 0;
$imageStyle = $this->entityTypeManager->getStorage('image_style');
$stylesNames = [];
if (in_array('all', $styles)) {
$styles = $imageStyle->loadMultiple();
foreach ($styles as $style) {
$stylesNames[] = $style->get('name');
}
$styles = $stylesNames;
}
foreach ($styles as $style) {
try {
$io->info(sprintf($this->trans('commands.image.styles.flush.messages.executing-flush'), $style));
$imageStyle->load($style)->flush();
} catch (\Exception $e) {
watchdog_exception('image', $e);
$io->error($e->getMessage());
$result = 1;
}
}
$io->success($this->trans('commands.image.styles.flush.messages.success'));
return $result;
}
开发者ID:ibonelli,项目名称:DrupalConsole,代码行数:30,代码来源:StylesFlushCommand.php
示例8: form
/**
* {@inheritdoc}
*/
public function form(array $form, FormStateInterface $form_state)
{
$form = parent::form($form, $form_state);
/** @var \Drupal\embed\EmbedButtonInterface $button */
$button = $this->entity;
$form_state->setTemporaryValue('embed_button', $button);
$form['label'] = ['#title' => $this->t('Label'), '#type' => 'textfield', '#default_value' => $button->label(), '#description' => t('The human-readable name of this embed button. This text will be displayed when the user hovers over the CKEditor button. This name must be unique.'), '#required' => TRUE, '#size' => 30];
$form['id'] = ['#type' => 'machine_name', '#default_value' => $button->id(), '#maxlength' => EntityTypeInterface::BUNDLE_MAX_LENGTH, '#disabled' => !$button->isNew(), '#machine_name' => ['exists' => ['Drupal\\embed\\Entity\\EmbedButton', 'load']], '#description' => $this->t('A unique machine-readable name for this embed button. It must only contain lowercase letters, numbers, and underscores.')];
$form['type_id'] = ['#type' => 'select', '#title' => $this->t('Embed type'), '#options' => $this->embedTypeManager->getDefinitionOptions(), '#default_value' => $button->getTypeId(), '#required' => TRUE, '#ajax' => ['callback' => '::updateTypeSettings', 'effect' => 'fade'], '#disabled' => !$button->isNew()];
if (count($form['type_id']['#options']) == 0) {
drupal_set_message($this->t('No embed types found.'), 'warning');
}
// Add the embed type plugin settings.
$form['type_settings'] = ['#type' => 'container', '#tree' => TRUE, '#prefix' => '<div id="embed-type-settings-wrapper">', '#suffix' => '</div>'];
try {
if ($plugin = $button->getTypePlugin()) {
$form['type_settings'] = $plugin->buildConfigurationForm($form['type_settings'], $form_state);
}
} catch (PluginNotFoundException $exception) {
drupal_set_message($exception->getMessage(), 'error');
watchdog_exception('embed', $exception);
$form['type_id']['#disabled'] = FALSE;
}
$config = $this->config('embed.settings');
$upload_location = $config->get('file_scheme') . '://' . $config->get('upload_directory') . '/';
$form['icon_file'] = ['#title' => $this->t('Button icon'), '#type' => 'managed_file', '#description' => $this->t('Icon for the button to be shown in CKEditor toolbar. Leave empty to use the default Entity icon.'), '#upload_location' => $upload_location, '#upload_validators' => ['file_validate_extensions' => ['gif png jpg jpeg'], 'file_validate_image_resolution' => ['32x32', '16x16']]];
if ($file = $button->getIconFile()) {
$form['icon_file']['#default_value'] = ['target_id' => $file->id()];
}
return $form;
}
开发者ID:nB-MDSO,项目名称:mdso-d8blog,代码行数:34,代码来源:EmbedButtonForm.php
示例9: import
/**
* Import the culturefeed domains.
*/
public function import()
{
$this->client = new Client($this::END_POINT);
try {
$body = $this->client->get('heading_categorisation.xml')->send()->getBody(TRUE);
$this->importHeadings(new SimpleXMLElement($body));
} catch (ClientErrorResponseException $e) {
watchdog_exception('culturefeed_cnapi_import', $e);
}
}
开发者ID:cultuurnet,项目名称:culturefeed,代码行数:13,代码来源:CnapiHeadingImport.php
示例10: onRequest
/**
* Registers the autoloader.
*/
public function onRequest(GetResponseEvent $event)
{
try {
$this->registerAutoloader();
} catch (\RuntimeException $e) {
if (PHP_SAPI !== 'cli') {
watchdog_exception('search_api_solr', $e, NULL, array(), RfcLogLevel::WARNING);
}
}
}
开发者ID:curveagency,项目名称:intranet,代码行数:13,代码来源:AutoloaderSubscriber.php
示例11: sendRequest
/**
* Send the request to service.
*
* @param $identifiers
* Pass requested identifiers.
* @return mixed
* Response object or error message.
*/
protected function sendRequest($identifiers)
{
$authInfo = array('authenticationUser' => $this->username, 'authenticationGroup' => $this->group, 'authenticationPassword' => $this->password);
$client = new SoapClient($this->wsdlUrl);
try {
$response = $client->moreInfo(array('authentication' => $authInfo, 'identifier' => $identifiers));
} catch (Exception $e) {
watchdog_exception('artesis_netarchive', $e);
}
return $response;
}
开发者ID:artesis,项目名称:artesis_netarchive,代码行数:19,代码来源:NetArchiveService.php
示例12: fetchProjectData
/**
* {@inheritdoc}
*/
public function fetchProjectData(array $project, $site_key = '')
{
$url = $this->buildFetchUrl($project, $site_key);
$data = '';
try {
$data = $this->httpClient->get($url, array('headers' => array('Accept' => 'text/xml')))->getBody(TRUE);
} catch (RequestException $exception) {
watchdog_exception('update', $exception);
}
return $data;
}
开发者ID:davidsoloman,项目名称:drupalconsole.com,代码行数:14,代码来源:UpdateFetcher.php
示例13: getEmbedObject
/**
* {@inheritdoc}
*/
public function getEmbedObject($url)
{
$embed = NULL;
try {
$response = $this->httpClient->get($this->getEmbedProviderURL($url), array('headers' => array('content-type' => 'application/json')));
$embed = json_decode($response->getBody());
} catch (GuzzleClientException $e) {
watchdog_exception('ckeditor_media_embed', $e);
}
return $embed;
}
开发者ID:AllieRays,项目名称:debugging-drupal-8,代码行数:14,代码来源:Embed.php
示例14: import
/**
* Import the culturefeed domains.
*/
public function import()
{
$this->client = new Client($this::END_POINT);
try {
// Cities.
$body = $this->client->get('city')->send()->getBody(TRUE);
$this->importCities(new SimpleXMLElement($body));
} catch (ClientErrorResponseException $e) {
watchdog_exception('culturefeed_city_import', $e);
}
}
开发者ID:cultuurnet,项目名称:culturefeed,代码行数:14,代码来源:CultureFeedCityImport.php
示例15: isTitleInUse
/**
* @param string $title
*
* @return bool
*/
public static function isTitleInUse($title)
{
try {
return (bool) static::loadByTitle($title);
} catch (InvalidArgumentException $e) {
return FALSE;
} catch (NonUniqueResultException $e) {
watchdog_exception('b2b_import', $e);
return TRUE;
}
}
开发者ID:jall,项目名称:entity_wrappers,代码行数:16,代码来源:Node.php
示例16: submitForm
/**
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state)
{
/** @var \Drupal\search_api\IndexInterface $entity */
$entity = $this->getEntity();
try {
$entity->clear();
} catch (SearchApiException $e) {
drupal_set_message($this->t('Failed to clear the search index %name.', array('%name' => $entity->label())), 'error');
watchdog_exception('search_api', $e, '%type while trying to clear the index %name: @message in %function (line %line of %file)', array('%name' => $entity->label()));
}
$form_state->setRedirect('entity.search_api_index.canonical', array('search_api_index' => $entity->id()));
}
开发者ID:curveagency,项目名称:intranet,代码行数:15,代码来源:IndexClearConfirmForm.php
示例17: delete
public function delete($ids, \DatabaseTransaction $transaction = NULL)
{
$transaction = isset($transaction) ? $transaction : db_transaction();
try {
parent::delete($ids, $transaction);
db_delete('observers')->condition('observable_id', $ids, 'IN')->execute();
} catch (\Exception $e) {
watchdog_exception($this->entityType, $e);
$transaction->rollback();
throw $e;
}
}
开发者ID:TuWebO,项目名称:observable,代码行数:12,代码来源:ObservableStorageController.php
示例18: getEmbedObject
/**
* {@inheritdoc}
*/
public function getEmbedObject($url)
{
$embed = NULL;
try {
$response = $this->httpClient->get($this->getEmbedProviderURL($url), ['headers' => ['content-type' => 'application/json']]);
$embed = json_decode($response->getBody());
} catch (TransferException $e) {
drupal_set_message(t('Unable to retrieve @url at this time, please check again later.', ['@url' => $url]), 'warning');
watchdog_exception('ckeditor_media_embed', $e);
}
return $embed;
}
开发者ID:nB-MDSO,项目名称:mdso-d8blog,代码行数:15,代码来源:Embed.php
示例19: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
/* drupal_set_installed_schema_version('sample', '8000');
exit();*/
include_once DRUPAL_ROOT . '/core/includes/install.inc';
include_once DRUPAL_ROOT . '/core/includes/update.inc';
$module = $input->getArgument('module');
$update_n = $input->getArgument('update-n');
$module_handler = $this->getModuleHandler();
drupal_load_updates();
update_fix_compatibility();
$updates = update_get_update_list();
if ($module != 'all') {
if (!isset($updates[$module])) {
$output->writeln('[-] <error>' . sprintf($this->trans('commands.update.execute.messages.no-module-updates'), $module) . '</error>');
return;
} else {
// filter to execute only a specific module updates
$updates = [$module => $updates[$module]];
if ($update_n && !isset($updates[$module]['pending'][$update_n])) {
$output->writeln('[-] <info>' . sprintf($this->trans('commands.update.execute.messages.module-update-function-not-found'), $module, $update_n) . '</info>');
}
}
}
$output->writeln('[-] <info>' . $this->trans('commands.site.maintenance.description') . '</info>');
\Drupal::state()->set('system.maintenance_mode', true);
foreach ($updates as $module_name => $module_updates) {
foreach ($module_updates['pending'] as $update_number => $update) {
if ($module != 'all' && $update_n != null and $update_n != $update_number) {
continue;
}
//Executing all pending updates
if ($update_n > $module_updates['start']) {
$output->writeln('[-] <info>' . $this->trans('commands.update.execute.messages.executing-required-previous-updates') . '</info>');
}
for ($update_index = $module_updates['start']; $update_index <= $update_number; $update_index++) {
$output->writeln('[-] <info>' . sprintf($this->trans('commands.update.execute.messages.executing-update'), $update_index, $module_name) . '</info>');
try {
$module_handler->invoke($module_name, 'update_' . $update_index);
} catch (\Exception $e) {
watchdog_exception('update', $e);
$output->writeln('<error>' . $e->getMessage() . '</error>');
}
//Update module schema version
drupal_set_installed_schema_version($module_name, $update_index);
}
}
}
\Drupal::state()->set('system.maintenance_mode', false);
$output->writeln('[-] <info>' . $this->trans('commands.site.maintenance.messages.maintenance-off') . '</info>');
$this->getHelper('chain')->addCommand('cache:rebuild', ['cache' => 'all']);
}
开发者ID:xsw3ws,项目名称:DrupalConsole,代码行数:52,代码来源:UpdateExecuteCommand.php
示例20: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
$io = new DrupalStyle($input, $output);
$this->getDrupalHelper()->loadLegacyFile('/core/includes/install.inc');
$this->getDrupalHelper()->loadLegacyFile('/core/includes/update.inc');
$module = $input->getArgument('module');
$update_n = $input->getArgument('update-n');
$module_handler = $this->getModuleHandler();
drupal_load_updates();
update_fix_compatibility();
$updates = update_get_update_list();
if ($module != 'all') {
if (!isset($updates[$module])) {
$io->error(sprintf($this->trans('commands.update.execute.messages.no-module-updates'), $module));
return;
} else {
// filter to execute only a specific module updates
$updates = [$module => $updates[$module]];
if ($update_n && !isset($updates[$module]['pending'][$update_n])) {
$io->info(sprintf($this->trans('commands.update.execute.messages.module-update-function-not-found'), $module, $update_n));
}
}
}
$io->info($this->trans('commands.site.maintenance.description'));
$state = $this->getService('state');
$state->set('system.maintenance_mode', true);
foreach ($updates as $module_name => $module_updates) {
foreach ($module_updates['pending'] as $update_number => $update) {
if ($module != 'all' && $update_n !== null && $update_n != $update_number) {
continue;
}
//Executing all pending updates
if ($update_n > $module_updates['start']) {
$io->info($this->trans('commands.update.execute.messages.executing-required-previous-updates'));
}
for ($update_index = $module_updates['start']; $update_index <= $update_number; $update_index++) {
$io->info(sprintf($this->trans('commands.update.execute.messages.executing-update'), $update_index, $module_name));
try {
$module_handler->invoke($module_name, 'update_' . $update_index);
} catch (\Exception $e) {
watchdog_exception('update', $e);
$io->error($e->getMessage());
}
//Update module schema version
drupal_set_installed_schema_version($module_name, $update_index);
}
}
}
$state->set('system.maintenance_mode', false);
$io->info($this->trans('commands.site.maintenance.messages.maintenance-off'));
$this->getChain()->addCommand('cache:rebuild', ['cache' => 'all']);
}
开发者ID:blasoliva,项目名称:DrupalConsole,代码行数:52,代码来源:ExecuteCommand.php
注:本文中的watchdog_exception函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论