fixes bug in thumbnails, fixes accidental line deletion in fetcher

Chris Pollett [2010-07-29 18:Jul:th]
fixes bug in thumbnails, fixes accidental line deletion in fetcher
Filename
bin/fetcher.php
bin/queue_server.php
controllers/search_controller.php
lib/index_archive_bundle.php
lib/processors/image_processor.php
lib/processors/jpg_processor.php
diff --git a/bin/fetcher.php b/bin/fetcher.php
index bffb56ae4..1ae074f80 100755
--- a/bin/fetcher.php
+++ b/bin/fetcher.php
@@ -386,11 +386,11 @@ class Fetcher implements CrawlConstants
      * @return array containing this info
      */
     function checkScheduler()
-    {
+    {
         $info = array();
-        $info[self::STATUS]  = self::CONTINUE_STATE;
+
         if(count($this->to_crawl) > 0) {
-
+            $info[self::STATUS]  = self::CONTINUE_STATE;
             return;
         }

@@ -752,7 +752,7 @@ class Fetcher implements CrawlConstants
                         self::CRAWL_DELAY] = $site[self::CRAWL_DELAY];
                 }
             } else {
-                $this->found_sites[self::ROBOT_PATHS][] = $site;
+                $this->found_sites[self::SEEN_URLS][] = $site;
                 if(isset($site[self::LINKS])) {
                     if(!isset($this->found_sites[self::TO_CRAWL])) {
                         $this->found_sites[self::TO_CRAWL] = array();
@@ -833,6 +833,7 @@ class Fetcher implements CrawlConstants

         $post_data = array('c'=>'fetch', 'a'=>'update',
             'crawl_time' => $this->crawl_time, 'machine_uri' => WEB_URI);
+
         $post_data['found'] = urlencode(base64_encode(
             gzcompress(serialize($this->found_sites))));
         $bytes_to_send = strlen($post_data['found']);
diff --git a/bin/queue_server.php b/bin/queue_server.php
index 3ca7b021c..8ab704959 100755
--- a/bin/queue_server.php
+++ b/bin/queue_server.php
@@ -455,7 +455,7 @@ class QueueServer implements CrawlConstants
         $index_archive = $this->index_archive;
         $sites = unserialize(file_get_contents($file));

-       crawlLog("A memory usage".memory_get_usage() .
+        crawlLog("A memory usage".memory_get_usage() .
           " time: ".(changeInMicrotime($start_time)));
         $start_time = microtime();

diff --git a/controllers/search_controller.php b/controllers/search_controller.php
index 05d182552..2003b37e6 100755
--- a/controllers/search_controller.php
+++ b/controllers/search_controller.php
@@ -90,7 +90,7 @@ class SearchController extends Controller implements CrawlConstants
         $view = "search";
         $start_time = microtime();

-        if(isset($_SESSION['MAX_PAGES_TO_SHOW'])) {
+        if(isset($_SESSION['MAX_PAGES_TO_SHOW']) ) {
             $results_per_page = $_SESSION['MAX_PAGES_TO_SHOW'];
         } else {
             $results_per_page = NUM_RESULTS_PER_PAGE;
diff --git a/lib/index_archive_bundle.php b/lib/index_archive_bundle.php
index 5835fb869..4a1358dc3 100644
--- a/lib/index_archive_bundle.php
+++ b/lib/index_archive_bundle.php
@@ -804,7 +804,8 @@ class IndexArchiveBundle implements IndexingConstants, CrawlConstants
     {
         $this->summaries->forceSave();
         for($i = 0; $i < $this->num_partitions_index; $i++) {
-            if($this->index_partition_filters[$i] != NULL) {
+            if($this->index_partition_filters[$i] &&
+                $this->index_partition_filters[$i] != NULL) {
                 $this->index_partition_filters[$i]->save();
             }
         }
diff --git a/lib/processors/image_processor.php b/lib/processors/image_processor.php
index 052c876b1..90ca39a57 100755
--- a/lib/processors/image_processor.php
+++ b/lib/processors/image_processor.php
@@ -73,7 +73,7 @@ abstract class ImageProcessor implements CrawlConstants
     static function createThumb($image)
     {
         $thumb = imagecreatetruecolor(50, 50);
-        if( isset($image) && $image != NULL && is_object($image) ) {
+        if( isset($image)  ) {
             $size_x = imagesx($image);
             $size_y = imagesy($image);

diff --git a/lib/processors/jpg_processor.php b/lib/processors/jpg_processor.php
index 443f28f6e..9637ad5ec 100755
--- a/lib/processors/jpg_processor.php
+++ b/lib/processors/jpg_processor.php
@@ -56,7 +56,7 @@ class JpgProcessor extends ImageProcessor
     {
         if(is_string($page)) {
             file_put_contents(CRAWL_DIR."/cache/tmp.jpg", $page);
-            $image = @imagecreatefromjpeg(CRAWL_DIR."/cache/tmp.jpg");
+            $image = @imagecreatefromjpeg(CRAWL_DIR."/cache/tmp.jpg");
             $thumb_string = self::createThumb($image);
             $summary[self::TITLE] = "";
             $summary[self::DESCRIPTION] = "Image of ".
ViewGit