Problem/Motivation

As a relic of Drupal <6 the Statistics module only counts node views. Now we have many different entities we should be counting those too.

Proposed resolution

- Replace the node_counter table with statistics_counter
- Add column for entity type
- Replace node id column with entity id
- Replace statistics_node_view with statistics_entity_view
- Replace statistics_node_predelete with statistics_entity_predelete

Remaining tasks

All of them

User interface changes

none

API changes

none

Data model changes

- Table name changes
- Column name changes

CommentFileSizeAuthor
#103 10.3.x_2532334_103.patch71.19 KBjordan.jamous
#101 11.x_2532334_101.patch69.49 KBthtas
#101 10.2.x_2532334_101.patch69.69 KBthtas
#101 10.1.x_2532334_101.patch69.3 KBthtas
#100 11.x_2532334_100.patch69.47 KBthtas
#100 10.2.x_2532334_100.patch69.67 KBthtas
#100 10.1.x_2532334_100.patch69.28 KBthtas
#99 11.x_2532334_99.patch68.33 KBthtas
#99 10.2.x_2532334_99.patch68.54 KBthtas
#99 10.1.x_2532334_99.patch68.15 KBthtas
#96 2532334_96.patch67.58 KBjoey91133
#91 2532334_91.patch67.58 KBjoey91133
#90 2532334_90.patch67.58 KBjoey91133
#89 2532334_88.patch67.65 KBjoey91133
#87 interdiff_83-87.txt830 bytesvsujeetkumar
#87 2532334_87.patch67.66 KBvsujeetkumar
#86 2532334_86.patch67.86 KBbobooon
#85 2532334_85.patch67.77 KBbobooon
#83 interdiff_81-83.txt1.04 KBvsujeetkumar
#83 2532334_83.patch67.65 KBvsujeetkumar
#81 interdiff_75-81.txt775 bytesvsujeetkumar
#81 2532334_81.patch67.58 KBvsujeetkumar
#76 2532334_76.patch67.71 KBbobooon
#75 2532334_75.patch67.47 KBvsujeetkumar
#72 2532334_72.patch65.95 KBbobooon
#70 interdiff_68-70.txt1.04 KBvsujeetkumar
#70 2532334_70.patch67.46 KBvsujeetkumar
#68 interdiff_66-68.txt1.29 KBvsujeetkumar
#68 2532334_68.patch66.73 KBvsujeetkumar
#66 2532334_66.patch66.72 KBanmolgoyal74
#65 interdiff_63-65.txt5.21 KBvsujeetkumar
#65 2532334_65.patch66.72 KBvsujeetkumar
#63 2532334_63.patch64.35 KBvsujeetkumar
#62 interdiff_57-60.txt3.65 KBsanjayk
#62 2532334-62.patch64.52 KBsanjayk
#60 interdiff_57-60.txt3.65 KBsanjayk
#60 2532334-60.patch60.25 KBsanjayk
#57 interdiff_55_57.txt2.26 KBanmolgoyal74
#57 2532334_57.patch57.94 KBanmolgoyal74
#55 2532334_55.patch57.59 KBvsujeetkumar
#51 2532334-51.patch61.02 KBisabelle.wagenvoord
#50 2532334-50.patch60.74 KBisabelle.wagenvoord
#43 2532334-43.patch60.96 KBsavkaviktor16@gmail.com
#34 2532334-34.patch61.14 KBtimmillwood
#34 interdiff-2532334-34.txt1.47 KBtimmillwood
#32 2532334-32.patch60.81 KBtimmillwood
#32 interdiff-2532334-32.txt5.36 KBtimmillwood
#28 2532334-28.patch59.7 KBtimmillwood
#28 interdiff-2532334-28.txt2.93 KBtimmillwood
#26 2532334-26.patch57.13 KBtimmillwood
#26 interdiff-2532334-26.txt14.16 KBtimmillwood
#24 interdiff-8c4ba7.txt2.5 KBjibran
#20 2532334-20.patch68.66 KBtimmillwood
#20 interdiff-2532334-20.txt719 bytestimmillwood
#18 2532334-18.patch68.66 KBtimmillwood
#18 interdiff-2532334-18.txt12.72 KBtimmillwood
#16 2532334-16.patch63.08 KBtimmillwood
#14 count_all_content-2532334-14-do-not-test.patch44.81 KBjibran
#14 count_all_content-2532334-14-8.2.x-do-not-test.patch44.5 KBjibran
#14 interdiff.txt17.52 KBjibran
#11 count_all_entity_views-2532334-11-8.2.x-do-not-test.patch40.43 KBjibran
#11 count_all_entity_views-2532334-11-do-not-test.patch40.71 KBjibran
#10 count_all_entity_views-2532334-10-8.2.x-do-not-test.patch39.48 KBjibran
#10 count_all_entity_views-2532334-10-do-not-test.patch39.73 KBjibran

Comments

timmillwood’s picture

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

manuel garcia’s picture

Version: 8.1.x-dev » 8.2.x-dev
mallezie’s picture

Title: Count all entity views in the Statistics module » [PP-1] Count all entity views in the Statistics module
Status: Needs work » Postponed

Let's really postpone it on that one.

mallezie’s picture

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

timmillwood’s picture

Title: [PP-1] Count all entity views in the Statistics module » Count all entity views in the Statistics module
Status: Postponed » Active
jibran’s picture

Assigned: timmillwood » jibran

I had brief chat with @timmillwood. That's how I think we should change this:

  • Add per entity table to store stats.
  • Update UI/schema to allow entity types selection.
  • Add a new service to create new table(s) for each selected entity type(s).
  • Replace statistics_node_view with statistics_entity_view.
  • Replace statistics_node_predelete with statistics_entity_predelete.
  • Update views integration.
  • Update tokens.
  • Add some new genric tests.
timmillwood’s picture

We won't be able to replace statistics_node_view and statistics_node_predelete, we would have to support both node and entity versions, but maybe deprecate the node versions.

jibran’s picture

Title: Count all entity views in the Statistics module » Count all content entities views in the Statistics module
Assigned: jibran » Unassigned
Status: Active » Needs review
Issue tags: +Need tests, +Needs upgrade path tests
StatusFileSize
new39.73 KB
new39.48 KB
  • Here is a working patch with views integration.
  • NodeStatisticsDatabaseStorage was only introduced in 8.3.x so I changed the whole file and made it generic.
  • To initiate minimum amount of services during statistics.php ajax call I moved resetDayCount to new service.
  • As per #9 I maintained the BC.
  • With my current approach, I was unable to accommodate StatisticsStorageInterface::fetchViews() so I removed it.
  • @timmillwood if https://www.drupal.org/project/redis_statistics needs StatisticsStorageInterface::fetchViews() then StatisticsRedisStorage can implement a protected method but I think module needs a re-write anyway. :D
  • I didn't update any tests hence don't test patch.
  • Needless to say we need some generic entity test.
  • Patch has an upgrade path so I suppose we need upgrade path tests as well.
  • Reviews are welcome but I'm not activily working on this anymore.
jibran’s picture

Forgot to add core/modules/statistics/src/Plugin/views/field/EntityCounterTimestamp.php

benjy’s picture

Initial review, didn't actually test it out.

  1. +++ b/modules/statistics/src/StatisticsDatabaseStorage.php
    @@ -0,0 +1,173 @@
    +  public function maxTotalCount($entity_type_id) {
    

    You pass the $entity_type_id in here both the $entity_type is most other places? Maybe we should make it consistent?

  2. +++ b/modules/statistics/src/StatisticsSettingsForm.php
    @@ -63,19 +97,23 @@ protected function getEditableConfigNames() {
    +      '#title' => $this->t('Select entities'),
    

    Do we use terms like "entity" in the UI? I note right above we have a reference to "Content entity" as well.

    Maybe we should loop over the entity types and render the label. So we have, "Enable statistics for Content/Block/Media" etc.

  3. +++ b/modules/statistics/src/StatisticsSettingsForm.php
    @@ -84,9 +122,19 @@ public function buildForm(array $form, FormStateInterface $form_state) {
    +        $this->statisticsStorage->dropTable($entity_type);
    

    I wonder if we need to clearly state on the form that un-checking will delete all existing data? Maybe even a confirmation page?

  4. +++ b/modules/statistics/statistics.install
    @@ -9,53 +9,13 @@
     function statistics_uninstall() {
    

    Do we need to handle cleaning up the tables here now?

  5. +++ b/modules/statistics/statistics.install
    @@ -86,3 +46,14 @@ function statistics_update_8002() {
    +  $config->clear('count_content_views')->save();
    ...
    +  $config->set('entity_type_ids', $value)->save();
    

    Saves twice.

  6. +++ b/modules/statistics/statistics.module
    @@ -40,7 +40,43 @@ function statistics_help($route_name, RouteMatchInterface $route_match) {
    +  if ($entity_type_id == 'node') {
    ...
    +  if ($route_match->getRouteName() == $route_name) {
    ...
    +  if (!$entity->isNew() && $view_mode == 'full' && $entity_is_page && empty($entity->in_preview)) {
    

    No reason not to use === in each of these.

  7. +++ b/modules/statistics/statistics.module
    @@ -40,7 +40,43 @@ function statistics_help($route_name, RouteMatchInterface $route_match) {
    +  $route_name = "entity.{$entity_type_id}.canonical";
    

    The brackets aren't needed inside the quotes?

  8. +++ b/modules/statistics/statistics.module
    @@ -70,10 +106,14 @@ function statistics_node_links_alter(array &$links, NodeInterface $entity, array
    +  \Drupal::service('statistics.reset_count')->resetDayCount();
    

    Reset isn't per entity type?

  9. +++ b/modules/statistics/statistics.module
    @@ -139,14 +182,28 @@ function statistics_get($id) {
    +  // @todo Remove this condition once statistics_node_view() is removed.
    

    Any reason not todo that here?

  10. +++ b/modules/statistics/statistics.module
    @@ -139,14 +182,28 @@ function statistics_get($id) {
    +  if ($entity->getEntityTypeId() == 'node') {
    

    ===

  11. +++ b/modules/statistics/statistics.php
    @@ -11,20 +11,32 @@
    -$kernel = DrupalKernel::createFromRequest(Request::createFromGlobals(), $autoloader, 'prod');
    +$request = Request::createFromGlobals();
    +$kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod');
    

    Un-related change?

  12. +++ b/modules/statistics/statistics.services.yml
    @@ -1,6 +1,12 @@
    +    class: Drupal\statistics\StatisticsResetCount
    

    I can't see this class in the patch?

tstoeckler’s picture

+++ b/core/modules/statistics/src/StatisticsDatabaseStorage.php
@@ -0,0 +1,173 @@
+          $idKey => [
+            'description' => "The {{$entity_type_id}}.$idKey for these statistics.",
+            'type' => 'int',
+            'unsigned' => TRUE,
+            'not null' => TRUE,
+            'default' => 0,
+          ],

Note that the entity ID may be a string.

jibran’s picture

StatusFileSize
new17.52 KB
new44.5 KB
new44.81 KB

Thanks @benjy for the review here is my response.

  1. Yeah, I wrote it like that but then changed it any reverted back to your suggestion.
  2. How about now?
  3. Yeah, good idea. I'll add it later.
  4. Good catch. Fixed.
  5. Fixed.
  6. Fixed.
  7. Hmm https://3v4l.org/UKWcF. Fixed.
  8. It was not but it is a good idea. Updated.
  9. See #9.
  10. Fixed.
  11. We are pushing the same request to the request stack blow.
  12. Added now.

@tstoeckler Yeah, I thought about it but then procrastination won. Fixed it.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

timmillwood’s picture

StatusFileSize
new63.08 KB

Re-roll of #14.

I don't think it's possible to remove NodeStatisticsDatabaseStorage in a BC way, but maybe we can deprecate it some how and run NodeStatisticsDatabaseStorage and the more generic StatisticsDatabaseStorage together.

Status: Needs review » Needs work

The last submitted patch, 16: 2532334-16.patch, failed testing.

timmillwood’s picture

Status: Needs work » Needs review
StatusFileSize
new12.72 KB
new68.66 KB

Progress.

Needs some stuff to make it backwards compatible.

Status: Needs review » Needs work

The last submitted patch, 18: 2532334-18.patch, failed testing.

timmillwood’s picture

Status: Needs work » Needs review
StatusFileSize
new719 bytes
new68.66 KB

Ooops typo.

Status: Needs review » Needs work

The last submitted patch, 20: 2532334-20.patch, failed testing.

jibran’s picture

Thanks for fixing the existing tests.
@timmillwood after spending some time with the patch what do you think about the approach? Do you still think we still need
StatisticsStorageFactory as we talked about it before?
Personally, I'd love to go down that road but I want to load minimum files during statistics.php request.

timmillwood’s picture

@jibran - I was wondering if we could keep the interface as it was before, but with $entity_type = null so it'll work for the old service and the new service. The old service will then just extend the new service and pass in the Node entity type. If that doesn't work we'll just have to have two interfaces, but can still have the old service extend the new one.

statistics.php will always call the new service, we just need to keep the old one around for backwards compatibility.

Thinking a factory might be overkill.

Started work last night added all deleted test and the old service back in. Will try to finish that off tonight.

jibran’s picture

StatusFileSize
new2.5 KB

Awesome. Here is an interdiff for PHPCS fails.

timmillwood’s picture

Great stuff, thanks!

timmillwood’s picture

Status: Needs work » Needs review
StatusFileSize
new14.16 KB
new57.13 KB

This will fail testing, but shows progress.

Status: Needs review » Needs work

The last submitted patch, 26: 2532334-26.patch, failed testing.

timmillwood’s picture

Status: Needs work » Needs review
StatusFileSize
new2.93 KB
new59.7 KB

Trying to fix some of the failing tests, and rebase after the tests moved.

Status: Needs review » Needs work

The last submitted patch, 28: 2532334-28.patch, failed testing.

jibran’s picture

+++ b/core/modules/block/tests/src/Kernel/Migrate/d6/MigrateBlockTest.php
@@ -239,9 +239,9 @@ public function testBlockMigration() {
-      'id' => 'broken',
+      'id' => 'statistics_popular_block',
...
-      'provider' => 'core',
+      'provider' => 'statistics',

I don't think this is a correct fix.

timmillwood’s picture

@jibran - yes, should've added a @todo to that, wasn't really sure what was going on.

I think many of the remaining test fails are relating to the *_counter table now being lazy loaded.

timmillwood’s picture

Status: Needs work » Needs review
StatusFileSize
new5.36 KB
new60.81 KB

Status: Needs review » Needs work

The last submitted patch, 32: 2532334-32.patch, failed testing.

timmillwood’s picture

Status: Needs work » Needs review
StatusFileSize
new1.47 KB
new61.14 KB
jibran’s picture

Nice work! Now we add tests.

dawehner’s picture

  1. +++ b/core/modules/statistics/config/schema/statistics.schema.yml
    @@ -4,12 +4,15 @@ statistics.settings:
    +    entity_type_ids:
    +      type: sequence
    +      label: 'Entity Type IDs'
    +      sequence:
    +        type: string
    +        label: 'Entity Type ID'
    

    I'm wondering whether it makes sense to add a constant to ensure that the value in here is an actual entity type.

  2. +++ b/core/modules/statistics/src/StatisticsDatabaseStorage.php
    @@ -0,0 +1,242 @@
    +  public function recordView($entity_type_id, $key, $id) {
    ...
    +        $entity_type = \Drupal::entityTypeManager()->getDefinition($entity_type_id);
    ...
    +  public function fetchView(EntityTypeInterface $entity_type, $id) {
    ...
    +  public function fetchAll(EntityTypeInterface $entity_type, $order = 'totalcount', $limit = 5) {
    

    It is a bit weird to have an api which is partially using the entity type ID and partially entity type, but meh, maybe its just me, even if you actually load the entity type.

  3. +++ b/core/modules/statistics/src/StatisticsDatabaseStorage.php
    @@ -0,0 +1,242 @@
    +  public function createTable(EntityTypeInterface $entity_type) {
    

    It is weird that this method is public. I'd have argued that this is purely an implementation detail. Why can't we do a similar kind of exception handling like for example the statistics module.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

wim leers’s picture

I just ran into #103866: Add a general counter API, which seems an even more generic predecessor to this :)

  1. +++ b/core/modules/search/src/Tests/SearchRankingTest.php
    @@ -95,11 +95,12 @@ public function testRankings() {
    -    $this->config('statistics.settings')->set('count_content_views', 1)->save();
    +    $this->config('statistics.settings')->set('entity_type_ids', ['node'])->save();
    
    +++ b/core/modules/statistics/config/install/statistics.settings.yml
    @@ -1,2 +1,2 @@
    -count_content_views: 0
    +entity_type_ids: {}
    

    This is going away in #2502313: Installing the Statistics module doesn't do anything, one must also know about some pretty mysterious setting and enable it — that's making this module zero-configuration.

    Why reintroduce configuration?

    Can't we just automatically track all entity types on their full view modes? If not that, on their EntityViewControllers/canonical pages?

  2. +++ b/core/modules/statistics/src/StatisticsDatabaseStorage.php
    @@ -0,0 +1,242 @@
    +  protected function tableName(EntityTypeInterface $entity_type) {
    +    $entity_type_id = $entity_type->id();
    +    return $entity_type_id . '_counter';
    +  }
    

    Why a specific table per entity type?

    Why not one counter table with entity_type_id as a column? Or perhaps even just tracking uuid.

timmillwood’s picture

Re: #39.2 - there were a few thoughts behind having a table per entity type.

  1. It'd be backwards compatible if for some reason someone is querying the table directly.
  2. We get smaller tables.
  3. Smaller tables could mean quicker queries.
manuel garcia’s picture

Issue tags: +Needs reroll
wim leers’s picture

#40: RE #39.2:

  1. #2543726: Make $term->parent behave like any other entity reference field, to fix REST and Migrate support and de-customize its Views integration has proven that this does not need to be the case.
  2. Is this actually a benefit?
  3. Is this actually true?
savkaviktor16@gmail.com’s picture

Issue tags: -Needs reroll
StatusFileSize
new60.96 KB

re-rolled

timmillwood’s picture

@Wim Leers - Honestly, I'm pretty ambivalent.

I guess we could look at converting the node_counter table to statistics and add an entity_type_id column?

Status: Needs review » Needs work

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

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

astringer’s picture

Issue tags: +Needs reroll

I also tried to apply the patch through Composer and it failed.

isabelle.wagenvoord’s picture

Status: Needs work » Needs review
Issue tags: -Needs reroll
StatusFileSize
new60.74 KB

this is my attempt to reroll the patch at comment #34. this is my first time doing it as a part of completing Drupal's core ladder.

isabelle.wagenvoord’s picture

StatusFileSize
new61.02 KB

Here is my second attempt at rerolling the patch. I fixed the syntax error I introduced.

Status: Needs review » Needs work

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

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

gantal’s picture

Issue tags: +DCCO2020

Tagging for DrupalCamp Colorado's upcoming contrib day.

vsujeetkumar’s picture

Status: Needs work » Needs review
StatusFileSize
new57.59 KB

Re-roll patch created for 9.1.x.

Status: Needs review » Needs work

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

anmolgoyal74’s picture

Status: Needs work » Needs review
StatusFileSize
new57.94 KB
new2.26 KB

Fixed CS issue and created service 'statistics.storage.node'

Status: Needs review » Needs work

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

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

sanjayk’s picture

Status: Needs work » Needs review
StatusFileSize
new60.25 KB
new3.65 KB

Worked on few issues which is related to

TypeError: Argument 1 passed to Drupal\statistics\NodeStatisticsDatabaseStorage::fetchView() must implement interface Drupal\Core\Entity\EntityTypeInterface, string given, called in

Got the below solution

$node_entity = \Drupal::entityTypeManager()->getStorage('node')->load($this->node->id());
$statistics = \Drupal::service('statistics.storage.node')->fetchView($node_entity->getEntityType(), $this->node->id());

I have created an object of entity type and load a node and passed into the called service. Kindly review and let me know if need any changes.

Working on rest of the issues once fixed I will update here.

Status: Needs review » Needs work

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

sanjayk’s picture

StatusFileSize
new64.52 KB
new3.65 KB

@here kindly review the patch and let me know if any changes required.

vsujeetkumar’s picture

Status: Needs work » Needs review
StatusFileSize
new64.35 KB

Re-roll patch created for 9.2.x.

Status: Needs review » Needs work

The last submitted patch, 63: 2532334_63.patch, failed testing. View results

vsujeetkumar’s picture

Status: Needs work » Needs review
StatusFileSize
new66.72 KB
new5.21 KB

Fixing fail tests.

anmolgoyal74’s picture

StatusFileSize
new66.72 KB

Re-rolled #65.

Status: Needs review » Needs work

The last submitted patch, 66: 2532334_66.patch, failed testing. View results

vsujeetkumar’s picture

Status: Needs work » Needs review
StatusFileSize
new66.73 KB
new1.29 KB

Fixing the test fails issue.

@anmolgoyal74 Re-rolling is not up to the mark in #66, forgot to remove old "fetchView()" function from the file "NodeStatisticsDatabaseStorage.php", Please have a look.

Status: Needs review » Needs work

The last submitted patch, 68: 2532334_68.patch, failed testing. View results

vsujeetkumar’s picture

Status: Needs work » Needs review
StatusFileSize
new67.46 KB
new1.04 KB

Fixing the test.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

bobooon’s picture

StatusFileSize
new65.95 KB

Rerolled #70 for 9.1.x.

Status: Needs review » Needs work

The last submitted patch, 72: 2532334_72.patch, failed testing. View results

vsujeetkumar’s picture

Some files are missing in re-roll provided in #72.

vsujeetkumar’s picture

Status: Needs work » Needs review
StatusFileSize
new67.47 KB

Re-roll patch created for 9.3.x, Please have a look.

bobooon’s picture

StatusFileSize
new67.71 KB

Rerolled #72 with missing changes for 9.1.x.

Status: Needs review » Needs work

The last submitted patch, 76: 2532334_76.patch, failed testing. View results

bobooon’s picture

StatusFileSize
new67.71 KB

Wrong file uploaded.

bobooon’s picture

StatusFileSize
new67.71 KB
vsujeetkumar’s picture

Status: Needs work » Needs review

Fixed the custom command fail issue for 9.3.x.

vsujeetkumar’s picture

StatusFileSize
new67.58 KB
new775 bytes

Please ignore my previous comment #80.

Fixed the custom command fail issue for 9.3.x.

Status: Needs review » Needs work

The last submitted patch, 81: 2532334_81.patch, failed testing. View results

vsujeetkumar’s picture

Status: Needs work » Needs review
StatusFileSize
new67.65 KB
new1.04 KB

Fixed the fail tests in #81. Please have a look.

Status: Needs review » Needs work

The last submitted patch, 83: 2532334_83.patch, failed testing. View results

bobooon’s picture

StatusFileSize
new67.77 KB

Re-rolled #70 for latest 9.2.x. Unable to apply #70 to a fresh 9.2.4 install.

bobooon’s picture

StatusFileSize
new67.86 KB

Fixes missing parameter definition in #85.

vsujeetkumar’s picture

Status: Needs work » Needs review
StatusFileSize
new67.66 KB
new830 bytes

Fixed the fail test in #83 for 9.3.x, Please have a look.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

joey91133’s picture

StatusFileSize
new67.65 KB

Fixed the fail test in #83 for 9.3.0 release.

joey91133’s picture

StatusFileSize
new67.58 KB

Fixed the fail test in #83 for 9.3.0 release.

joey91133’s picture

StatusFileSize
new67.58 KB

Fixed the fail test in #83 for 9.3.0 release. (fix apply failed)

Status: Needs review » Needs work

The last submitted patch, 91: 2532334_91.patch, failed testing. View results

b_sharpe’s picture

FYI: As an alternative - https://www.drupal.org/project/usage_data

Definitely not production ready, but pluggable and event-based tracking based off core's statistics module so can track all entity types, plus routes, views, etc.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

joey91133’s picture

StatusFileSize
new67.58 KB

Fixed the fail test in #83 for 9.5.x release.

quietone’s picture

Status: Needs work » Postponed

Statistics is approved for removal. See #3266457: [Policy] Deprecate Statistics module in D10 and move to contrib in D11

This is now Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.

It will be moved to a contributed Statistics project once the project is created and the Drupal 11 branch is open.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

thtas’s picture

StatusFileSize
new68.15 KB
new68.54 KB
new68.33 KB

Attached is a re-roll against 10.1.x, 10.2.x and 11.x

thtas’s picture

StatusFileSize
new69.28 KB
new69.67 KB
new69.47 KB
thtas’s picture

StatusFileSize
new69.3 KB
new69.69 KB
new69.49 KB
quietone’s picture

Project: Drupal core » Statistics
Version: 11.x-dev » 1.0.0-beta1
Component: statistics.module » Code
Status: Postponed » Needs work
jordan.jamous’s picture

StatusFileSize
new71.19 KB

Attached is a re-roll against 10.3.x

Tests are failing for modules/search/tests/src/Functional/SearchRankingTest.php

phpunit ./web/core/modules/search/tests/src/Functional/SearchRankingTest.php
PHPUnit 9.6.19 by Sebastian Bergmann and contributors.

E.                                                                  2 / 2 (100%)

Time: 00:10.277, Memory: 8.00 MB

There was 1 error:

1) Drupal\Tests\search\Functional\SearchRankingTest::testRankings
Behat\Mink\Exception\ElementNotFoundException: Select with id|name|label|value "edit-rankings-views-value" not found.

/var/www/html/drupal/web/core/tests/Drupal/Tests/WebAssert.php:234
/var/www/html/drupal/web/core/modules/search/tests/src/Functional/SearchRankingTest.php:130
fgm’s picture

@jordan.jamous thanks for the reroll. Can you convert the path to a MR, since the old bot no longer runs and we have a working Gitlab CI integration ?

anybody’s picture

+1 on this request, totally makes sense!

Could someone please create the MR from the patch?

joachim’s picture

The patch here is doing a LOT.

There's stuff related to:

- #103866: Add a general counter API
- #3064152: Separate `statistics` pseudo field from the general `links` field

Also, there doesn't seem to be any config to determine which entity types get counted in the entity view hook.

I think we probably need to take a slower approach to this, tackling other issues first to generalise node-specific things individually.