Problem/Motivation

See \Drupal\migrate\Plugin\migrate\source\SourcePluginBase::count() + \Drupal\migrate\Plugin\migrate\source\SourcePluginBase::$cacheCounts.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Comments

Wim Leers created an issue. See original summary.

wim leers’s picture

Status: Active » Needs review
StatusFileSize
new1.01 KB

Status: Needs review » Needs work

The last submitted patch, 2: 3190804-2.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

wim leers’s picture

I cannot reproduce those failures. Re-testing against 9.1 in case that makes a difference.

wim leers’s picture

Title: Allow source counts to be cached: implement ::doCount() instead of ::count() » [PP-1] Allow source counts to be cached: implement ::doCount() instead of ::count()
Status: Needs work » Postponed
damienmckenna’s picture

Thanks for the patch and improvement, I look forward to the core change being committed so we can take advantage of this.

wim leers’s picture

Issue tags: +Novice

@DamienMcKenna: wow that was fast! 😄

+++ b/src/Plugin/migrate/source/d7/MetatagFieldInstance.php
@@ -137,7 +137,7 @@ class MetatagFieldInstance extends DrupalSqlBase {
-  public function count($refresh = FALSE) {
+  public function doCount() {

Nit: should be protected.

wim leers’s picture

Title: [PP-1] Allow source counts to be cached: implement ::doCount() instead of ::count() » Allow source counts to be cached: implement ::doCount() instead of ::count()
Status: Postponed » Needs review
damienmckenna’s picture

StatusFileSize
new1.02 KB

This would break compatibility with 8.9, so let's see if we can have both functions.

wim leers’s picture

+++ b/src/Plugin/migrate/source/d7/MetatagFieldInstance.php
@@ -141,4 +141,11 @@ public function count($refresh = FALSE) {
+  public function doCount() {

Should still be changed to protected 😅

damienmckenna’s picture

StatusFileSize
new1.03 KB

Doh.

wim leers’s picture

Status: Needs review » Needs work
Issue tags: -Novice

FYI: the two failures in #12 on PHP 8 + Drupal 9.2 are the same two that exist in HEAD: https://www.drupal.org/pift-ci-job/2057145.

Also, the change in #10 + #12 compared to #12 breaks the performance improvement that #3190815: Source count caching broken: impossible to enable source count caching for SqlBase-based source plugins (plus, unneeded cache I/O) made possible.

If you want to support both simultaneously, you'll need to make count() smarter: you'll need to update its logic to be conditional depending on the Drupal core version…

wim leers’s picture

With #3190818: Allow source counts to be cached: implement ::doCount() instead of ::count() also committed … and with time having passed … I'm wondering if you'd be willing to commit this without BC layer for Drupal 8.9, @DamienMcKenna?

damienmckenna’s picture

With Drupal 8 no longer supported, I think this can go in the next release.

damienmckenna’s picture

Status: Needs work » Fixed

Committed. Thank you.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.