Fix a division by zero notice in CrawlModel, a-chris

Chris Pollett [2019-06-10 17:Jun:th]
Fix a division by zero notice in CrawlModel, a-chris
Filename
src/locale/ar/configure.ini
src/locale/bn/configure.ini
src/locale/de/configure.ini
src/locale/en_US/configure.ini
src/locale/es/configure.ini
src/locale/fa/configure.ini
src/locale/fr_FR/configure.ini
src/locale/he/configure.ini
src/locale/hi/configure.ini
src/locale/in_ID/configure.ini
src/locale/it/configure.ini
src/locale/ja/configure.ini
src/locale/kn/configure.ini
src/locale/ko/configure.ini
src/locale/nl/configure.ini
src/locale/pl/configure.ini
src/locale/pt/configure.ini
src/locale/ru/configure.ini
src/locale/te/configure.ini
src/locale/th/configure.ini
src/locale/tr/configure.ini
src/locale/vi_VN/configure.ini
src/locale/zh_CN/configure.ini
src/models/CrawlModel.php
diff --git a/src/locale/ar/configure.ini b/src/locale/ar/configure.ini
index 4dc55181e..7251775f7 100755
--- a/src/locale/ar/configure.ini
+++ b/src/locale/ar/configure.ini
@@ -1696,7 +1696,7 @@ rss_layout_title = "بي إتش بي محرك البحث-يوب!:  %s"
 rss_layout_description = "نتائج البحث ل:  %s"
 ;
 ; View.php
-view_locale_version = "4"
+view_locale_version = "5"
 view_logo_alt_text = ""
 ;
 ; WikiView.php
diff --git a/src/locale/bn/configure.ini b/src/locale/bn/configure.ini
index 187a9b46f..8f4250274 100755
--- a/src/locale/bn/configure.ini
+++ b/src/locale/bn/configure.ini
@@ -1696,7 +1696,7 @@ rss_layout_title = ""
 rss_layout_description = ""
 ;
 ; View.php
-view_locale_version = "4"
+view_locale_version = "5"
 view_logo_alt_text = ""
 ;
 ; WikiView.php
diff --git a/src/locale/de/configure.ini b/src/locale/de/configure.ini
index 543899984..8dacbe0c6 100755
--- a/src/locale/de/configure.ini
+++ b/src/locale/de/configure.ini
@@ -1696,7 +1696,7 @@ rss_layout_title = ""
 rss_layout_description = ""
 ;
 ; View.php
-view_locale_version = "4"
+view_locale_version = "5"
 view_logo_alt_text = ""
 ;
 ; WikiView.php
diff --git a/src/locale/en_US/configure.ini b/src/locale/en_US/configure.ini
index df9a37e93..52f287c3a 100644
--- a/src/locale/en_US/configure.ini
+++ b/src/locale/en_US/configure.ini
@@ -1696,7 +1696,7 @@ rss_layout_title = "PHP Search Engine - Yioop! : %s"
 rss_layout_description = "Search results for: %s"
 ;
 ; View.php
-view_locale_version = "4"
+view_locale_version = "5"
 view_logo_alt_text = "Yioop"
 ;
 ; WikiView.php
diff --git a/src/locale/es/configure.ini b/src/locale/es/configure.ini
index 0cce485e3..677bdfddb 100755
--- a/src/locale/es/configure.ini
+++ b/src/locale/es/configure.ini
@@ -1696,7 +1696,7 @@ rss_layout_title = ""
 rss_layout_description = ""
 ;
 ; View.php
-view_locale_version = "4"
+view_locale_version = "5"
 view_logo_alt_text = ""
 ;
 ; WikiView.php
diff --git a/src/locale/fa/configure.ini b/src/locale/fa/configure.ini
index 7c132fa2d..00028569a 100755
--- a/src/locale/fa/configure.ini
+++ b/src/locale/fa/configure.ini
@@ -1696,7 +1696,7 @@ rss_layout_title = "موتور جستجوی PHP - Yioop! : %s"
 rss_layout_description = "نتایج جستجو برای: %s"
 ;
 ; View.php
-view_locale_version = "4"
+view_locale_version = "5"
 view_logo_alt_text = ""
 ;
 ; WikiView.php
diff --git a/src/locale/fr_FR/configure.ini b/src/locale/fr_FR/configure.ini
index 60ffa252d..f88ae70e8 100755
--- a/src/locale/fr_FR/configure.ini
+++ b/src/locale/fr_FR/configure.ini
@@ -1696,7 +1696,7 @@ rss_layout_title = "Moteur de recherche PHP -Yioop! %s"
 rss_layout_description = "%s Résultats"
 ;
 ; View.php
-view_locale_version = "4"
+view_locale_version = "5"
 view_logo_alt_text = ""
 ;
 ; WikiView.php
diff --git a/src/locale/he/configure.ini b/src/locale/he/configure.ini
index 94bb82461..08ad88748 100755
--- a/src/locale/he/configure.ini
+++ b/src/locale/he/configure.ini
@@ -1696,7 +1696,7 @@ rss_layout_title = ""
 rss_layout_description = ""
 ;
 ; View.php
-view_locale_version = "4"
+view_locale_version = "5"
 view_logo_alt_text = ""
 ;
 ; WikiView.php
diff --git a/src/locale/hi/configure.ini b/src/locale/hi/configure.ini
index 27d6d4e36..081a1a326 100755
--- a/src/locale/hi/configure.ini
+++ b/src/locale/hi/configure.ini
@@ -1696,7 +1696,7 @@ rss_layout_title = ""
 rss_layout_description = ""
 ;
 ; View.php
-view_locale_version = "4"
+view_locale_version = "5"
 view_logo_alt_text = ""
 ;
 ; WikiView.php
diff --git a/src/locale/in_ID/configure.ini b/src/locale/in_ID/configure.ini
index cacfe1fa5..31daa9205 100755
--- a/src/locale/in_ID/configure.ini
+++ b/src/locale/in_ID/configure.ini
@@ -1696,7 +1696,7 @@ rss_layout_title = ""
 rss_layout_description = ""
 ;
 ; View.php
-view_locale_version = "4"
+view_locale_version = "5"
 view_logo_alt_text = ""
 ;
 ; WikiView.php
diff --git a/src/locale/it/configure.ini b/src/locale/it/configure.ini
index 85f6eba02..5bc3fa471 100755
--- a/src/locale/it/configure.ini
+++ b/src/locale/it/configure.ini
@@ -1696,7 +1696,7 @@ rss_layout_title = "Yioop! Motore di Ricerca in PHP: %s"
 rss_layout_description = "Risultati di ricerca per: %s"
 ;
 ; View.php
-view_locale_version = "4"
+view_locale_version = "5"
 view_logo_alt_text = ""
 ;
 ; WikiView.php
diff --git a/src/locale/ja/configure.ini b/src/locale/ja/configure.ini
index 1f9be1b09..12e817bbb 100755
--- a/src/locale/ja/configure.ini
+++ b/src/locale/ja/configure.ini
@@ -1696,7 +1696,7 @@ rss_layout_title = ""
 rss_layout_description = ""
 ;
 ; View.php
-view_locale_version = "4"
+view_locale_version = "5"
 view_logo_alt_text = ""
 ;
 ; WikiView.php
diff --git a/src/locale/kn/configure.ini b/src/locale/kn/configure.ini
index 1d9ff6ef3..81b15863e 100755
--- a/src/locale/kn/configure.ini
+++ b/src/locale/kn/configure.ini
@@ -1696,7 +1696,7 @@ rss_layout_title = "ಪಿಹೆಚಪಿ ಶೋಧನಾ ಯಂತ್ರ - ಯ
 rss_layout_description = "ಈ ಶೋಧನಾ ಫಲಿತಾಂಶಗಳು ನಿಮ್ಮ ಪ್ರಶ್ನೆ: %s  ಯ ಉತ್ತರ"
 ;
 ; View.php
-view_locale_version = "4"
+view_locale_version = "5"
 view_logo_alt_text = ""
 ;
 ; WikiView.php
diff --git a/src/locale/ko/configure.ini b/src/locale/ko/configure.ini
index b115acbcd..26865a14f 100755
--- a/src/locale/ko/configure.ini
+++ b/src/locale/ko/configure.ini
@@ -1696,7 +1696,7 @@ rss_layout_title = "PHP 검색 엔진 - Yioop! : %s"
 rss_layout_description = "%s 에 대한 서치 결과:"
 ;
 ; View.php
-view_locale_version = "4"
+view_locale_version = "5"
 view_logo_alt_text = ""
 ;
 ; WikiView.php
diff --git a/src/locale/nl/configure.ini b/src/locale/nl/configure.ini
index 34296e6de..f9c06e602 100644
--- a/src/locale/nl/configure.ini
+++ b/src/locale/nl/configure.ini
@@ -1696,7 +1696,7 @@ rss_layout_title = "PHP Search Engine - Yioop! :%S"
 rss_layout_description = "Zoek resultaten voor: %s"
 ;
 ; View.php
-view_locale_version = "4"
+view_locale_version = "5"
 view_logo_alt_text = "Yioop"
 ;
 ; WikiView.php
diff --git a/src/locale/pl/configure.ini b/src/locale/pl/configure.ini
index 82ca15d08..69e10b400 100755
--- a/src/locale/pl/configure.ini
+++ b/src/locale/pl/configure.ini
@@ -1696,7 +1696,7 @@ rss_layout_title = ""
 rss_layout_description = ""
 ;
 ; View.php
-view_locale_version = "4"
+view_locale_version = "5"
 view_logo_alt_text = ""
 ;
 ; WikiView.php
diff --git a/src/locale/pt/configure.ini b/src/locale/pt/configure.ini
index 477aee25b..aeab14bdd 100755
--- a/src/locale/pt/configure.ini
+++ b/src/locale/pt/configure.ini
@@ -1696,7 +1696,7 @@ rss_layout_title = ""
 rss_layout_description = ""
 ;
 ; View.php
-view_locale_version = "4"
+view_locale_version = "5"
 view_logo_alt_text = ""
 ;
 ; WikiView.php
diff --git a/src/locale/ru/configure.ini b/src/locale/ru/configure.ini
index 6d3e61bcd..1e5f6e19c 100755
--- a/src/locale/ru/configure.ini
+++ b/src/locale/ru/configure.ini
@@ -1696,7 +1696,7 @@ rss_layout_title = ""
 rss_layout_description = ""
 ;
 ; View.php
-view_locale_version = "4"
+view_locale_version = "5"
 view_logo_alt_text = ""
 ;
 ; WikiView.php
diff --git a/src/locale/te/configure.ini b/src/locale/te/configure.ini
index 8785fb928..a1dc9f9dc 100644
--- a/src/locale/te/configure.ini
+++ b/src/locale/te/configure.ini
@@ -1696,7 +1696,7 @@ rss_layout_title = ""
 rss_layout_description = ""
 ;
 ; View.php
-view_locale_version = "4"
+view_locale_version = "5"
 view_logo_alt_text = "Yioop"
 ;
 ; WikiView.php
diff --git a/src/locale/th/configure.ini b/src/locale/th/configure.ini
index 6193dc76f..e7d3bb216 100755
--- a/src/locale/th/configure.ini
+++ b/src/locale/th/configure.ini
@@ -1696,7 +1696,7 @@ rss_layout_title = ""
 rss_layout_description = ""
 ;
 ; View.php
-view_locale_version = "4"
+view_locale_version = "5"
 view_logo_alt_text = ""
 ;
 ; WikiView.php
diff --git a/src/locale/tr/configure.ini b/src/locale/tr/configure.ini
index 1eca813bc..e516da179 100755
--- a/src/locale/tr/configure.ini
+++ b/src/locale/tr/configure.ini
@@ -1696,7 +1696,7 @@ rss_layout_title = ""
 rss_layout_description = ""
 ;
 ; View.php
-view_locale_version = "4"
+view_locale_version = "5"
 view_logo_alt_text = ""
 ;
 ; WikiView.php
diff --git a/src/locale/vi_VN/configure.ini b/src/locale/vi_VN/configure.ini
index c4d64f7e4..36d403efb 100755
--- a/src/locale/vi_VN/configure.ini
+++ b/src/locale/vi_VN/configure.ini
@@ -1696,7 +1696,7 @@ rss_layout_title = ""
 rss_layout_description = ""
 ;
 ; View.php
-view_locale_version = "4"
+view_locale_version = "5"
 view_logo_alt_text = ""
 ;
 ; WikiView.php
diff --git a/src/locale/zh_CN/configure.ini b/src/locale/zh_CN/configure.ini
index daf594212..c80f4fb32 100755
--- a/src/locale/zh_CN/configure.ini
+++ b/src/locale/zh_CN/configure.ini
@@ -1696,7 +1696,7 @@ rss_layout_title = ""
 rss_layout_description = ""
 ;
 ; View.php
-view_locale_version = "4"
+view_locale_version = "5"
 view_logo_alt_text = ""
 ;
 ; WikiView.php
diff --git a/src/models/CrawlModel.php b/src/models/CrawlModel.php
index aacfa123c..64ca45f8c 100755
--- a/src/models/CrawlModel.php
+++ b/src/models/CrawlModel.php
@@ -1036,7 +1036,7 @@ EOT;
             });
             $num_sites = count($sites);
             // use high 3 bytes for integer weight, 1 byte to remember depth
-            $common_start_weight = floor(((1 << 24) - 1) / $num_sites);
+            $common_start_weight = floor(((1 << 24) - 1) / min($num_sites, 1));
             foreach ($sites as $site) {
                 $site_parts = preg_split("/\s+/", $site);
                 if (strlen($site_parts[0]) > 0) {
@@ -1052,9 +1052,8 @@ EOT;
             }
             $scheduler_string = "\n" . L\webencode(
                 gzcompress(serialize($scheduler_info)));
-            file_put_contents(
-                C\CRAWL_DIR."/schedules/$channel-" . self::schedule_start_name,
-                $scheduler_string);
+            file_put_contents(C\CRAWL_DIR . "/schedules/$channel-" .
+                self::schedule_start_name, $scheduler_string);
         }
         return true;
     }
ViewGit