watchdog('security',"Security warning: Couldn't write .htaccess file. Please create a .htaccess file in your %directory directory which contains the following lines: <code>!htaccess</code>",$variables,WATCHDOG_ERROR);
\Drupal::logger('security')->error("Security warning: Couldn't write .htaccess file. Please create a .htaccess file in your %directory directory which contains the following lines: <code>!htaccess</code>",$variables);
returnFALSE;
}
}
...
...
@@ -696,16 +696,17 @@ function file_valid_uri($uri) {
// @todo Replace drupal_set_message() calls with exceptions instead.
drupal_set_message(t('The specified file %file could not be copied because no file by that name exists. Please check that you supplied the correct filename.',array('%file'=>$original_source)),'error');
watchdog('file','File %file could not be copied because the destination directory %destination is not configured correctly.',array('%file'=>$original_source,'%destination'=>$dirname));
$logger->notice('File %file could not be copied because the destination directory %destination is not configured correctly.',array('%file'=>$original_source,'%destination'=>$dirname));
drupal_set_message(t('The specified file %file could not be copied because the destination directory is not properly configured. This may be caused by a problem with file or directory permissions. More information is available in the system log.',array('%file'=>$original_source)),'error');
drupal_set_message(t('The file %file could not be copied because a file by that name already exists in the destination directory.',array('%file'=>$original_source)),'error');
watchdog('file','File %file could not be copied because a file by that name already exists in the destination directory (%destination)',array('%file'=>$original_source,'%destination'=>$destination));
$logger->notice('File %file could not be copied because a file by that name already exists in the destination directory (%destination)',array('%file'=>$original_source,'%destination'=>$destination));
watchdog('error','Menu_link %machine_name does neither provide a route_name nor a link_path, so it got skipped.',array('%machine_name'=>$machine_name));
\Drupal::logger('menu_link')->error('Menu_link %machine_name does neither provide a route_name nor a link_path, so it got skipped.',array('%machine_name'=>$machine_name));
watchdog('file',t('Copied file %source has been renamed to %destination',array('%source'=>$source->filename,'%destination'=>$file->getFilename())));
\Drupal::logger('file')->notice(t('Copied file %source has been renamed to %destination',array('%source'=>$source->filename,'%destination'=>$file->getFilename())));
}
}
...
...
@@ -158,7 +158,7 @@ function hook_file_move(Drupal\file\FileInterface $file, Drupal\file\FileInterfa
watchdog('file',t('Moved file %source has been renamed to %destination',array('%source'=>$source->filename,'%destination'=>$file->getFilename())));
\Drupal::logger('file')->notice(t('Moved file %source has been renamed to %destination',array('%source'=>$source->filename,'%destination'=>$file->getFilename())));
watchdog('file','File %file (%realpath) could not be copied because the destination %destination is invalid. This is often caused by improper use of file_copy() or a missing stream wrapper.',array('%file'=>$source->getFileUri(),'%realpath'=>$realpath,'%destination'=>$destination));
\Drupal::logger('file')->notice('File %file (%realpath) could not be copied because the destination %destination is invalid. This is often caused by improper use of file_copy() or a missing stream wrapper.',array('%file'=>$source->getFileUri(),'%realpath'=>$realpath,'%destination'=>$destination));
}
else{
watchdog('file','File %file could not be copied because the destination %destination is invalid. This is often caused by improper use of file_copy() or a missing stream wrapper.',array('%file'=>$source->getFileUri(),'%destination'=>$destination));
\Drupal::logger('file')->notice('File %file could not be copied because the destination %destination is invalid. This is often caused by improper use of file_copy() or a missing stream wrapper.',array('%file'=>$source->getFileUri(),'%destination'=>$destination));
}
drupal_set_message(t('The specified file %file could not be copied because the destination is invalid. More information is available in the system log.',array('%file'=>$source->getFileUri())),'error');
watchdog('file','File %file (%realpath) could not be moved because the destination %destination is invalid. This may be caused by improper use of file_move() or a missing stream wrapper.',array('%file'=>$source->getFileUri(),'%realpath'=>$realpath,'%destination'=>$destination));
\Drupal::logger('file')->notice('File %file (%realpath) could not be moved because the destination %destination is invalid. This may be caused by improper use of file_move() or a missing stream wrapper.',array('%file'=>$source->getFileUri(),'%realpath'=>$realpath,'%destination'=>$destination));
}
else{
watchdog('file','File %file could not be moved because the destination %destination is invalid. This may be caused by improper use of file_move() or a missing stream wrapper.',array('%file'=>$source->getFileUri(),'%destination'=>$destination));
\Drupal::logger('file')->notice('File %file could not be moved because the destination %destination is invalid. This may be caused by improper use of file_move() or a missing stream wrapper.',array('%file'=>$source->getFileUri(),'%destination'=>$destination));
}
drupal_set_message(t('The specified file %file could not be moved because the destination is invalid. More information is available in the system log.',array('%file'=>$source->getFileUri())),'error');
watchdog('file','The data could not be saved because the destination %destination is invalid. This may be caused by improper use of file_save_data() or a missing stream wrapper.',array('%destination'=>$destination));
\Drupal::logger('file')->notice('The data could not be saved because the destination %destination is invalid. This may be caused by improper use of file_save_data() or a missing stream wrapper.',array('%destination'=>$destination));
drupal_set_message(t('The data could not be saved because the destination is invalid. More information is available in the system log.'),'error');
returnFALSE;
}
...
...
@@ -732,11 +732,11 @@ function file_cron() {
$file->delete();
}
else{
watchdog('file system','Could not delete temporary file "%path" during garbage collection',array('%path'=>$file->getFileUri()),WATCHDOG_ERROR);
\Drupal::logger('file system')->error('Could not delete temporary file "%path" during garbage collection',array('%path'=>$file->getFileUri()));
}
}
else{
watchdog('file system','Did not delete temporary file "%path" during garbage collection because it is in use by the following modules: %modules.',array('%path'=>$file->getFileUri(),'%modules'=>implode(', ',array_keys($references))),WATCHDOG_INFO);
\Drupal::logger('file system')->info('Did not delete temporary file "%path" during garbage collection because it is in use by the following modules: %modules.',array('%path'=>$file->getFileUri(),'%modules'=>implode(', ',array_keys($references))));
}
}
}
...
...
@@ -958,7 +958,7 @@ function file_save_upload($form_field_name, $validators = array(), $destination
drupal_set_message(t('File upload error. Could not move uploaded file.'),'error');
watchdog('file','Upload error. Could not move uploaded file %file to destination %destination.',array('%file'=>$file->filename,'%destination'=>$file->uri));
\Drupal::logger('file')->notice('Upload error. Could not move uploaded file %file to destination %destination.',array('%file'=>$file->filename,'%destination'=>$file->uri));
$files[$i]=FALSE;
continue;
}
...
...
@@ -1510,7 +1510,7 @@ function file_managed_file_save_upload($element, array &$form_state) {
watchdog('file','The upload directory %directory for the file field !name could not be created or is not accessible. A newly uploaded file could not be saved in this directory as a consequence, and the upload was canceled.',array('%directory'=>$destination,'!name'=>$element['#field_name']));
\Drupal::logger('file')->notice('The upload directory %directory for the file field !name could not be created or is not accessible. A newly uploaded file could not be saved in this directory as a consequence, and the upload was canceled.',array('%directory'=>$destination,'!name'=>$element['#field_name']));
form_set_error($upload_name,$form_state,t('The file could not be uploaded.'));
returnFALSE;
}
...
...
@@ -1520,7 +1520,7 @@ function file_managed_file_save_upload($element, array &$form_state) {
@@ -228,7 +228,7 @@ function locale_translation_batch_fetch_finished($success, $results) {
* TRUE if the file is not found. FALSE if a fault occurred.
*/
functionlocale_translation_http_check($uri){
$logger=\Drupal::logger('locale');
try{
$response=\Drupal::httpClient()->head($uri);
$result=array();
...
...
@@ -250,10 +250,10 @@ function locale_translation_http_check($uri) {
// theme does not define the location of a translation file. By default
// the file is checked at the translation server, but it will not be
// found there.
watchdog('locale','Translation file not found: @uri.',array('@uri'=>$uri));
$logger->notice('Translation file not found: @uri.',array('@uri'=>$uri));
returnTRUE;
}
watchdog('locale','HTTP request to @url failed with error: @error.',array('@url'=>$uri,'@error'=>$response->getStatusCode().' '.$response->getReasonPhrase()));
$logger->notice('HTTP request to @url failed with error: @error.',array('@url'=>$uri,'@error'=>$response->getStatusCode().' '.$response->getReasonPhrase()));
}
returnFALSE;
...
...
@@ -285,6 +285,6 @@ function locale_translation_download_source($source_file, $directory = 'temporar
$file->timestamp=filemtime($uri);
return$file;
}
watchdog('locale','Unable to download translation file @uri.',array('@uri'=>$source_file->uri),WATCHDOG_ERROR);
\Drupal::logger('locale')->error('Unable to download translation file @uri.',array('@uri'=>$source_file->uri));
@@ -384,7 +385,7 @@ function locale_translate_batch_finished($success, $results) {
$message=format_plural($skips,'One translation string was skipped because of disallowed or malformed HTML. See the log for details.','@count translation strings were skipped because of disallowed or malformed HTML. See the log for details.');
}
drupal_set_message($message,'warning');
watchdog('locale','@count disallowed HTML string(s) in files: @files.',array('@count'=>$skips,'@files'=>implode(',',$skipped_files)),WATCHDOG_WARNING);
$logger->warning('@count disallowed HTML string(s) in files: @files.',array('@count'=>$skips,'@files'=>implode(',',$skipped_files)));
}
}
}
...
...
@@ -606,11 +607,11 @@ function locale_config_batch_finished($success, array $results) {
drupal_set_message(t('The configuration was successfully updated. There are %number configuration objects updated.',array('%number'=>$configuration)));
watchdog('locale','The configuration was successfully updated. %number configuration objects updated.',array('%number'=>$configuration));
\Drupal::logger('locale')->notice('The configuration was successfully updated. %number configuration objects updated.',array('%number'=>$configuration));
}
else{
drupal_set_message(t('No configuration objects have been updated.'));
watchdog('locale','No configuration objects have been updated.',array(),WATCHDOG_WARNING);
\Drupal::logger('locale')->warning('No configuration objects have been updated.');
@@ -1345,23 +1345,24 @@ function _locale_rebuild_js($langcode = NULL) {
}
// Log the operation and return success flag.
$logger=\Drupal::logger('locale');
switch($status){
case'updated':
watchdog('locale','Updated JavaScript translation file for the language %language.',array('%language'=>$language->name));
$logger->notice('Updated JavaScript translation file for the language %language.',array('%language'=>$language->name));
returnTRUE;
case'rebuilt':
watchdog('locale','JavaScript translation file %file.js was lost.',array('%file'=>$locale_javascripts[$language->id]),WATCHDOG_WARNING);
$logger->warning('JavaScript translation file %file.js was lost.',array('%file'=>$locale_javascripts[$language->id]));
// Proceed to the 'created' case as the JavaScript translation file has
// been created again.
case'created':
watchdog('locale','Created JavaScript translation file for the language %language.',array('%language'=>$language->name));
$logger->notice('Created JavaScript translation file for the language %language.',array('%language'=>$language->name));
returnTRUE;
case'deleted':
watchdog('locale','Removed JavaScript translation file for the language %language because no translations currently exist for that language.',array('%language'=>$language->name));
$logger->notice('Removed JavaScript translation file for the language %language because no translations currently exist for that language.',array('%language'=>$language->name));
returnTRUE;
case'error':
watchdog('locale','An error occurred during creation of the JavaScript translation file for the language %language.',array('%language'=>$language->name),WATCHDOG_ERROR);
$logger->error('An error occurred during creation of the JavaScript translation file for the language %language.',array('%language'=>$language->name));
// If the directory does not exists and cannot be created.
form_set_error($form_element['#parents'][0],$form_state,t('The directory %directory does not exist and could not be created.',array('%directory'=>$directory)));
watchdog('file system','The directory %directory does not exist and could not be created.',array('%directory'=>$directory),WATCHDOG_ERROR);
$logger->error('The directory %directory does not exist and could not be created.',array('%directory'=>$directory));
// If the directory is not writable and cannot be made so.
form_set_error($form_element['#parents'][0],$form_state,t('The directory %directory exists but is not writable and could not be made writable.',array('%directory'=>$directory)));
watchdog('file system','The directory %directory exists but is not writable and could not be made writable.',array('%directory'=>$directory),WATCHDOG_ERROR);
$logger->error('The directory %directory exists but is not writable and could not be made writable.',array('%directory'=>$directory));