Hi Guys,

Please forgive me if I am asking in the wrong section but I was wondering if DamienMcKenna or Dave Reid :) could shed a little light on my issue. Love the module by the way guys, so what comes next is isn't me being picky but a request by a user wanting something in place to update large numbers of meta details from .csv -- So be nice to me :)

This isn't so much a feature request (If you could do it I'd buy you loads to drinks) but me hoping you could help me with an uploading issue. I am exporting the meta details to .csv with the cell looking like this (exported from Data as a BLOB within MySQL).

a:3:{s:5:"title";a:1:{s:5:"value";s:15:"Page title";}s:11:"description";a:1:{s:5:"value";s:13:"Page description";}s:8:"keywords";a:1:{s:5:"value";s:13:"Page keywords";}}

I have a script in place to export what nodes I need to extract their meta details but I am having an issue when I try to import (import script) an update of the above details. I can update it no problem and shows in the database but when I go to Drupal, flush cache and check the source the update pages meta details has vanished, sadly. I was really hoping you could advise here on what I could be missing out on updating this record='Data' Type=BLOB.

Any help here guys I'd be most grateful.

Best Regards,

Joe

Comments

DamienMcKenna’s picture

Status: Active » Postponed (maintainer needs more info)

Check what's stored in the 'data' column in the {metatag} table after updating, it should look like this:

a:3:{s:11:"description";a:1:{s:5:"value";s:27:"It's a monkey's description";}s:8:"keywords";a:1:{s:5:"value";s:22:"Itsa, monkey, keywords";}s:5:"title";a:1:{s:5:"value";s:21:"It's a monkey's title";}}

When unserialized() the data value turns into this:

array(
  "description" => array(
    "value" => "It's a monkey's description",
  ),
  "keywords" => array(
    "value" => "Itsa, monkey, keywords",
  ),
  "title" => array(
    "value" => "It's a monkey's title",
  ),
)
jjsmyth1984’s picture

Hi Damien,

Thank you for such a prompt reply.

Say for example I take your Monkeys BLOB example from Data below, which say has already been created within an node at creation time and saved and now exported to a .csv file as below.
a:3:{s:11:"description";a:1:{s:5:"value";s:27:"It's a monkey's description";}s:8:"keywords";a:1:{s:5:"value";s:22:"Itsa, monkey, keywords";}s:5:"title";a:1:{s:5:"value";s:21:"It's a monkey's title";}}

unserialized()

array(
"description" => array(
"value" => "It's a monkey's description",
),
"keywords" => array(
"value" => "Itsa, monkey, keywords",
),
"title" => array(
"value" => "It's a monkey's title",
),
)

If I were to take the above grab from the db and in my .csv file edit the description from:"It's a monkey's description" to "It's a monkey's description and Joe is a monkey" and run my script to update the record, it will show nicely in the metatag.data blob, I know I am not breaking any of the containers but when I clear cache and check source the meta details are not there.

unserialized()

array(
"description" => array(
"value" => "It's a monkey's description and Joe is a monkey",
),
"keywords" => array(
"value" => "Itsa, monkey, keywords",
),
"title" => array(
"value" => "It's a monkey's title",
),
)

BUT

If I take your above example again and highlight the final character of description:"It's a monkey's description" and replace it with an uppercase n ie "It's a monkey's descriptioN" and I run the script to upload the changes from .csv, it works fine and shows on the source the new description with the upper case n but if I were to delete that n first then replace it with an uppercase n it causes it to break.

unserialized()

array(
"description" => array(
"value" => "It's a monkey's descriptioN",
),
"keywords" => array(
"value" => "Itsa, monkey, keywords",
),
"title" => array(
"value" => "It's a monkey's title",
),
)

So least I know that I can update the meta details from my script but when I try to add new characters it causes the problem. You know if there is something I am missing out on?

Best Regards,

Joe

DamienMcKenna’s picture

Be careful manually changing the data without first unserializing the array, the length of each string is defined in a value preceding the string, e.g. s:5:"value" translates to the string "value", but if you change the string to "values" you'd need to increase the number to 6. You should also increase the error reporting on your site to show everything (E_ALL), just in case some bugs are being hidden.

jjsmyth1984’s picture

I solute you, Damien. How did I that not see that, it was right there in front of me :)

Many thanks for that, gets me a step closer. I'll get testing with your feedback.

Have a good weekend.

Joe

jjsmyth1984’s picture

Tested and worked nicely. Thanks again Damien for your help :)

DamienMcKenna’s picture

Status: Postponed (maintainer needs more info) » Fixed

Great, glad it worked out.

DamienMcKenna’s picture

Status: Fixed » Closed (fixed)
DamienMcKenna’s picture

Issue summary: View changes

Typo fix up