? boost-559480.patch
Index: boost.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/boost/boost.module,v
retrieving revision 1.3.2.2.2.5.2.108
diff -u -p -r1.3.2.2.2.5.2.108 boost.module
--- boost.module	21 Aug 2009 02:48:02 -0000	1.3.2.2.2.5.2.108
+++ boost.module	28 Aug 2009 07:23:18 -0000
@@ -2078,6 +2078,28 @@ function _boost_rmdir_rf($dirname, $flus
   return ($empty && BOOST_FLUSH_DIR && @rmdir($dirname));
 }
 
+/**
+ * Internal variable get; don't rely on cache table.
+ *
+ * @param $name
+ *   variable name
+ */
+function _boost_variable_get($name) {
+  return unserialize(db_result(db_query("SELECT value FROM {variable} WHERE name = '%s'", $name)));
+}
+
+/**
+ * Internal variable set; don't rely on cache table.
+ *
+ * @param $name
+ *   variable name
+ * @param $value
+ *   variable value
+ */
+function _boost_variable_set($name, $value) {
+  db_query("UPDATE {variable} SET value = '%s' WHERE name = '%s'", serialize($value), $name);
+}
+
 //////////////////////////////////////////////////////////////////////////////
 // PHP 4.x compatibility
 
@@ -2126,7 +2148,7 @@ function boost_crawler_run() {
     else {
       if (boost_crawler_seed_tables()) {
         //Spin Up Threads
-        $thread_primed = variable_get('boost_crawler_threads_primed', FALSE);
+        $thread_primed = _boost_variable_get('boost_crawler_threads_primed');
         $threads = BOOST_CRAWLER_THREADS;
         $step = BOOST_CRAWLER_BATCH_SIZE;
         if (!$thread_primed) {
@@ -2146,14 +2168,12 @@ function boost_crawler_run() {
         }
 
         // Stop button code
-        if (variable_get('boost_crawler_stopped', FALSE)) {
+        if (_boost_variable_get('boost_crawler_stopped')) {
           // Wait 0 to 0.1 seconds before grabbing number of threads.
           usleep(mt_rand(0, 100000));
           db_lock_table('variable');
-          //variable_get
-          $threads = unserialize(db_result(db_query("SELECT value FROM {variable} WHERE name = 'boost_crawler_number_of_threads'")));
-          //variable_set
-          db_query("UPDATE {variable} SET value = '%s' WHERE name = '%s'", serialize(($threads-1)), 'boost_crawler_number_of_threads');
+          $threads = _boost_variable_get('boost_crawler_number_of_threads');
+          _boost_variable_set('boost_crawler_number_of_threads', $threads-1);
           db_unlock_tables();
           watchdog('boost', 'Crawler - Thread %num Stopped.', array('%num' => $threads));
           exit;
@@ -2162,10 +2182,8 @@ function boost_crawler_run() {
         // Wait 0 to 0.1 seconds before grabbing DB position counter.
         usleep(mt_rand(0, 100000));
         db_lock_table('variable');
-        //variable_get
-        $from = unserialize(db_result(db_query("SELECT value FROM {variable} WHERE name = 'boost_crawler_position'")));
-        //variable_set
-        db_query("UPDATE {variable} SET value = '%s' WHERE name = '%s'", serialize(($from + $step)), 'boost_crawler_position');
+        $from = _boost_variable_get('boost_crawler_position');
+        _boost_variable_set('boost_crawler_position', $from + $step);
         db_unlock_tables();
 
         $results = db_query_range("SELECT url FROM {boost_crawler} ORDER BY id ASC", $from, $step);
@@ -2181,10 +2199,8 @@ function boost_crawler_run() {
           // Wait 0 to 0.1 seconds before grabbing number of threads.
           usleep(mt_rand(0, 100000));
           db_lock_table('variable');
-          //variable_get
-          $threads = unserialize(db_result(db_query("SELECT value FROM {variable} WHERE name = 'boost_crawler_number_of_threads'")));
-          //variable_set
-          db_query("UPDATE {variable} SET value = '%s' WHERE name = '%s'", serialize(($threads-1)), 'boost_crawler_number_of_threads');
+          $threads = _boost_variable_get('boost_crawler_number_of_threads');
+          _boost_variable_set('boost_crawler_number_of_threads', $threads-1);
           db_unlock_tables();
           watchdog('boost', 'Crawler - Thread %num Done.', array('%num' => $threads));
           return TRUE;
