Quantcast
Channel: Issues for Drupal core
Viewing all 291053 articles
Browse latest View live

Fatal error after update to 8.5.1

$
0
0

Hi,

I have just tried to update to 8.5.1 from 8.5.0. I did it manually, removing core and vendor folders, removing all files from root and copying new files. This was not my first update... However after entering mysite.com/update.php I get this error:
Fatal error: Interface 'CommerceGuys\Intl\Currency\CurrencyInterface' not found in /nfsmnt/hosting1_2/6/b/6b8e81dd-0600-48d2-ba6e-20a4a2307deb/dekorgarden.sk/sub/obchod/modules/contrib/commerce/modules/price/src/Entity/CurrencyInterface.php on line 16
I tried to update core with composer but I get message: "Package "drupal/core" listed for update is not installed. Ignoring."

I have read some issues regarding this error message so I tried to reinstall address module with composer. After that I could access update.php page, with message that there is nothing to update. I can access my admin and I can see that 8.5.1 is installed. I can also access all pages of my site besides homepage. I get the same error as above. After clearing cache I can access homepage but when I go to some other pages and try to come back to homepage the same error occurs.

The homepage can be accessed only when I reload the page second time. The problem occurs in all browsers.

Where can be the problem?


file_icon_url CDN compatible

$
0
0

I need that all my statics files serve by CDN, for that I have changed file_icon_url function using file_create_url() function.

Log message if static_map plugin skips the row

$
0
0

Problem/Motivation

It is hard to notice that static_map was the reason a migration row was skipped.

Proposed resolution

Log a message to MigrateSkipRowException to clearly explain why the row is skipped.

Remaining tasks

Patch

User interface changes

N.A.

API changes

N.A.

Data model changes

N.A.

Move DateTimeItem and DateRangeItem constants onto interfaces.

$
0
0

Problem/Motivation

DateTimeItem and DateRangeItem both have class constants. These should be on interfaces.

Proposed resolution

- Move the DateTimeItem constants onto DateTimeItemInterface as-is.

- Create DateRangeItemInterface, and move DateRangeItem constants as-is.

- Update usages to refer to the interface or static:: as appropriate.

Remaining tasks

User interface changes

API changes

Data model changes

Many documentation / handbook URLs redirect to D7 content

$
0
0

Problem/Motivation

Following a somewhat recent update to Drupal.org that attempted to create separate handbooks for D7 and D8, there are many problems with D8 documentation: #2855171: Documentation migration makes significant sections of the Drupal 8 handbook unnavigable or redirect to Drupal 7 docs

In particular, though, many generic URLs once linked from core help hooks, etc. now redirect to Drupal 7-specific content. Example: #2854586: Stark's helptext link redirects to D7 theme guide We need to check and probably fix this on many or even most of the links in core.

Proposed resolution

Identify links to D7 docs in core, and fix them.

Remaining tasks

  1. Compile a list of the d.o handbook links in core. grep is your friend.
  2. Evaluate whether they have a redirect (possibly programmatically because it is going to be a lot).
  3. For anything redirected, list the redirect destination.
  4. For those that have a "7" in the redirected path, they are definitely wrong and need to either have the correct D8 docs identified, or have a documentation bug report filed that there are no D8 docs since the migration.

User interface changes

Many changed strings as we fix URLs. Correct links

API changes

N/A

Data model changes

N/A

Fix all coding standards for dblog module

$
0
0

Problem/Motivation

Several patches for dblog are including non related coding standard fixes. This make patches harder to review and introduce non related changes.

Proposed resolution

Fix all the coding standards reported by phpcs for dblog.

Here is the full report of phpcs:

FILE: core/modules/dblog/tests/src/Kernel/DbLogFormInjectionTest.php
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
 46 | ERROR | [x] Parameter comment must end with a full stop
 51 | ERROR | [ ] Type hint "array" missing for $element
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: core/modules/dblog/tests/src/Kernel/DbLogControllerTest.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 20 | ERROR | [x] Missing function doc comment
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: core/modules/dblog/tests/src/Kernel/Views/ViewsIntegrationTest.php
----------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------
 185 | ERROR | If the line declaring an array spans longer than 80
     |       | characters, each element should be broken into its own
     |       | line
----------------------------------------------------------------------


FILE: core/modules/dblog/tests/src/Functional/DbLogResourceTest.php
----------------------------------------------------------------------
FOUND 1 ERROR AND 1 WARNING AFFECTING 2 LINES
----------------------------------------------------------------------
 76 | ERROR   | If the line declaring an array spans longer than 80
    |         | characters, each element should be broken into its
    |         | own line
 87 | WARNING | Line exceeds 80 characters; contains 82 characters
----------------------------------------------------------------------


FILE: core/modules/dblog/tests/src/Functional/DbLogViewsTest.php
----------------------------------------------------------------------
FOUND 2 ERRORS AFFECTING 2 LINES
----------------------------------------------------------------------
  9 | ERROR | Doc comment short description must be on a single line,
    |       | further text should be a separate paragraph
 49 | ERROR | Public method name
    |       | "DbLogViewsTest::testDBLogAddAndClear" is not in
    |       | lowerCamel format
----------------------------------------------------------------------


FILE: core/modules/dblog/tests/src/Functional/DbLogTest.php
----------------------------------------------------------------------
FOUND 11 ERRORS AFFECTING 11 LINES
----------------------------------------------------------------------
  15 | ERROR | [ ] Doc comment short description must be on a single
     |       |     line, further text should be a separate paragraph
  52 | ERROR | [ ] If the line declaring an array spans longer than
     |       |     80 characters, each element should be broken into
     |       |     its own line
 208 | ERROR | [ ] Type hint "array" missing for $options
 211 | ERROR | [x] Inline comments must end in full-stops,
     |       |     exclamation marks, colons, question marks, or
     |       |     closing parentheses
 248 | ERROR | [x] Expected 3 space(s) before asterisk; 2 found
 354 | ERROR | [ ] Doc comment short description must be on a single
     |       |     line, further text should be a separate paragraph
 460 | ERROR | [ ] If the line declaring an array spans longer than
     |       |     80 characters, each element should be broken into
     |       |     its own line
 566 | ERROR | [ ] Public method name
     |       |     "DbLogTest::testDBLogAddAndClear" is not in
     |       |     lowerCamel format
 825 | ERROR | [ ] If the line declaring an array spans longer than
     |       |     80 characters, each element should be broken into
     |       |     its own line
 826 | ERROR | [ ] If the line declaring an array spans longer than
     |       |     80 characters, each element should be broken into
     |       |     its own line
 827 | ERROR | [ ] If the line declaring an array spans longer than
     |       |     80 characters, each element should be broken into
     |       |     its own line
----------------------------------------------------------------------
PHPCBF CAN FIX THE 2 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: core/modules/dblog/dblog.admin.inc
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
 25 | WARNING | Only string literals should be passed to t() where
    |         | possible
----------------------------------------------------------------------


FILE: core/modules/dblog/dblog.module
----------------------------------------------------------------------
FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
----------------------------------------------------------------------
 106 | WARNING | [x] A comma should follow the last multiline array
     |         |     item. Found: )
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------


FILE: core/modules/dblog/src/Controller/DbLogController.php
----------------------------------------------------------------------
FOUND 1 ERROR AND 3 WARNINGS AFFECTING 4 LINES
----------------------------------------------------------------------
 205 | WARNING | [ ] Only string literals should be passed to t()
     |         |     where possible
 254 | WARNING | [ ] Only string literals should be passed to t()
     |         |     where possible
 362 | WARNING | [ ] Only string literals should be passed to t()
     |         |     where possible
 414 | ERROR   | [x] Equals sign not aligned with surrounding
     |         |     assignments; expected 1 space but found 2 spaces
----------------------------------------------------------------------
PHPCBF CAN FIX THE 1 MARKED SNIFF VIOLATIONS AUTOMATICALLY
----------------------------------------------------------------------

missing class docs for ContainerDerivativeDiscoveryDecorator

Log message if block_visibility plugin skip the row

$
0
0

Problem/Motivation

Continuing from https://www.drupal.org/project/drupal/issues/2951715#comment-12559059
When there is no php or request_path specified in the visibilty configuration, block_visibility plugin skips that particular row, But currently there is no where these exception get logged.

core/modules/block/src/Plugin/migrate/process/BlockVisibility.php:118:          
throw new MigrateSkipRowException();

Proposed resolution

Log a message to MigrateSkipRowException to clearly explain why the row is skipped.

Remaining tasks

Patch

User interface changes

NA

API changes

NA

Data model changes

NA


Log message if migration plugin skip the row When there is no destination found.

$
0
0

Problem/Motivation

Continuing from https://www.drupal.org/project/drupal/issues/2951715#comment-12559059

if migration plugin skip the row When there is no destination found. We need to log that exception somewhere

core/modules/migrate/src/Plugin/Migration.php:413:      
throw new MigrateSkipRowException();

Proposed resolution

Log a message to MigrateSkipRowException to clearly explain why the row is skipped.

Remaining tasks

Patch, Needs test

User interface changes

NA

API changes

NA

Data model changes

NA

latestRevision() very slow with lots of revisions

$
0
0

After upgrading to 8.4 we noticed a performance decrease on one of our sites. The page that is taking minutes to load is a multilanguage page with several field collections and revisions enabled.

Some debugging lead me to the change in issue 2864995.

This change introduces a latestRevision() method which is used by QuickEdit (this explains why it is only when logged in). On a field collection that has about 4000 revisions, this query takes seconds to run.

If I understand correctly the change introduces a self-join to the base revision table. Because of this, for each revision in the table, a set of revisions + next revisions is added to the result. From this result only the row that has no next revision (is null) is used (in my case 7000000 rows are searched for the one that has no next revisions).

base_table.revision_idbase_table_2.revision_id
......
335916335986
335916336066
335986336066
336066NULL

Maybe we can think of a more efficient way of querying the latest revision?

Reuse option in FileCopy migrate process plugin not work with remote files

$
0
0

I have tested that code:

process:
    uri:
      plugin: file_copy
      reuse: true
      source:
        - source_file_path_remote
        - destination_file_path

In the transform method of file_copy process plugin the download process plugin is called when a source file is remote. So the file is downloaded ignoring the reuse option.

Log message if menu_link_parent plugin skip the row

$
0
0

Problem/Motivation

Continuing from https://www.drupal.org/project/drupal/issues/2951715#comment-12559059

core/modules/migrate/src/Plugin/migrate/process/MenuLinkParent.php:100:    
throw new MigrateSkipRowException()

Proposed resolution

Log a message to MigrateSkipRowException to clearly explain why the row is skipped.

Remaining tasks

Patch

User interface changes

NA

API changes

NA

Data model changes

NA

Path to translation files is hardcoded in the install

$
0
0

Problem/Motivation

function install_check_translations($langcode, $server_pattern) {
  $requirements = array();

  $readable = FALSE;
  $writable = FALSE;
  // @todo: Make this configurable.
  $site_path = \Drupal::service('site.path');
  $files_directory =  $site_path . '/files';
  $translations_directory = $site_path . '/files/translations';

Proposed resolution

I couldn't find the TODO, so this will have to be it.
#1658842: Introduce a translations:// stream wrapper to access the .po file directory makes this a lot easier.

Remaining tasks

Do it. Make the path configurable.

User interface changes

API changes

Data model changes

Alt text replaced with Thumbnail

$
0
0

We have trouble with alt text for Thumbnail formatter. It is very similar to Media entity bug, but we use module Media in core.

In core/modules/media/src/Plugin/Field/FieldFormatter/MediaThumbnailFormatter.php is code

$media_items = $this->getEntitiesToView($items, $langcode);

I was inspect in Xdebug variable $items and I found, that there are using Thumbnail as alt ($items->list[0]->properties['entity']->target->entity->values['thumbnail']['x-default'])

I don't know, where is source of $items. How can I fix it?

Update the Umami Vegan Chocolate Brownie recipe

$
0
0

@sharjay and I have revisited the Umami Chocolate Brownie recipe to make a number of improvements. This includes a better recipe and a much improved image of the result.

The proposal is to update the current Chocolate Brownie recipe with this new version.


Replace hard coded static cache of entities with cache backends

$
0
0

Problem/Motivation

When loading large numbers of entities, especially during migrations and updates, it's quite easy to run out of PHP memory.

Migrate works around this by trying to clear the entity static cache, but this also results in a persistent cache clear.

Static caching is hard coded in storage classes which prevents swapping it out unless you change the whole class.

Proposed resolution

Add a 'static cache' service, which does not serialize at all, but which conforms to CacheBackendInterface.

Rework entity storage to rely on this service instead of a raw class property.

This will allow for two things:

- once this issue has landed, migrate will be able to reset the static cache via the service, therefore not affecting the persistent entity cache.
- in a follow-up, we'll be able to add a simple Least Recently Used implementation, allowing the static cache to have a fixed maximum number of items.
- beyond this, there is the possibility to go even further:
- have a cache backend limited by the actual size of the items in it (will require estimating memory usage of entities)
- add a cache backend, probably in contrib, using PHP weak references http://php.net/manual/en/intro.weakref.php which theoretically will allow cached entities to be removed by garbage collection.

Remaining tasks

User interface changes

API changes

Data model changes

Spinning this out of #1302378: Use multiple specialized entity controllers.

The base EntityController class currently handles keeping it's own 'static' cache internal to the class, or always fetching from the database all the time.

In Drupal 7, this means that http://drupal.org/project/entitycache needs to provide it's own controller class to provide persistent caching for entities.

We can make this a lot more flexible by just replacing the custom caching within the Entity controller class, with a configurable cache controller key instead of the current 'static cache' key. There's no need for entity-specific cache controllers, since any class implementing CacheBackendInterface will do fine.

To allow for 'static' caching, I've added a new ArrayBackend which simply stores cache items in a php array. Apart from expires which didn't seem worth working on until #730060: Replace CACHE_TEMPORARY, cache_clear_all() and minimum cache lifetime with cache tags support is in, this (untested) backend supports everything the database backend does, including tags etc., meaning it should be useful for unit testing eventually.

For no static caching at all, the NullBackend works fine.

To actually implement entitycache in D8 (whether core or contrib), you'd need a backend that proxies the MemoryBackend + whichever one is implemented for the cache_entity bin, since we're placing responsibility for both in a single class doing things this way. There's some inconsistencies with resetCache() etc. that would need to be sorted out for that.

Completely untested patch that will likely blow up, but just to show what it looks like.

One feature gets dropped here, which is fetching from cache when $conditions is passed to entity_load(). That's already a bit wonky as it is, and the $conditions parameter is already on its way out and documented as deprecated in 7.x per #1184272: Remove deprecated $conditions support from entity controller.

Aggregated css/js asset files can be garbage collected while cached pages referencing them exist

$
0
0

We recently noticed a situation where a cached page on a reverse-proxy (in our case, cloudflare) was referring to a deleted aggregated js file, and so was getting a 404 response on that file, so the page was broken.

Drupal uses a configuration setting (system.performance.stale_file_threshold) to perform garbage collection of optimized js and css assets.

This is set by default to 30 days.

Our problem is that the js file was deleted from the file system, even though a reference for the js file still exists in the cloudflare cache.

This is a large-scale site, so we avoid purging the cloudflare cache if we can help it, so the situation may arise when the cloudflare page is referencing a deleted js file, simply because the js file was generated more than 30 days ago.

Looking at the following code (src/docroot/core/lib/Drupal/Core/Asset/JsCollectionOptimizer.php:177)

public function deleteAll() {
  $this->state->delete('system.js_cache_files');
  $delete_stale = function ($uri) {
    // Default stale file threshold is 30 days.
    if (REQUEST_TIME - filemtime($uri) > \Drupal::config('system.performance')->get('stale_file_threshold')) {
      file_unmanaged_delete($uri);
    }
  };
  file_scan_directory('public://js', '/.*/', ['callback' => $delete_stale]);
}

... I am wondering if it might be better (depending on a config setting, and if the underlying file system supports it) to use fileatime() as the check instead of filemtime().

In other words, we would only mark the asset file as stale, if it hasn't been *accessed* in over 30 days, rather than depending on whether it was *modified* over 30 days ago.

Allow modules to alter node RDF metadata

$
0
0

Currently the rdf.module hook_preprocess_node() implementation renders the added metadata using drupal_render() and other modules are not be able to alter this metadata.

Since we are using twig to print this variable, removing the call to drupal_render() does not have any effect on existing sites.

ConfigValidation class contains code that is brittle and changing for every addition

$
0
0

Problem/Motivation

Every time we add new things to validate and test it using config_test.validate we're changing \Drupal\config_test\ConfigValidation::validateMapping(). See #2920682: Add config validation for plugin IDs and #2920678: Add config validation for machine names

This is a test only change.

Proposed resolution

Make the validation less brittle to change.

This was added in #1928868-102: Typed config incorrectly implements Typed Data interfaces - the comment that lead to test was:

So we currently do not validate an entire mapping or sequence on its own.

So this change is still ensuring that we are looking at all the keys in the mapping.

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

Properly deprecate SafeMarkup::isSafe, SafeMarkup::checkPlain and the SafeMarkup class

$
0
0

Problem/Motivation

The SafeMarkup class has been deprecated since 8.0.0 but we didn't have deprecation testing then or a policy to add @trigger_error()

Handling \Drupal\Component\Utility\SafeMarkup::format() in a separate issue because it is still in use - see #2958429: Properly deprecate SafeMarkup::format()

Proposed resolution

Add @trigger_error() and improve the tests to test this.

Remaining tasks

User interface changes

None

API changes

None - this is already documented at https://www.drupal.org/node/2549395

Data model changes

None

Viewing all 291053 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>