In case if you are coming to my blog to find out why Grab Yahoo demo is not available anymore – here is why. Few weeks ago I found that my hosting service has been terminated by Bluehost – reason given was that one of my domains is acting as a phishing site.
When I called up Bluehost they referred me to my Grab Yahoo demo page – which is broken for a while now. Apparently Yahoo! complained to bluehost that the demo page for Grab Yahoo is a phishing site. Well, FYI Yahoo!, this PHP script that I wrote a long long time ago uses PHP’s cURL library to authenticate users and then allow them to put their contacts in an array. Since you (Yahoo!) have been constantly changing your login forms, added captcha etc the class (Grab Yahoo) had to be modified to keep working – which I stopped doing for a while. Due to the fact that it stopped working – when authentication failed it took users to Yahoo! login page – as I had follow redirection turned on for debugging at one stage. Anyhow, if you want to validate you can always download the PHP file from phpclasses.org – just look for Grab Yahoo.
OK … since my last post on the WP’s missed schedule issue I’ve gone many directions and thought I found the root cause of the issue. Although I’ve not yet found the exact problem but I do have a solid candidate for the problem.
Like I mentioned in the Part 1 of this series WP picks the second portion for the scheduled time on its own and initially I thought that is the issue. So, according to my finding what WP does is the take the second bit from the time the request was made to save the article and uses that. So I thought if two posts are scheduled for the same hour, may be the time SCHEDULE button was clicked was same causing the conflict of timestamp overlapping while creating the cron array (which is returned by _get_cron_array function).
But that does not tell me why a post that is scheduled for a different hour and the only one to be published at that time is missed once in a while. So, that could NOT be the real reason (but a possibility). So I started looking more into the publishing functionality. After going through a lot of code I wanted to run a quick test. My test relies on the fact that the environment that the WP is running on has multiple authors (sometimes sharing the same user accounts) and probably publishing articles are the same time.
So as part of the test what I did was I’ve two sessions (as author/admin) running on two windows and set two articles to be scheduled (at the same time or different times). Then I click on SCHEDULE button on two windows at the same time. After repeating the same test several times I found that one of the posts I was scheduling is not updated in the wp_options table for the option_name “cron”. Therefore, when the wp-cron runs it only publishes the one that was added and the other one shows up as missed schedule. If the post, that did not get into the cron list, is updated later (i.e. just click on SCHEDULE button again even without modifying anything in the post) it will be added in the list.
So, now I am trying to find any other way this could happen. For the time being I am thinking of an alternate way to make sure the cron list is always up to date.
Recently, while working extensively with WordPress, I’ve come across the problem with WordPress’ Missed Schedule issue. Every now and then post(s) scheduled in a future date does not get published and shows up as “Missed “Schedule” on admin side. Searching on net is not giving me much of a direction than people suggesting to run wp-cron manually etc. So I decided to to dig into the issue and trace the root of the problem. So here is Part 1 of my finding. I am still digging to find real issue and the way to fix it.
So far I’ve manually ran part of wp-cron to find details. “wp-cron.php” makes a query into the wp_options (wp can be different as per the prefix you’ve used during WordPress installation) table in WordPress database to find the current/future processes to run. So what comes back from the query is an array like:
 => Array (
[publish_future_post] => Array (
[asdasd0880as0dasdasd08] => Array (
[args] => Array (
 => 19999
Here the key of the array is the unix timestamp when the post should be published. Everything seems fine until I looked at the list of scheduled posts and for one given day I had 4 articles scheduled. But my array from _get_cron_array function only lists 1 post. 3 out of 4 articles were scheduled at the same time (for example, 2PM) so that lead me to think probably all three posts scheduled at 2PM have the same timestamp, therefore, the key is being overlapped. But it seems WP (is smart enough to) set the time at different seconds of the hour it is scheduled for. And that also explains why the 4th article (which was scheduled at a different time) was not showing up in the list.
For example, if I schedule 2 posts at 4PM WP will schedule one at 4:00:22 and one at 4:00:40. I am not sure about the pattern WP uses for the second but one thing I know when I’m scheduling a future post it only lets me specify hour and the minute. It makes sense because if we have the same timestamp it will only take one item for the timestamp in the array.
Now, like I explained the array is still missing the articles in the cron array although they have different timestamp. So I tried looking more. I let the time span to the next scheduled post and have proven that the article(s) that I do not see in the array (although they are scheduled) got missed. To quickly see what is in the array you can have a test.php in the root of WP installation and try the following code:
$crons = _get_cron_array();
This will print the list of scheduled posts (if any). So before I dig into the code even further I decided to check the list for the next set of scheduled posts. I found another few those did not show up in the array. So I decided to edit one of the articles that is missing in the cron array. I clicked on EDIT and just pressed the UPDATE button (without modifying anything). Now when I went back to my array (refreshing test.php) I found the article listed in the array!! Now, I’ve let the cron run for the second round and the articles those were not in the array got missed and the one I manually updated got published.
So, now my next step is to dig into the scheduling functionality of WordPress to understand how does this work and what causes some of the articles getting missed from the scheduled list. I will post my finding soon after I have more on this topic.
I had my wp-cache disabled for a long time but when I reactivated it today I saw a PHP warning showing up:
Warning: sem_get() [function.sem-get]: failed for key 0x152b: Permission denied in ....../wp-content/plugins/wp-cache/wp-cache-phase2.php on line 98
To fix this problem, there are two ways. One is to assign a different SEM ID and second is to enable “$use_flock” variable. Both options/settings are in wp-content/wp-cache-config.php file.
To enable the variable, $use_flock, uncomment the line:
$use_flock = true;
To change the SEM ID, change the value of $sem_id variable to something different. Something like:
$sem_id = 9919222;
From the in-line comment from the author of the plug-in it seems there might be a conflict of the key used by sem_get function.
Grab Yahoo class was one of my works that has been used by many people around the world. Since I released this class I did not have a single month without comments or questions or suggestion about this class. Some people have copied the class, released it under their name (simply taking out my comments and added their own) to increase traffic to their site probably. But more importantly this class was appreciated by many. This was one of my finest contribution to the open source world.
How did I come up with this idea?
Well, I cannot remember which user group but in one of the groups I participate in had a discussion over if PHP can pull data off from places like Yahoo and use it for some purpose. Users on the group said this can be done (easily) with Java, but cannot be done with PHP. So I started researching over it. I found the cURL extension for PHP which seemed the good candidate to do the job. So I started working on it. After days of coding I finally wrote a script that will allow someone to login to their Yahoo account and fetch data from their address book. Initially I simply had a script but then I converted it to a Class allowing people to grab their address book, messenger list, number of new emails and calendar data.
What is happening now?
As per the title of this post this class is in “coma”. The reason is the update to Yahoo address book export mechanism. They have placed a CAPTCHA validation page in the export feature and, therefore, my Grab Yahoo class cannot go any further to grab the content it needs. Same thing happened with the LinkMeIn class which stopped working after LinkedIn added the CAPTCHA validation.
Why is this class in “coma”?
I have looked at the Yahoo address book export feature and found the CAPTCHA validation which will not allow the class to work. But I’ve not done my complete research on it yet, to make sure there is no other way to make this class functional. So, for the time being, this class is in “coma”. If I fail to revive this class I will probably officially pronounce it “dead”.
Can you help?
Yes, of course, you can. I hardly have time, these days, to sit with these side projects. If anyone from the community has time to research and help me revive this class it will be appreciated. Your name will go into the credit section of the class, well that is all I can offer!