Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
With the help of drupal-check tool following list of issues has been found:
➜ drupal8_local git:(8.8.x) ✗ drupal-check modules/contrib/google_analytics
18/18 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
------ -----------------------------------------------------------------------------------
Line google_analytics.module
------ -----------------------------------------------------------------------------------
212 Call to deprecated method strlen() of class Drupal\Component\Utility\Unicode:
in Drupal 8.6.0, will be removed before Drupal 9.0.0. Use
mb_strlen() instead.
220 Call to deprecated method strlen() of class Drupal\Component\Utility\Unicode:
in Drupal 8.6.0, will be removed before Drupal 9.0.0. Use
mb_strlen() instead.
503 Call to deprecated function file_prepare_directory():
in Drupal 8.7.0, will be removed before Drupal 9.0.0.
Use \Drupal\Core\File\FileSystemInterface::prepareDirectory().
505 Call to deprecated function file_unmanaged_save_data():
in Drupal 8.7.0, will be removed before Drupal 9.0.0.
Use \Drupal\Core\File\FileSystemInterface::saveData().
508 Call to deprecated function file_unmanaged_save_data():
in Drupal 8.7.0, will be removed before Drupal 9.0.0.
Use \Drupal\Core\File\FileSystemInterface::saveData().
519 Call to deprecated function file_prepare_directory():
in Drupal 8.7.0, will be removed before Drupal 9.0.0.
Use \Drupal\Core\File\FileSystemInterface::prepareDirectory().
522 Call to deprecated function file_unmanaged_save_data():
in Drupal 8.7.0, will be removed before Drupal 9.0.0.
Use \Drupal\Core\File\FileSystemInterface::saveData().
525 Call to deprecated function file_unmanaged_save_data():
in Drupal 8.7.0, will be removed before Drupal 9.0.0.
Use \Drupal\Core\File\FileSystemInterface::saveData().
549 Call to deprecated function file_prepare_directory():
in Drupal 8.7.0, will be removed before Drupal 9.0.0.
Use \Drupal\Core\File\FileSystemInterface::prepareDirectory().
652 Call to deprecated method strtolower() of class Drupal\Component\Utility\Unicode:
in Drupal 8.6.0, will be removed before Drupal 9.0.0. Use
mb_strtolower() instead.
656 Call to deprecated method strtolower() of class Drupal\Component\Utility\Unicode:
in Drupal 8.6.0, will be removed before Drupal 9.0.0. Use
mb_strtolower() instead.
------ -----------------------------------------------------------------------------------
------ -----------------------------------------------------------------------------------
Line src/Form/GoogleAnalyticsAdminSettingsForm.php
------ -----------------------------------------------------------------------------------
568 Call to deprecated method strlen() of class Drupal\Component\Utility\Unicode:
in Drupal 8.6.0, will be removed before Drupal 9.0.0. Use
mb_strlen() instead.
577 Call to deprecated method strlen() of class Drupal\Component\Utility\Unicode:
in Drupal 8.6.0, will be removed before Drupal 9.0.0. Use
mb_strlen() instead.
706 Call to deprecated method strlen() of class Drupal\Component\Utility\Unicode:
in Drupal 8.6.0, will be removed before Drupal 9.0.0. Use
mb_strlen() instead.
927 Call to deprecated method strlen() of class Drupal\Component\Utility\Unicode:
in Drupal 8.6.0, will be removed before Drupal 9.0.0. Use
mb_strlen() instead.
930 Call to deprecated method strlen() of class Drupal\Component\Utility\Unicode:
in Drupal 8.6.0, will be removed before Drupal 9.0.0. Use
mb_strlen() instead.
975 Call to deprecated method strtolower() of class Drupal\Component\Utility\Unicode:
in Drupal 8.6.0, will be removed before Drupal 9.0.0. Use
mb_strtolower() instead.
------ -----------------------------------------------------------------------------------
------ ----------------------------------------------------------------------------------------------------------------------
Line src/Tests/GoogleAnalyticsBasicTest.php
------ ----------------------------------------------------------------------------------------------------------------------
14 Class Drupal\google_analytics\Tests\GoogleAnalyticsBasicTest extends deprecated class Drupal\simpletest\WebTestBase:
in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
38 Call to method setUp() of deprecated class Drupal\simpletest\WebTestBase:
in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
------ ----------------------------------------------------------------------------------------------------------------------
------ -------------------------------------------------------------------------------------------------------------------------------------------
Line src/Tests/GoogleAnalyticsCustomDimensionsAndMetricsTest.php
------ -------------------------------------------------------------------------------------------------------------------------------------------
15 Class Drupal\google_analytics\Tests\GoogleAnalyticsCustomDimensionsAndMetricsTest extends deprecated class Drupal\simpletest\WebTestBase:
in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
28 Call to method setUp() of deprecated class Drupal\simpletest\WebTestBase:
in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
------ -------------------------------------------------------------------------------------------------------------------------------------------
------ -----------------------------------------------------------------------------------------------------------------------
Line src/Tests/GoogleAnalyticsCustomUrls.php
------ -----------------------------------------------------------------------------------------------------------------------
12 Class Drupal\google_analytics\Tests\GoogleAnalyticsCustomUrls extends deprecated class Drupal\simpletest\WebTestBase:
in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
25 Call to method setUp() of deprecated class Drupal\simpletest\WebTestBase:
in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
------ -----------------------------------------------------------------------------------------------------------------------
------ --------------------------------------------------------------------------------------------------------------------------
Line src/Tests/GoogleAnalyticsPhpFilterTest.php
------ --------------------------------------------------------------------------------------------------------------------------
15 Class Drupal\google_analytics\Tests\GoogleAnalyticsPhpFilterTest extends deprecated class Drupal\simpletest\WebTestBase:
in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
28 Call to method setUp() of deprecated class Drupal\simpletest\WebTestBase:
in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
------ --------------------------------------------------------------------------------------------------------------------------
------ ----------------------------------------------------------------------------------------------------------------------
Line src/Tests/GoogleAnalyticsRolesTest.php
------ ----------------------------------------------------------------------------------------------------------------------
13 Class Drupal\google_analytics\Tests\GoogleAnalyticsRolesTest extends deprecated class Drupal\simpletest\WebTestBase:
in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
26 Call to method setUp() of deprecated class Drupal\simpletest\WebTestBase:
in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
------ ----------------------------------------------------------------------------------------------------------------------
------ -----------------------------------------------------------------------------------------------------------------------
Line src/Tests/GoogleAnalyticsSearchTest.php
------ -----------------------------------------------------------------------------------------------------------------------
12 Class Drupal\google_analytics\Tests\GoogleAnalyticsSearchTest extends deprecated class Drupal\simpletest\WebTestBase:
in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
25 Call to method setUp() of deprecated class Drupal\simpletest\WebTestBase:
in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
------ -----------------------------------------------------------------------------------------------------------------------
------ -------------------------------------------------------------------------------------------------------------------------------
Line src/Tests/GoogleAnalyticsStatusMessagesTest.php
------ -------------------------------------------------------------------------------------------------------------------------------
12 Class Drupal\google_analytics\Tests\GoogleAnalyticsStatusMessagesTest extends deprecated class Drupal\simpletest\WebTestBase:
in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
25 Call to method setUp() of deprecated class Drupal\simpletest\WebTestBase:
in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
------ -------------------------------------------------------------------------------------------------------------------------------
------ --------------------------------------------------------------------------------------------------------------------------
Line src/Tests/GoogleAnalyticsUninstallTest.php
------ --------------------------------------------------------------------------------------------------------------------------
12 Class Drupal\google_analytics\Tests\GoogleAnalyticsUninstallTest extends deprecated class Drupal\simpletest\WebTestBase:
in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
25 Call to method setUp() of deprecated class Drupal\simpletest\WebTestBase:
in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
55 Call to deprecated function file_prepare_directory():
in Drupal 8.7.0, will be removed before Drupal 9.0.0.
Use \Drupal\Core\File\FileSystemInterface::prepareDirectory().
69 Call to deprecated function file_prepare_directory():
in Drupal 8.7.0, will be removed before Drupal 9.0.0.
Use \Drupal\Core\File\FileSystemInterface::prepareDirectory().
------ --------------------------------------------------------------------------------------------------------------------------
------ ---------------------------------------------------------------------------------------------------------------------------
Line src/Tests/GoogleAnalyticsUserFieldsTest.php
------ ---------------------------------------------------------------------------------------------------------------------------
12 Class Drupal\google_analytics\Tests\GoogleAnalyticsUserFieldsTest extends deprecated class Drupal\simpletest\WebTestBase:
in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
25 Call to method setUp() of deprecated class Drupal\simpletest\WebTestBase:
in Drupal 8.8.0 and will be removed before Drupal 9.0.0. Instead,
use \Drupal\Tests\BrowserTestBase. See https://www.drupal.org/node/3030340.
------ ---------------------------------------------------------------------------------------------------------------------------
[ERROR] Found 37 errors
Comment | File | Size | Author |
---|---|---|---|
#53 | 3072207-53.patch | 63.78 KB | jcnventura |
#53 | interdiff_47_53.txt | 771 bytes | jcnventura |
#51 | google_analytics_upgrade_status_report.png | 48.51 KB | Chris Matthews |
#51 | google_analytics_d9.png | 22.7 KB | Chris Matthews |
#35 | interdiff_26-35.txt | 107.58 KB | neelam_wadhwani |
Comments
Comment #2
pranit84Created a patch to fix all the Drupal-check related issues.
Now, It has no drupal-check issues.
➜ drupal8_local git:(8.8.x) ✗ drupal-check modules/contrib/google_analytics
18/18 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
[OK] No errors
Comment #3
pranit84Comment #4
hass CreditAttribution: hass commentedFailed
Comment #5
pranit84Created a new patch to solve the drupal-check issues.
➜ drupal8_local git:(8.8.x) ✗ drupal-check modules/contrib/google_analytics
18/18 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
[OK] No errors
Comment #6
pranit84Comment #7
pranit84Updated patch:
Comment #8
thallesComment #9
thallesSome of these methods / functions should not be overridden at this time because they were incorporated in 8.7, then broken sites with 8.6.
@See:
https://www.drupal.org/node/3006851
Comment #10
pranit84This means we cannot fix all the drupal-check related issues as of now, as it results in some other errors.
Comment #11
pranit84Trying another patch with a deprecated function file_prepare_directory in a module file.
Comment #12
pranit84Another patch:
Comment #13
pranit84Comment #14
pranit84Comment #15
pranit84As mentioned here: https://www.drupal.org/node/3006851 using any services related to file system results in errors.
Here in this module, we are using 2 deprecated functions because related services are throwing errors.
Functions:
file_unmanaged_copy($source, $destination, $replace)
file_unmanaged_prepare($source, $destination, $replace)
file_unmanaged_move($source, $destination, $replace)
file_unmanaged_delete($path)
file_unmanaged_delete_recursive($path, $callback)
file_unmanaged_save_data($data, $destination, $replace)
file_prepare_directory($dir)
file_destination($destination, $replace)
file_create_filename($basename, $directory)
Services:
\Drupal::service('file_system')->copy($source, $destination, $replace);
\Drupal::service('file_system')->move($source, $destination, $replace);
\Drupal::service('file_system')->delete($path);
\Drupal::service('file_system')->deleteRecursive($path, $callback);
\Drupal::service('file_system')->saveData();
\Drupal::service('file_system')->prepareDirectory($directory, $options);
\Drupal::service('file_system')->getDestinationFilename($destination, $replace);
\Drupal::service('file_system')->createFilename($basename, $directory);
Comment #16
Kristen PolComment #17
Sahana _N CreditAttribution: Sahana _N at Specbee commentedRemoved deprecated methods please review the patch.
Comment #18
thallesFollow a interdiff.
Comment #19
chr.fritschThe constants are also deprecated.
WebTestBase is deprecated. Move the tests to /tests folder and use BrowserTestBase
Comment #20
chr.fritschFixing all the above
Comment #21
chr.fritschFixing the patch
Comment #22
BerdirLets include the core_version_requirement key here with 8.7.7 as that's what the file_system calls require and also update composer.json.
With the patch I see the following remaining deprecation messages:
$defaultTheme is safe to add now, we can also fix that file_unmanaged_delete() and the assertFalse(), the other things should be done in a follow-up issue together with requiring 8.8.
Comment #23
andreyjan CreditAttribution: andreyjan at FFW commented- Added core_version_requirement
- Updated composer file
- Added $defaultTheme
- Replaced assertEmpty
Comment #24
andreyjan CreditAttribution: andreyjan at FFW commentedHow is this test fail related to to the last changes?
Comment #25
BerdirMaybe related to the composer.json change somehow, not sure. You could try to add it as a require-dev in comoser.json instead of test_dependencies, that's the preferred approach now anyway.
Comment #26
andreyjan CreditAttribution: andreyjan at FFW commentedHopefully this fixes.
Comment #27
BerdirDidn't review the test changes in too much depth, but looks pretty good to me now, easier to make smaller changes later on I think.
Comment #28
BerdirThere's a call to path.alias_manager in _google_analytics_visibility_pages() that needs to be changed to path_alias.manager, unfortunately that means the patch also needs to require ^8.8 instead of ^8.7.7
Comment #29
neelam_wadhwani CreditAttribution: neelam_wadhwani at Valuebound for Valuebound commentedComment #30
neelam_wadhwani CreditAttribution: neelam_wadhwani at Valuebound for Valuebound commentedHello @Berdir
Updated patch with
_google_analytics_visibility_pages() - path_alias.manager
^8.7.7 - ^8.8
Kindly review patch.
Comment #32
neelam_wadhwani CreditAttribution: neelam_wadhwani at Valuebound for Valuebound commentedFixed coding standard.
Comment #33
neelam_wadhwani CreditAttribution: neelam_wadhwani at Valuebound for Valuebound commentedComment #34
BerdirLooks like you forgot to add the moved test files, your patch is just removing them now.
Comment #35
neelam_wadhwani CreditAttribution: neelam_wadhwani at Valuebound for Valuebound commentedHello @Berdir
Yes you were right.
I have updated patch.
KIndly review patch
Comment #36
neelam_wadhwani CreditAttribution: neelam_wadhwani at Valuebound for Valuebound commentedComment #37
BerdirSomething is still strange. The patch now only adds the new files and the interdiff is twice as big as the actual patch.
It might be easier to start again from the patch in #26 and re-apply the few first few changes from the interdiff again manually.
I can recommend my workflow, which works very well except when you need to add new files in an update/interdiff, but that's not the case here, so:
curl PATCH-URL | git apply -3
# make changes
git diff HEAD > full-patch
git diff > interdiff
Nothing else required, no branches or commits or anything.
Comment #38
andreyjan CreditAttribution: andreyjan at FFW commentedAdded changes per #28 review and interdiff based on #26 patch.
Comment #39
BerdirThanks.
Comment #40
lhridley CreditAttribution: lhridley as a volunteer and at Interpersonal Frequency commentedRerolled patch to add new items that were deprecated with 8.8 that were not on the previous patch. Please test.
Comment #41
lhridley CreditAttribution: lhridley as a volunteer and at Interpersonal Frequency commentedComment #43
BerdirPlease provide an interdiff when working on such a large patch.
I guess you changed a scan directory call. You'll need to include a is_dir() check as the new scan function won't do that by default anymore.
Comment #44
lhridley CreditAttribution: lhridley as a volunteer and at Interpersonal Frequency commentedComment #45
kim.pepperI tried diffing the patch at #40 with #38 but there seemed to be a lot of unrelated changes.
Running drupal-check on #38 yielded
I cleaned these up a bit. They were unnecessarily scanning all the files in the directory to delete individually when just deleting the directory should do that.
Comment #47
kim.pepperOoops. I meant to use deleteRecursive().
Comment #48
kim.pepperUpdating the title.
Comment #49
kim.pepperComment #50
shobhit_juyal CreditAttribution: shobhit_juyal commented#47 works for me
Comment #51
Chris Matthews CreditAttribution: Chris Matthews commentedJust curious, why does the project page currently state "Google Analytics 8.x-2.5+ supports Drupal 9", when this issue is still active?
And from the Upgrade Status module:
Comment #52
jcnventura CreditAttribution: jcnventura at 1xINTERNET commentedIndeed, not easy to review. But on the first lines, this module's composer.json states:
"drupal/core": "^8.7.7 || ^9"
While the .info.yml states:
core_version_requirement: ^8.8 || ^9
The best way to avoid this information being out of sync is to trust the d.o packager to correctly fill this info in composer.json from the information on the .info.yml file. As such, please remove the drupal/core requirement from the composer.json file completely.
Comment #53
jcnventura CreditAttribution: jcnventura at 1xINTERNET commentedFixing the composer.json <-> google_analytics.info.yml inconsistency by removing the drupal/core requirement from composer.json as stated by the core_version_requirement CR:
Also removing the core_version_requirement from the test module as according to the same CR:
Comment #54
jcnventura CreditAttribution: jcnventura at 1xINTERNET commented@Chris Matthews I think the answer to your question is the fact that currently there is NO google_analytics 8.x-2.5 yet.
Comment #55
komalk CreditAttribution: komalk at Srijan | A Material+ Company for Drupal India Association commentedComment #56
e.bogatyrevHi there,
Tested patch #53 on Drupal 8.8. Looks good
drupal-check google_analytics/
18/18 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
[OK] No errors
Comment #58
japerryThanks everyone for your work on this. the 2.x branch is now D9 compatible!
Comment #59
naveenvalecha@japerry
Can you cherry-pick this to 3.x?
Comment #60
BerdirThere's apparently a separate issue for 8.x-3.x, I'm not quite sure why :)
Comment #61
naveenvalechaThanks! @berdir
Comment #63
DamienMcKenna