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.
The installation hook implementation should automatically import Page Title settings as that functionality is now included. Will be added after #1281138: Upgrade path: Nodewords is done.
Comment | File | Size | Author |
---|---|---|---|
#49 | metatag-n1658970-49.patch | 7.31 KB | DamienMcKenna |
Comments
Comment #1
DamienMcKennaThis adds a hook_update_N() script to migrate the data, which is also executed during the new hook_install(). If there's a lot of data this could take a while. It also is set to append " | [site:name]" to the value, which should provide the expected result.
Note: this does not do anything for any per-entity or per-bundle settings, right now it just converts the {page_title} database records.
Comment #2
DamienMcKennaComment #3
DamienMcKennaComment #4
DamienMcKennaNeeds further work.
Comment #5
HyperGlide CreditAttribution: HyperGlide commentedExciting to see a migration path for other modules to help bring them all together under "meta tag"
Related to #1282806: Upgrade path: Meta tags quick
Thank you!
DamienMcKenna++
Comment #6
iamEAP CreditAttribution: iamEAP commentedRelated to the issue referenced by HyperGlide in #5, I wonder if it'd be more appropriate to make a separate upgrade/import module (perhaps with drush support) rather than have everything in a series of upgrade hooks.
As it is, installing or updating the module will perform the data migration without asking. Seems like it should be an explicit action.
Comment #7
jenlamptonI'm getting a message after updating metatag to 7.x-1.0-beta4 that I should disable the page title module, but I don't want to loose it's data. Is the best path forward to apply this patch, run the update, and then disable & uninstall page_title?
Comment #8
jenlamptonUpdating to beta4 + patch hosed my metatag data & page_title data, now all nodes say they are using defaults when there is clearly data in the database for metatags, but the key on language seems to be confusing matters.
Going to try beta3 instead.
Comment #9
jenlamptonThings don't look much better after updating to beta3, there's still a key in the 'data' record for language, and all my nodes still think they are using defaults.
Going to try beta2 instead.
Comment #10
jenlamptonOkay, that worked great! I think the problems in beta3 and beta4 are unrelated to this patch.
An Update to Beta2 + attached patch migrated in all the data from page_title. It's rerolled here with a new update number (7003) and removal of a duplicate dsm, but will need another re-roll after the language / translation issues are sorted.
Comment #12
DamienMcKennaMarked #1918736: Page Title data migrate to Meta Tag as a duplicate.
Comment #13
DamienMcKenna@jenlampton: The beta3 and beta4 problems are because of #1845326: Metatags not loading correctly with beta4, which has just been committed, so the -dev version should work much more reliably.
Comment #14
HyperGlide CreditAttribution: HyperGlide commented#10: metatag-upgrade_path_from_page_title-1658970-10.patch queued for re-testing.
Comment #16
HyperGlide CreditAttribution: HyperGlide commentedWas not able to apply #10 against beta7 or dev.
It is trying to patch
/sites/all/modules/contrib/metatag/metatag.install
however in our D 7.22 our modules are within/sites/all/modules/metatag/metatag.install
.Is this a bug?
Comment #17
HyperGlide CreditAttribution: HyperGlide commentedAttempt to update the patch to the latest dev.
Comment #18
HyperGlide CreditAttribution: HyperGlide commentedApplied patch cleanly to dev on test site.
running update.php following errors stopped the update.
Comment #19
DamienMcKennaI've decided that all import/migration scripts will be done as drush commands, so this definitely needs work.
Comment #20
HyperGlide CreditAttribution: HyperGlide commentedTalking to Cottser in IRC he express that
http://drupalcode.org/project/metatag.git/blob/refs/heads/7.x-1.x:/metat...
Comment #21
subhojit777Patch in #17 applied successfully and executed
drush updb
but it is giving loads of:Also it is destroying the existing metatags after update.
Comment #22
HyperGlide CreditAttribution: HyperGlide commented@subhojit777 -- did you read the comments after #17?
Comment #23
subhojit777@HyperGlide but I am not using the dev version. I am using 7.x-1.0-beta7 version of metatag.
I am using this module for migrating nodewords to metatag, after that I am doing drush updb and I see that existing metatag settings for nodes like description and keywords are no longer maintained.
I will try doing drush updb first then upgrade from nodewords to metatag.
Comment #24
subhojit777The patch given #17 does not migrates pagetitle to metatags following the metatag config settings. For example, if a content type has certain metatag title setting then title should appear as per the setting, I think this should be the expected behavior. Here is a new patch that does this job.
Comment #25
subhojit777The patch given above does not trims whitespaces. Forgot to do that :)
Here is the correct patch.
Comment #26
HyperGlide CreditAttribution: HyperGlide commentedI believe #25 needs to have the code updated as a result of other recent comments. Any interest to help get this accomplished and I can help support the testing.
Comment #27
barryvdh CreditAttribution: barryvdh commentedI tried the patch with the latest release and with the current dev, but I get the following error:
Fatal error: Class name must be a valid object or a string in in /var/www/html/aosmith/public/includes/common.inc, line 7837
Any ideas?
Comment #28
HyperGlide CreditAttribution: HyperGlide commentedComment #29
stefan.r CreditAttribution: stefan.r commentedAnyone still have this same error?
Comment #30
stefan.r CreditAttribution: stefan.r commentedThat was merely a re-roll, here's that same patch with some rework and testing.
Comment #33
jeffdiecks CreditAttribution: jeffdiecks commentedComment #34
stefan.r CreditAttribution: stefan.r commentedre-roll
Comment #36
mrjmd CreditAttribution: mrjmd commentedRerolled against dev.
Comment #37
DamienMcKennaComment #38
DamienMcKennaThis removes the call to the update script in hook_install to avoid timeout errors during installation.
Comment #39
mrconnerton CreditAttribution: mrconnerton commentedThe patch in #38 didn't apply to my fresh dev checkout of the module but I manually applied the patch and seems to work fine. I ran the update, disabled page_title module, and then cleared the cache. After checking a few nodes everything looks good.
I would have prefered the update completely set the page title tag instead of just replacing [current-page:title]. For example my "default" was [current-page:title] | [site:name] so now all my manually set page titles have | MySiteName on the end.
Other than that, looks good!
Comment #40
mrconnerton CreditAttribution: mrconnerton commentedActually I have found I have to save the node for the new meta tag to take affect. I'm not sure if this is caching or what. I've done full cache clears and the old title was appearing until I did a quick edit/save on the node.
Comment #41
DamienMcKenna@mrconnerton: thanks for the review, sounds like this needs some further work.
Comment #42
mrconnerton CreditAttribution: mrconnerton commentedAlso I'm new to working with metatag code but I believe the first key in meta tag data is suppose to be the lang code: http://cgit.drupalcode.org/metatag/tree/metatag.module#n525
When I ran the update it didn't have that so the first key in the tables is "value" with "title" as the langcode.
Comment #43
DamienMcKennaComment #44
DamienMcKennaRerolled.
Comment #45
stefan.r CreditAttribution: stefan.r commentedpage_title can also be used as a views filter, I don't think metatag has such functionality, does it?
Comment #46
DamienMcKennaFixed a problem with the handling of metatag_metatags_load().
@stefan.r: I wasn't aware of that. Could you please open a new issue for that and describe how it works? Thanks!
Comment #47
Alex-CDE CreditAttribution: Alex-CDE commentedHi,
I tried the patch with the latest release #46, but I get the following error:
Fatal error: Class name must be a valid object or a string in /home/***/includes/common.inc on line 7963
Comment #48
DamienMcKenna@Alex-CDE: Can you please install the Devel module and in its settings page set the error handler to one of the Krumo ones, then see if you can work out what class name it's failing on? Thanks.
Comment #49
DamienMcKennaThis converts the update script above to a Drush script.
Comment #50
DamienMcKennaCommitted! Thanks all!
Comment #52
DamienMcKennaFYI this has been released in the new v7.x-1.7 and I've spun off a new issue to handle the additional Page Title settings: #2539444: Finish converting all Page Title settings
Comment #54
Benia CreditAttribution: Benia commentedI tried to run the patch with git after situating the patch file in the Metatag module folder but the patch failed saying some files where not present (when they were indeed present).