Issue #3288910 by Project Update Bot: Replace file_url_transform_relative with...
Merge request reports
Activity
9 9 use Psr\Log\LoggerInterface; 10 10 use Symfony\Component\EventDispatcher\EventDispatcherInterface; 11 11 use Symfony\Component\HttpKernel\KernelEvents; 12 use Symfony\Component\HttpKernel\Event\GetResponseEvent; 12 use Symfony\Component\HttpKernel\Event\RequestEvent; 13 13 use Symfony\Component\EventDispatcher\EventSubscriberInterface; 14 use Drupal\Core\File\FileUrlGeneratorInterface; 15 use Symfony\Component\HttpFoundation\RequestStack; 14 16 17 /** 18 * Class to provide functionality for MissingAsset. The description does not make sense.
It says the class provide functionality for itself, which would also be true for every class a module could implement; therefore, it would not be a much helpful description.Edited by Alberto Padernochanged this line in version 2 of the diff
51 * The file URL generator. 46 52 * 53 * @var \Drupal\Core\File\FileUrlGeneratorInterface 47 54 */ 48 public function __construct(LoggerInterface $logger, FileSystemInterface $file_system, Connection $database, EventDispatcherInterface $event_dispatcher) { 55 protected $fileUrlGenerator; 56 57 /** 58 * The request stack. 59 * 60 * @var \Symfony\Component\HttpFoundation\RequestStack 61 */ 62 protected $requestStack; 63 64 /** 65 * Construct a MissingAsset object. changed this line in version 2 of the diff
47 54 */ 48 public function __construct(LoggerInterface $logger, FileSystemInterface $file_system, Connection $database, EventDispatcherInterface $event_dispatcher) { 55 protected $fileUrlGenerator; 56 57 /** 58 * The request stack. 59 * 60 * @var \Symfony\Component\HttpFoundation\RequestStack 61 */ 62 protected $requestStack; 63 64 /** 65 * Construct a MissingAsset object. 66 * 67 * @param \Psr\Log\LoggerInterface $logger 68 * A logger instance. changed this line in version 2 of the diff
55 protected $fileUrlGenerator; 56 57 /** 58 * The request stack. 59 * 60 * @var \Symfony\Component\HttpFoundation\RequestStack 61 */ 62 protected $requestStack; 63 64 /** 65 * Construct a MissingAsset object. 66 * 67 * @param \Psr\Log\LoggerInterface $logger 68 * A logger instance. 69 * @param \Drupal\Core\File\FileSystemInterface $file_system 70 * The file handler. changed this line in version 2 of the diff
59 * 60 * @var \Symfony\Component\HttpFoundation\RequestStack 61 */ 62 protected $requestStack; 63 64 /** 65 * Construct a MissingAsset object. 66 * 67 * @param \Psr\Log\LoggerInterface $logger 68 * A logger instance. 69 * @param \Drupal\Core\File\FileSystemInterface $file_system 70 * The file handler. 71 * @param \Drupal\Core\Database\Connection $database 72 * The database connection. 73 * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher 74 * The Event Dispatcher Interface. changed this line in version 2 of the diff
76 * The file URL generator. 77 * @param \Symfony\Component\HttpFoundation\RequestStack $requestStack 78 * The request stack used to retrieve the current request. 79 */ 80 public function __construct(LoggerInterface $logger, FileSystemInterface $file_system, Connection $database, EventDispatcherInterface $event_dispatcher, FileUrlGeneratorInterface $fileUrlGenerator, RequestStack $requestStack) { 49 81 $this->logger = $logger; 50 82 $this->fileSystem = $file_system; 51 83 $this->database = $database; 52 84 $this->eventDispatcher = $event_dispatcher; 85 $this->fileUrlGenerator = $fileUrlGenerator; 86 $this->requestStack = $requestStack; 53 87 } 54 88 55 public function findAndWrite(GetResponseEvent $event) { 89 /** 90 * Function of findAndWrite with event argument. changed this line in version 2 of the diff
6 6 use Drupal\amp\Asset\AmpCssCollectionRenderer as BaseAmpCssCollectionRenderer; 7 7 8 8 /** 9 * Wrapper around amp's AmpCssCollectionRendered that ensure needed css files are present on disk upfront. 9 * Wrapper around amp's AmpCssCollectionRendered that. 10 * 11 * Ensure needed css files are present on disk upfront. changed this line in version 2 of the diff
20 22 return $elements; 21 23 } 22 24 23 foreach ($elements as $key => $element) { 25 foreach ($elements as $element) { 24 26 if ($element['#tag'] == 'style' && array_key_exists('#value', $element)) { 25 $urls = preg_match_all('/@import url\("(.+)\?/', $element['#value'], $matches); 26 $all_css = []; 27 27 foreach ($matches[1] as $url) { 28 //$css = file_get_contents(DRUPAL_ROOT . $url); 28 // $css = file_get_contents(DRUPAL_ROOT . $url); changed this line in version 2 of the diff
17 'data' => $data, 18 'timestamp' => REQUEST_TIME, 19 ]) 20 ->execute(); 19 $connection 20 ->insert('optimized_assets_proxy') 21 ->fields([ 22 'file' => basename($uri), 23 'data' => $data, 24 'timestamp' => \Drupal::time()->getRequestTime(), 25 ]) 26 ->execute(); 27 } 28 catch (\Exception $exception) { 29 \Drupal::logger('optimized_assets_proxy')->error($exception->getMessage()); 30 } - Comment on lines +28 to +30
This does not seem a change required by the PHP_CodeSniffer report shown in the issue summary. If it were, exceptions are logged in with
watchdog_exception()
or using code similar to that function's code. watchdog_exception() is deprecated in drupal:10.1.0 and is removed from drupal:11.0.0. Use \Drupal\Core\Utility\Error::logException() instead. See https://www.drupal.org/node/2932520
1 1 name: CSS/JS Optimized Assets Proxy 2 2 type: module 3 3 description: Stores generated css/js optimized assets to the database, and recovers them to disk when missing. 4 core: 8.x 5 core_version_requirement: ^8 || ^9 4 core_version_requirement: ^9.3 || ^10 changed this line in version 2 of the diff
1 1 <?php 2 2 3 /** 4 * @file 5 * Install file to import config during module instalation. changed this line in version 2 of the diff
added 21 commits
-
c9dcea2c...b452710d - 15 commits from branch
project:1.0.x
- 690498b6 - Fix regression in 36c38114
- dbeb5098 - Issue #3288910 by Project Update Bot: use Drupal\Core\File\FileSystemInterface
- bcec7ac8 - Update deprecated function file_unmanaged_save_data
- cb875aa2 - Issue #3271658 by willeaton: Integration with advagg
- 899ee920 - Fixing phpcs issue.
- c4c5c520 - #3354946 Addressing comments after #7
Toggle commit list-
c9dcea2c...b452710d - 15 commits from branch
11 11 use Symfony\Component\HttpKernel\KernelEvents; 12 12 use Symfony\Component\HttpKernel\Event\GetResponseEvent; 13 13 use Symfony\Component\EventDispatcher\EventSubscriberInterface; 14 use Drupal\Core\File\FileUrlGeneratorInterface; 15 use Symfony\Component\HttpFoundation\RequestStack; 14 16 17 /** 18 * Event subscriber class for Optimized Assets Proxy. changed this line in version 4 of the diff
59 * 60 * @var \Symfony\Component\HttpFoundation\RequestStack 61 */ 62 protected $requestStack; 63 64 /** 65 * Construct a new \Drupal\optimized_assets_proxy\EventSubscriber\MissingAsset object. 66 * 67 * @param \Psr\Log\LoggerInterface $logger 68 * The logger. 69 * @param \Drupal\Core\File\FileSystemInterface $file_system 70 * The file system service. 71 * @param \Drupal\Core\Database\Connection $database 72 * The database connection. 73 * @param \Symfony\Component\EventDispatcher\EventDispatcherInterface $event_dispatcher 74 * An event dispatcher instance. changed this line in version 3 of the diff
58 //$assets_path = file_url_transform_relative(file_create_url('assets://')); 59 // Check if core patch https://www.drupal.org/project/drupal/issues/3027639 is applied. 98 // Check if core patch 99 // https://www.drupal.org/project/drupal/issues/3027639 is applied. 60 100 if (in_array('assets', stream_get_wrappers())) { 61 101 $stream_wrapper_uri = 'assets://'; 62 102 } 63 103 else { 64 104 $stream_wrapper_uri = 'public://'; 65 105 } 66 $assets_path = file_url_transform_relative(file_create_url($stream_wrapper_uri)); 106 $assets_path = $this->fileUrlGenerator->generateString($stream_wrapper_uri); 67 107 68 108 $matches = []; 69 if (preg_match("@^$assets_path(css)/css_|(js)/js_@", $request_path, $matches)) { 109 if (preg_match("@^$assets_path(css|js)(/optimized)?/(css|js)_@", $request_path, $matches)) { changed this line in version 4 of the diff
- src/AdvaggCssOptimizer.php 0 → 100644
18 return $uri; 19 } 20 21 try { 22 $connection = \Drupal::database(); 23 $connection 24 ->insert('optimized_assets_proxy') 25 ->fields([ 26 'file' => basename($uri), 27 'data' => $data, 28 'timestamp' => \Drupal::time()->getRequestTime(), 29 ]) 30 ->execute(); 31 } 32 catch (\Exception $exception) { 33 \Drupal::logger('optimized_assets_proxy')->error($exception->getMessage()); changed this line in version 4 of the diff
- src/AdvaggJsOptimizer.php 0 → 100644
18 return $uri; 19 } 20 21 try { 22 $connection = \Drupal::database(); 23 $connection 24 ->insert('optimized_assets_proxy') 25 ->fields([ 26 'file' => basename($uri), 27 'data' => $data, 28 'timestamp' => \Drupal::time()->getRequestTime(), 29 ]) 30 ->execute(); 31 } 32 catch (\Exception $exception) { 33 \Drupal::logger('optimized_assets_proxy')->error($exception->getMessage()); changed this line in version 4 of the diff
4 4 5 5 use Drupal\Core\Asset\AssetDumper as CoreAssetDumper; 6 6 7 /** 8 * Extend AssetDumper to additionally store data in DB for later. changed this line in version 3 of the diff
13 21 ], 14 22 'file' => [ 15 23 'type' => 'varchar_ascii', 16 'length' => '64', 24 'length' => '256', changed this line in version 3 of the diff
1 1 <?php 2 2 3 /** 4 * @file 5 * Module file to addon feature into module. The usual description is Hook implementations for the [module name] module. where [module name] is the module name used in the .info.yml file. Module file to add features to the module. (which I assume is what the description is supposed to be) does not make much sense. (File containing the module code that adds features to the module. ???)
Edited by Alberto Paderno