user warning: Table './stockvalues/cms_cache_form' is marked as crashed and should be repaired query: UPDATE cms_cache_form SET data = 'a:21:{s:6:\"choice\";a:3:{s:5:\"#type\";s:6:\"radios\";s:14:\"#default_value\";i:-1;s:8:\"#options\";a:4:{i:0;s:7:\"Bullish\";i:1;s:7:\"Bearish\";i:2;s:7:\"Neutral\";i:3;s:26:\"I don't play the game\";}}s:4:\"vote\";a:3:{s:5:\"#type\";s:6:\"submit\";s:6:\"#value\";s:4:\"Vote\";s:7:\"#submit\";a:1:{i:0;s:9:\"poll_vote\";}}s:5:\"#node\";O:8:\"stdClass\":39:{s:3:\"nid\";s:4:\"1886\";s:4:\"type\";s:4:\"poll\";s:8:\"language\";s:0:\"\";s:3:\"uid\";s:1:\"7\";s:6:\"status\";s:1:\"1\";s:7:\"created\";s:10:\"1251845680\";s:7:\"changed\";s:10:\"1251845925\";s:7:\"comment\";s:1:\"2\";s:7:\"promote\";s:1:\"1\";s:8:\"moderate\";s:1:\"0\";s:6:\"sticky\";s:1:\"0\";s:4:\"tnid\";s:1:\"0\";s:9:\"translate\";s:1:\"0\";s:3:\"vid\";s:4:\"4961\";s:12:\"revision_uid\";s:1:\"7\";s:5:\"title\";s:73:\"Are you currently bullish or bearish on the economy and the stock market?\";s:4:\"body\";s:0:\"\";s:6:\"teaser\";s:58:\"* Bullish\\n* Bearish\\n* Neutral\\n* I don\'t play the game\\n\";s:3:\"log\";s:0:\"\";s:18:\"revision_timestamp\";s:10:\"1251845925\";s:6:\"format\";s:1:\"0\";s:4:\"name\";s:11:\"Jake Berzon\";s:7:\"picture\";s:46:\"/home/stockvalues/stuff/pictures/picture-7.jpg\";s:4:\"data\";s:550:\"a:15:{s:7:\"contact\";i:1;s:3:\"DOB\";a:3:{s:4:\"year\";s:4:\"1965\";s:5:\"month\";s:1:\"9\";s:3:\"day\";s:2:\"25\";}s:6:\"sn_248\";i:1;s:8:\"sn_email\";s:16:\"jake@baraban.com\";s:9:\"sn_update\";s:6:\"Update\";s:14:\"picture_delete\";i:0;s:14:\"picture_upload\";s:0:\"\";s:13:\"form_build_id\";s:48:\"form-AwrEyk90gRPyqsDBwC2PS322yr_mvINhTCrUFPrO-5w\";s:5:\"fbuid\";s:9:\"581973933\";s:10:\"fb_visible\";i:1;s:9:\"fb_avatar\";i:0;s:13:\"fbstream_user\";s:1:\"5\";s:34:\"user_relationship_mailer_send_mail\";i:1;s:34:\"user_relationships_ui_auto_approve\";a:1:{i:1;i:0;}s:18:\"admin_compact_mode\";b:0;}\";s:7:\"runtime\";s:1:\"0\";s:6:\"active\";s:1:\"1\";s:6:\"choice\";a:4:{i:0;a:3:{s:6:\"chtext\";s:7:\"Bullish\";s:7:\"chvotes\";s:2:\"54\";s:7:\"chorder\";s:1:\"0\";}i:1;a:3:{s:6:\"chtext\";s:7:\"Bearish\";s:7:\"chvotes\";s:2:\"52\";s:7:\"chorder\";s:1:\"1\";}i:2;a:3:{s:6:\"chtext\";s:7:\"Neutral\";s:7:\"chvotes\";s:2:\"31\";s:7:\"chorder\";s:1:\"2\";}i:3;a:3:{s:6:\"chtext\";s:21:\"I don\'t play the game\";s:7:\"chvotes\";s:2:\"39\";s:7:\"chorder\";s:1:\"3\";}}s:10:\"allowvotes\";b:1;s:4:\"vote\";i:-1;s:4:\"path\";s:14:\"bull-bear-poll\";s:29:\"user_relationship_node_access\";b:0;s:22:\"last_comment_timestamp\";s:10:\"1349639940\";s:17:\"last_comment_name\";s:0:\"\";s:13:\"comment_count\";s:1:\"1\";s:8:\"taxonomy\";a:0:{}s:4:\"iids\";a:0:{}s:9:\"nodewords\";a:2:{s:11:\"description\";a:1:{s:5:\"value\";s:160:\"As autumn approaches the mood on Wall Street often shifts. This poll asks the bull vs. bear question in order to see if Main Street is in tune with Wall Street.\";}s:8:\"keywords\";a:1:{s:5:\"value\";s:40:\"Wall Stree, Main Stree, bull, bear, poll\";}}s:8:\"readmore\";b:0;s:5:\"links\";a:3:{s:16:\"comment_comments\";a:4:{s:5:\"title\";s:9:\"1 comment\";s:4:\"href\";s:9:\"node/1886\";s:10:\"attributes\";a:1:{s:5:\"title\";s:42:\"Jump to the first comment of this posting.\";}s:8:\"fragment\";s:8:\"comments\";}i:0;a:3:{s:5:\"title\";s:11:\"Older polls\";s:4:\"href\";s:4:\"poll\";s:10:\"attributes\";a:1:{s:5:\"title\";s:36:\"View the list of polls on this site.\";}}i:1;a:3:{s:5:\"title\";s:7:\"Results\";s:4:\"href\";s:17:\"node/1886/results\";s:10:\"attributes\";a:1:{s:5:\"title\";s:30:\"View the current poll results.\";}}}}s:6:\"#block\";b:1;s:6:\"#cache\";b:1;s:6:\"#theme\";s:9:\"poll_vote\";s:11:\"#parameters\";a:4:{i:0;s:16:\"poll_view_voting\";i:1;a:3:{s:7:\"storage\";N;s:9:\"submitted\";b:0;s:4:\"post\";a:0:{}}i:2;r:15;i:3;b:1;}s:9:\"#build_id\";s:48:\"form-BX9IaqTqalzl728IxdQsvsC7Kg9O9K9LC3LFksLQX4M\";s:5:\"#type\";s:4:\"form\";s:11:\"#programmed\";b:0;s:13:\"form_build_id\";a:4:{s:5:\"#type\";s:6:\"hidden\";s:6:\"#value\";s:48:\"form-BX9IaqTqalzl728IxdQsvsC7Kg9O9K9LC3LFksLQX4M\";s:3:\"#id\";s:48:\"form-BX9IaqTqalzl728IxdQsvsC7Kg9O9K9LC3LFksLQX4M\";s:5:\"#name\";s:13:\"form_build_id\";}s:7:\"form_id\";a:3:{s:5:\"#type\";s:6:\"hidden\";s:6:\"#value\";s:16:\"poll_view_voting\";s:3:\"#id\";s:21:\"edit-poll-view-voting\";}s:3:\"#id\";s:16:\"poll-view-voting\";s:12:\"#description\";N;s:11:\"#attributes\";a:0:{}s:9:\"#required\";b:0;s:5:\"#tree\";b:0;s:8:\"#parents\";a:0:{}s:7:\"#method\";s:4:\"post\";s:7:\"#action\";s:54:\"/beyond-missing-tweets-drupal-6-twitter-api-1.1-module\";s:9:\"#validate\";a:1:{i:0;s:25:\"poll_view_voting_validate\";}}', created = 1498417970, expire = 1498439570, headers = '', serialized = 1 WHERE cid = 'form_form-BX9IaqTqalzl728IxdQsvsC7Kg9O9K9LC3LFksLQX4M' in /home/stockvalues/public_html/includes/cache.inc on line 112.

My long-time followers are well aware that I have neglected this StockValues.Org blog, which BTW runs on Drupal 6, for much of 2013, even reducing the site to maintenance mode, making it completely inaccessible to the mere mortals, for many months.

In the meantime, I continued to use Twitter for quick updates and to share my thoughts. If Twitter wouldn't have made changes to their API, upgrading it to API 1.1 during this time period, all my tweets would have been recorded to this blog's database automatically by a dutiful cron, which never missed a beat. Well, Twitter changes happened and so my updates didn't.

You would think that to get my old tweets imported, all I would have to do would be to update the Drupal Twitter Module to the new version running Twitter API 1.1. However, by default, the new Twitter API will only pull the latest 20 tweets from a user's timeline and for some good reasons the Drupal 6 Twitter Module (latest stable version is currently 6.x-5.1), does nothing to alter this default behavior.

Of course, I didn't know any of this and so after I updated the Drupal Twitter Module and the cron job ran, I was left with a gaping whole in my Stock Values tweets database. Here is what I did and you can do as well, if you find yourself in a similar predicament, to fix things up:

1. Make backup copies of your twitter_account and twitter database tables, just in case.
2. For each user identified in the twitter database table by a unique screen_name, find twitter_id of the last tweet record that was pulled in prior to the breakdown.
3. For each such affected user, delete from your twitter database table all records of the tweets that have been imported after the gap.
4. For each such affected user, look up in the em>twitter_account database table the twitter_uid corresponding to the screen_name.
5. For each such affected user, in your twitter_account database table, set last_refresh equal to 0.
6. In the twitter.lib.php file found in your site's modules/twitter directory, following the line: $params['user_id'] = $id; add the following three lines of code, where twitter_uid_n's are all the twitter_uid's from step 4 and twitter_id_n's are their corresponding last tweet record twitter_id's defined in step 2:

$since_id = array(twitter_uid_1 => twitter_id_1,twitter_uid_2 => twitter_id_2,twitter_uid_3 => twitter_id_3, ...);
$params['count'] = 200;
$params['since_id'] = $since_id[$id];

7. Log in to your site as an administrator and visit its admin/reports/status/run-cron url, which will run the cron job and update the tweets database records.

The new Twitter API 1.1 will not return more than 200 records per call no matter what you do, so if any of your users produced more than 200 tweets from the time you initially stopped receiving updates, you will need to repeat the above process until you get them all. And once you are done and have verified that all is good, don't forget to restore your twitter.lib.php file to its original pristine state and delete extra backup copies of your database tables.

In my case, I only had to deal with my one global Twitter account and less than 200 new tweets to import, so there was only minimal manual labor involved and the process went very quickly. Of course, if you have more than a handful of users and loads of tweets for each one of them to import, you will want to automate the process further!

twitter.jpg

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <p> <br> <tr> <td> <table>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Image CAPTCHA
Enter the characters shown in the image.

User login

Poll

Are you currently bullish or bearish on the economy and the stock market?:

Email Center

Username:

@StockValues.Org

Password:


New Users
Lost Password
I Need Help





Who's online

There are currently 0 users and 4 guests online.