Howdy,
Trying to set a marker in a MySQL table on our Primary host (WAMP stack) indicating whether or not there is current User Activity -- ON THAT SERVER -- as a signal to remote Secondary -- tablet pc based servers to skip scheduled database synchronization with the Primary.
The idea was to set the following in our SugarCRM apps' index.php
(which is called with pretty much every page in the application)
/////////// SYNC BLOCKING /////////////////////////
if($currentModule != 'Inspections'){
$block_apro_sync = mysql_query("UPDATE crm.block_sync SET status = 'yes'") or die(mysql_error());
echo "<div id='block_sync_div' style='border-collapse: collapse; z-index:100;position: absolute; top: 250px; left: 500px; visibility:visible'>
<iframe src='block_sync.php' name='block_sync_iframe' id='block_sync_iframe' scrolling='no' frameborder='0' style='width:300px; height:30px; border-width:0px' ></iframe> ";
}
/////////// END SYNC BLOCKING /////////////////////////
AND in block_sync.php
// block_sync.php
sleep(900); // 15 minutes
$un_block_apro_sync = mysql_query("UPDATE crm.block_sync SET status = 'no'") or die(mysql_error());
if($un_block_apro_sync){
echo "block_sync.status = NO <br><br>";
}
else{ echo "block_sync.status = YES <br><br>";
}
The effect would be for crm.block_sync.status to toggle between yes AND no between periods of user activity,
with Secondary systems polling the table before each scheduled synchronization.
If block_sync.status=no --- Sync
else -- Don't Sync.
The Trouble is , sleep() fails to perform as I'd hoped when set somewhere upward(90) seconds though I've yet to identify the breakpoint.
Thought about using javascript time_out somehow but I just don't see it.
Please, Any input would be greatly appreciated.