"Check tweetbacks" URLs problem in event_twitter

Found a bug? Tell us!!
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

"Check tweetbacks" URLs problem in event_twitter

Post by LazyBadger »

Move topic in "Plugins" section, if I misplaced message

Try event_twitter now, found strange URLS in "Check tweetbacks" page
1. Announced entry URL - http://mayorat.e-city.net.ru/blog/archi ... itter.html
2. URLs on Tweetbacks Statistic page are
- RT:0 ID:5.4510599119454E+16, i.e http://twitter.com/ecity_mayorat/status ... 119454E+16 (404 error)
- comment url in blog http://twitter.com/ecity_mayorat/status ... 119454E+16 (404 error too)
3. Twitter real URL of announce is http://twitter.com/ecity_mayorat/status ... 9119454209

Not a big problem for me, maybe smth. personal, but I have to note it
Quis custodiet ipsos custodes?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: "Check tweetbacks" URLs problem in event_twitter

Post by garvinhicking »

Hi!

Which version of the twitter plugin do you have? This should've been a bug in earlier versions.

Please check your serendipity_tweetbackhistory's field "lasttweetid". It should be varchar(20). Also serendipity_tweets should have a id column as bigint...?!

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: "Check tweetbacks" URLs problem in event_twitter

Post by LazyBadger »

garvinhicking wrote: Which version of the twitter plugin do you have?
Fresh, installed today from Spartacus - 1.32,as shown in admin-side
garvinhicking wrote:Please check your serendipity_tweetbackhistory's field "lasttweetid". It should be varchar(20). Also serendipity_tweets should have a id column as bigint...?!
TABLE `serendipity_tweetbackhistory` (
`entryid` int(10) NOT NULL,
`lasttweetid` varchar(20) NOT NULL,
`lastcheck` int(10) NOT NULL,
/* Keys */
PRIMARY KEY (`entryid`)
) ENGINE = InnoDB;

No table tweets, only tweetbackhistory + tweetbackshorturls
Quis custodiet ipsos custodes?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: "Check tweetbacks" URLs problem in event_twitter

Post by garvinhicking »

Hi!

If you browse those tables, do the tweet-ids seem truncated somehow, or are they proper without this "E0x" addition? The error seems to be caused because a number is longer than the avaiblale storage space, so it's converted to a shorter number. Maybe already varchar(20) is too little and we need to raise it again?!

(Remember though that changing to varchar(50) for example will not fix existing entries, only new ones put there...)

I'd be happy if we can find out what's happening...
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: "Check tweetbacks" URLs problem in event_twitter

Post by LazyBadger »

Export from serendipity_tweetbackhistory seems OK

Code: Select all

   entryid lasttweetid                                                   lastcheck 
         8 0                                                            1301 830 075 
         9 0                                                            1301 842 209


tweetbackshorturls doesn't have tweetids at all

Maybe missing serendipity_tweets IS source of problem? I can create this table by hand, I saw CREATE TABLE definition in *_plugin code
Quis custodiet ipsos custodes?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: "Check tweetbacks" URLs problem in event_twitter

Post by garvinhicking »

Hi!

Hm, serendipity_tweets actually is created when you have the "backup tweets" option enabled.

It seems then some other PHP or javascript code is improperly treating the Twitter-IDs. Do you use Javascript or PHP for the twitter output (see your plugin configuration)? Then I'll try to inspect that properly.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: "Check tweetbacks" URLs problem in event_twitter

Post by LazyBadger »

OK, I haven't backup enabled.
I tried both versions, with the same result (JS was used on creating fist announce). Can select any on your choice and test.
Quis custodiet ipsos custodes?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: "Check tweetbacks" URLs problem in event_twitter

Post by garvinhicking »

Hi!

Hm, where exactly do you see the faulty entries? In the language file I can see no "Check Tweebtacks" that could be used as a title anywhere, so I don't know yet where exactl you reference to.

I was thinking you meant the sidebar plugins, but reading through your original post I believe this might not be the place you're talking about.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: "Check tweetbacks" URLs problem in event_twitter

Post by LazyBadger »

Hm, where exactly do you see the faulty entries?
On separate entry page (not in entry-list) above "Tweet this button" only when I logged-in into backend I see link with text "check tweetbacks"...
In the language file I can see no "Check Tweebtacks" that could be used as a title anywhere
This string hardcoded in PHP-code, serendipity_event_twitter.php - string 1591

Code: Select all

$tweetback_check_msg = '<div class="serendipity_tweetback_check"><a target="_blank" href="' . $checkurl . '">check tweetbacks</a></div>';
Quis custodiet ipsos custodes?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: "Check tweetbacks" URLs problem in event_twitter

Post by garvinhicking »

Hi!

Ah, great! I wasn't properly aware of that URL output. I just patched the plugin so that the ID should now get properly converted. Many thanks for your help in this!

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: "Check tweetbacks" URLs problem in event_twitter

Post by LazyBadger »

I see changes in the right direction, but sorry, Garvin, one more additional fix is needed
For some article (is this URL needed really?) "Check tweetbacks" page produces now (as example)
54877101727301632, but
54877101727301633 is correct URL

In "more words" form: all twitter URLs ID must be +1 to current value (v1.33)
Quis custodiet ipsos custodes?
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: "Check tweetbacks" URLs problem in event_twitter

Post by garvinhicking »

Hi!

Hhhm...I believe that the sprintf('%0.0f') syntax for converting the proper number to a string is doing some rounding. If we add +1 this means some other entries would mismatch.

I don't know how to convert the number properly to a string...

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: "Check tweetbacks" URLs problem in event_twitter

Post by Timbalu »

How about specifying the length?
Just guessing width specifier like sprintf('%17.0f') ?
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
LazyBadger
Regular
Posts: 176
Joined: Mon Aug 25, 2008 12:25 pm
Location: Russia
Contact:

Re: "Check tweetbacks" URLs problem in event_twitter

Post by LazyBadger »

If

Code: Select all

$ids = '5451059911945420';
echo sprintf("%0.0f\n", $id);
echo sprintf("%17.0f", $id);
then results are the same
Quis custodiet ipsos custodes?
Timbalu
Regular
Posts: 4598
Joined: Sun May 02, 2004 3:04 pm

Re: "Check tweetbacks" URLs problem in event_twitter

Post by Timbalu »

and why not use simple %s as string representation?
echo sprintf("%s", $id);
or
sprintf('%s', (string)$item->tweet_id);
Regards,
Ian

Serendipity Styx Edition and additional_plugins @ https://ophian.github.io/ @ https://github.com/ophian
Post Reply