Open benlk opened 8 years ago
This isn't happening in nprstory_bulk_action_update_action
, but that's where it was noticed.
This isn't happening with all stories saved as drafts, either. Here's a list of stories saved as drafts, but without imported metadata:
There's not really any pattern here; these were gotten with different queries on different days.
Of those stories, "Even In Rich Countries, Jobs Have Returned Only At A 'Painful' Pace" is the only one that was downloaded while verbose logging was enabled.
[Thu Jul 07 10:31:53 2016] [error] [client 192.168.33.1] NPRMLEntity::__set_state(array(
'id' => '484825296',
'link' =>
array (
'html' =>
NPRMLElement::__set_state(array(
'type' => 'html',
'value' => 'http://www.npr.org/sections/thetwo-way/2016/07/07/484825296/even-in-rich-countries-jobs-have-returned-only-at-a-painful-pace?ft=nprml&f=1124',
)),
'api' =>
NPRMLElement::__set_state(array(
'type' => 'api',
'value' => 'http://api.npr.org/query?id=484825296&apiKey=MDI0MzY4Njg2MDE0NjM1MDYxMjc1ZDM5Zg000',
)),
'short' =>
NPRMLElement::__set_state(array(
'type' => 'short',
'value' => 'http://n.pr/29m88FU',
)),
),
'title' =>
NPRMLElement::__set_state(array(
'value' => 'Even In Rich Countries, Jobs Have Returned Only At A \\'Painful\\' Pace',
)),
'partnerId' =>
NPRMLElement::__set_state(array(
'value' => '484825296',
)),
'subtitle' =>
NPRMLElement::__set_state(array(
'value' => '',
)),
'shortTitle' =>
NPRMLElement::__set_state(array(
'value' => '',
)),
'teaser' =>
NPRMLElement::__set_state(array(
'value' => 'Throughout the developed world, the economic recovery has been a disappointment for workers, according to a new report. It finds many rich countries still suffer with double-digit unemployment.',
)),
'miniTeaser' =>
NPRMLElement::__set_state(array(
'value' => '',
)),
'slug' =>
NPRMLElement::__set_state(array(
'value' => 'The Two-Way',
)),
'thumbnail' =>
NPRMLElement::__set_state(array(
'medium' =>
NPRMLElement::__set_state(array(
'value' => 'https://media.npr.org/assets/img/2016/07/06/gettyimages-524861398_sq-c566e843680c43ee39ec14b00adacf4c2a515d92.jpg?s=13',
)),
'large' =>
NPRMLElement::__set_state(array(
'value' => 'https://media.npr.org/assets/img/2016/07/06/gettyimages-524861398_sq-c566e843680c43ee39ec14b00adacf4c2a515d92.jpg?s=11',
)),
'provider' =>
NPRMLElement::__set_state(array(
'value' => 'AFP/Getty Images',
)),
)),
'storyDate' =>
NPRMLElement::__set_state(array(
'value' => 'Thu, 07 Jul 2016 07:00:00 -0400',
)),
'pubDate' =>
NPRMLElement::__set_state(array(
'value' => 'Thu, 07 Jul 2016 11:29:00 -0400',
)),
'lastModifiedDate' =>
NPRMLElement::__set_state(array(
'value' => 'Thu, 07 Jul 2016 11:29:55 -0400',
)),
'audioRunByDate' =>
NPRMLElement::__set_state(array(
'value' => '',
)),
'keywords' =>
NPRMLElement::__set_state(array(
'value' => '',
)),
'priorityKeywords' =>
NPRMLElement::__set_state(array(
'value' => '',
)),
'organization' =>
NPRMLElement::__set_state(array(
'orgId' => '1',
'orgAbbr' => 'NPR',
'name' =>
NPRMLElement::__set_state(array(
'value' => 'NPR',
)),
'website' =>
NPRMLElement::__set_state(array(
'value' => 'http://www.npr.org/',
)),
)),
'parent' =>
array (
0 =>
NPRMLElement::__set_state(array(
'id' => '1006',
'type' => 'primaryTopic',
'title' =>
NPRMLElement::__set_state(array(
'value' => 'Business',
)),
'link' =>
array (
0 =>
NPRMLElement::__set_state(array(
'type' => 'html',
'value' => 'http://www.npr.org/sections/business/?ft=nprml&f=1124',
)),
1 =>
NPRMLElement::__set_state(array(
'type' => 'api',
'value' => 'http://api.npr.org/query?id=1006&meta=inherit&apiKey=MDI0MzY4Njg2MDE0NjM1MDYxMjc1ZDM5Zg000',
)),
),
)),
1 =>
NPRMLElement::__set_state(array(
'id' => '1001',
'type' => 'topic',
'title' =>
NPRMLElement::__set_state(array(
'value' => 'News',
)),
'link' =>
array (
0 =>
NPRMLElement::__set_state(array(
'type' => 'html',
'value' => 'http://www.npr.org/sections/news/?ft=nprml&f=1124',
)),
1 =>
NPRMLElement::__set_state(array(
'type' => 'api',
'value' => 'http://api.npr.org/query?id=1001&meta=inherit&apiKey=MDI0MzY4Njg2MDE0NjM1MDYxMjc1ZDM5Zg000',
)),
),
)),
2 =>
NPRMLElement::__set_state(array(
'id' => '1002',
'type' => 'topic',
'title' =>
NPRMLElement::__set_state(array(
'value' => 'Home Page Top Stories',
)),
'link' =>
array (
0 =>
NPRMLElement::__set_state(array(
'type' => 'html',
'value' => 'http://www.npr.org/?ft=nprml&f=1124',
)),
1 =>
NPRMLElement::__set_state(array(
'type' => 'api',
'value' => 'http://api.npr.org/query?id=1002&meta=inherit&apiKey=MDI0MzY4Njg2MDE0NjM1MDYxMjc1ZDM5Zg000',
)),
),
)),
3 =>
NPRMLElement::__set_state(array(
'id' => '191676894',
'type' => 'collection',
'title' =>
NPRMLElement::__set_state(array(
'value' => 'NPR.org\\'s Most Popular Stories',
)),
'link' =>
array (
0 =>
NPRMLElement::__set_state(array(
'type' => 'html',
'value' => 'http://www.npr.org/series/191676894/most-popular?ft=nprml&f=1124',
)),
1 =>
NPRMLElement::__set_state(array(
'type' => 'api',
'value' => 'http://api.npr.org/query?id=191676894&meta=inherit&apiKey=MDI0MzY4Njg2MDE0NjM1MDYxMjc1ZDM5Zg000',
)),
),
)),
4 =>
NPRMLElement::__set_state(array(
'id' => '127602855',
'type' => 'category',
'title' =>
NPRMLElement::__set_state(array(
'value' => 'America',
)),
'link' =>
array (
0 =>
NPRMLElement::__set_state(array(
'type' => 'html',
'value' => 'http://www.npr.org/sections/thetwo-way/127602855/america/?ft=nprml&f=1124',
)),
1 =>
NPRMLElement::__set_state(array(
'type' => 'api',
'value' => 'http://api.npr.org/query?id=127602855&meta=inherit&apiKey=MDI0MzY4Njg2MDE0NjM1MDYxMjc1ZDM5Zg000',
)),
),
)),
5 =>
NPRMLElement::__set_state(array(
'id' => '127602464',
'type' => 'category',
'title' =>
NPRMLElement::__set_state(array(
'value' => 'International',
)),
'link' =>
array (
0 =>
NPRMLElement::__set_state(array(
'type' => 'html',
'value' => 'http://www.npr.org/sections/thetwo-way/127602464/international/?ft=nprml&f=1124',
)),
1 =>
NPRMLElement::__set_state(array(
'type' => 'api',
'value' => 'http://api.npr.org/query?id=127602464&meta=inherit&apiKey=MDI0MzY4Njg2MDE0NjM1MDYxMjc1ZDM5Zg000',
)),
),
)),
6 =>
NPRMLElement::__set_state(array(
'id' => '127602331',
'type' => 'category',
'title' =>
NPRMLElement::__set_state(array(
'value' => 'Economy',
)),
'link' =>
array (
0 =>
NPRMLElement::__set_state(array(
'type' => 'html',
'value' => 'http://www.npr.org/sections/thetwo-way/127602331/economy/?ft=nprml&f=1124',
)),
1 =>
NPRMLElement::__set_state(array(
'type' => 'api',
'value' => 'http://api.npr.org/query?id=127602331&meta=inherit&apiKey=MDI0MzY4Njg2MDE0NjM1MDYxMjc1ZDM5Zg000',
)),
),
)),
7 =>
NPRMLElement::__set_state(array(
'id' => '103943429',
'type' => 'blog',
'slug' => 'true',
'title' =>
NPRMLElement::__set_state(array(
'value' => 'The Two-Way',
)),
'link' =>
array (
0 =>
NPRMLElement::__set_state(array(
'type'
That's where the line in the log cuts off.
If a post doesn't exist yet, then in the current version of the plugin, 3c71bc3b4be4bea01125154f811186cfed64163f, the following happens:
$post_id is created here and then the meta information from here is set on that post ID here.
I'm not sure if this is a problem in the current version of the plugin, or if it was fixed recently, so I'm going to set a bunch of queries, enable logging, and keep an eye on it all afternoon.
Stories fetched while testing #32 weren't experiencing this problem, so that might be a fix for this. @mike-douglas what do you think?
@benlk Definitely. I fixed some situations that would create undefined conditions and save data that was effectively corrupted. So it would not surprise me if #32 would fix this, though I have not debugged through this specific scenario.
This was noticed in function
nprstory_bulk_action_update_action
, whereerror_log( 'updating story for API ID='.$api_id );
was logging an empty ID for posts that were imported by a cron job from an NPR query as drafts. This doesn't affect posts imported as published.