added on Jul 15, 2009 by
Things were getting stuck around here so I searched for "flock" in the code. It's
not used that many times so anyone wanting to fix this should be able to find it. There
was no unlock call.
It's in in function log() at about line 552 the last part should read like this:
flock( $fp, LOCK_EX );
fwrite( $fp, $log );
flock( $fp, LOCK_UN );
fclose( $fp );
(only one line is added here)
And just a note, I commented out this line (at about line 2227)
// $this->log = array_reverse( array_shift( linkex::arraychunk( array_reverse( $this->log ), 10 ) ) );
I'm not sure how important this is but it seems to be working OK without it and
it reduces the number of errors that are reported to the error log, which was getting
huge. Do that at your own risk!
added on Jul 16, 2009 by
[quote=http://us.php.net/flock]
The lock is released also by fclose() (which is also called automatically when script finished).
[/quote]
added on Jul 16, 2009 by
Simon, you are right according to the docs, and it's still getting stuck but it
seems to do it less. I also get core files in my directory so it's dropping out
for some reason. I think it might be stuck in update() or save(), still trying
to track it down.
added on Jul 17, 2009 by
A little more info on where it gets stuck, so far I got it tracked down to a call
to save().
That is called but when it gets there it goes to generate() and then starts looping
over and over in the save() routine, meaning something in generate() is calling
save() over and over. The looping is slow, like once every 1/2 second.
This is a loop in a loop. I think the problem comes when you start messing with
links() within the generate() routine.
To be more clear, the first call to save() never exits save(), but only gets to the
part where generate() is called, then the calls to save() happen over and over (save
completes OK for the generate call).
The problem with this is it doesn't do it all the time, like if I delete a entry
it will just sit there sometimes.
added on Jul 18, 2009 by
Update, I found out what it was. Every time you save() it goes through the list
and does a pagerank for EVERY LINK! So I think google sees all the hits and starts
throttling you and slows down the pagerank response. Makes sense, I was doing a
lot of link cleanup and changes.
There is a cache for this, and it should only hit google once an hour (3600 something,
I assume seconds) so once it's done then you shouldn't see a slowdown. At least
that's how it's suppose to work. The version 6/03 has the cache feature, the
older versions don't.
I don't want to hit google that much, there should be a feature to turn it off
completely.
If you want to turn it off, at about line 2037, make it look like this:
function getPageRank( $usecache=false, $index, $url ) { // {{{
global $config;
$usecache = true; // this is the mod, turn it off
$array = linkex::get( $index, $this->googleinfo, array() );
It seems to be working for me, but always download a complete backup copy of
your linkex folder before you do any mods.