several minor notice fixes, a=chris
several minor notice fixes, a=chris
diff --git a/bin/fetcher.php b/bin/fetcher.php
index a33e327f4..6f982e805 100755
--- a/bin/fetcher.php
+++ b/bin/fetcher.php
@@ -2294,7 +2294,7 @@ class Fetcher implements CrawlConstants
crawlLog($queue_server);
crawlLog("Response was:");
crawlLog("$info_string");
- $info = unserialize($info_string);
+ $info = @unserialize($info_string);
$time = time();
$session = md5($time . AUTH_KEY);
$post_data['time'] = $time;
diff --git a/controllers/admin_controller.php b/controllers/admin_controller.php
index 70da29e3a..b9c878574 100755
--- a/controllers/admin_controller.php
+++ b/controllers/admin_controller.php
@@ -244,6 +244,9 @@ class AdminController extends Controller implements CrawlConstants
//for now we allow anyone to get crawlStatus
if($allowed) {
$data = $this->$activity();
+ if(!is_array($data)) {
+ $data = array();
+ }
$data['ACTIVITIES'] = $allowed_activities;
}
if(!in_array($activity, $this->status_activities)) {
@@ -1680,10 +1683,10 @@ class AdminController extends Controller implements CrawlConstants
if (isset($_REQUEST['ranker'][$label])) {
$ison = true;
}
- } else if ($loaded || !isset($_REQUEST['posted']) &&
+ } else if ($loaded || !isset($_REQUEST['posted']) &&
isset($seed_info['active_rankers']['label'])) {
- if (in_array($label,
- $seed_info['active_rankers']['label'])) {
+ if (isset($seed_info['active_rankers']['label']) &&
+ in_array($label, $seed_info['active_rankers']['label'])) {
$ison = true;
}
}
@@ -2197,6 +2200,7 @@ class AdminController extends Controller implements CrawlConstants
*/
function manageMachines()
{
+ $data = array();
$data["ELEMENT"] = "managemachinesElement";
$possible_arguments = array("addmachine", "deletemachine",
"newsmode", "log", "update");
diff --git a/controllers/fetch_controller.php b/controllers/fetch_controller.php
index 3285b8ce6..cbfaccb37 100755
--- a/controllers/fetch_controller.php
+++ b/controllers/fetch_controller.php
@@ -33,6 +33,9 @@
if(!defined('BASE_DIR')) {echo "BAD REQUEST"; exit();}
+// to allow the calulation of longer archive schedules
+ini_set('max_execution_time', 60);
+
/** Load base controller class if needed */
require_once BASE_DIR."/controllers/controller.php";
/** Loads common constants for web crawling*/
diff --git a/lib/archive_bundle_iterators/text_archive_bundle_iterator.php b/lib/archive_bundle_iterators/text_archive_bundle_iterator.php
index fb99867f2..2841fa403 100644
--- a/lib/archive_bundle_iterators/text_archive_bundle_iterator.php
+++ b/lib/archive_bundle_iterators/text_archive_bundle_iterator.php
@@ -559,10 +559,13 @@ class TextArchiveBundleIterator extends ArchiveBundleIterator
while(!is_string($block =
$this->bz2_iterator->nextBlock())) {
if($this->bz2_iterator->eof()) {
- break 2;
+ break;
}
}
$buffer .= $block;
+ if($this->bz2_iterator->eof()) {
+ break;
+ }
}
if($buffer == "") {
return false;
diff --git a/models/model.php b/models/model.php
index ab54825b4..719f960ea 100755
--- a/models/model.php
+++ b/models/model.php
@@ -290,7 +290,7 @@ class Model implements CrawlConstants
$pre_high = ($pos + SNIPPET_LENGTH_RIGHT <= $len ) ?
$pos + SNIPPET_LENGTH_RIGHT: $len;
$high = mb_stripos($text_source, " ",
- max($pre_high - 10, $pos));
+ max(min($pre_high - 10, 0), min($pos, $len)));
if($high > $pre_high + 10){
$high = $pre_high;
}