Prechádzať zdrojové kódy

Limitation du nombre d'articles à charger en utilisant le chargement par parsing (pour éviter les débordements de mémoire)

Marien Fressinaud 13 rokov pred
rodič
commit
f3f2bc7471
2 zmenil súbory, kde vykonal 15 pridanie a 0 odobranie
  1. 6 0
      app/models/Feed.php
  2. 9 0
      public/data/Configuration.array.php

+ 6 - 0
app/models/Feed.php

@@ -88,6 +88,7 @@ class Feed extends Model {
 	private function loadEntries ($feed) {
 	private function loadEntries ($feed) {
 		$entries = array ();
 		$entries = array ();
 		
 		
+		$i = 0;
 		foreach ($feed->get_items () as $item) {
 		foreach ($feed->get_items () as $item) {
 			$title = $item->get_title ();
 			$title = $item->get_title ();
 			$author = $item->get_author ();
 			$author = $item->get_author ();
@@ -100,6 +101,7 @@ class Feed extends Model {
 			if ($path) {
 			if ($path) {
 				try {
 				try {
 					$content = get_content_by_parsing ($item->get_permalink (), $path);
 					$content = get_content_by_parsing ($item->get_permalink (), $path);
+					$i++;
 				} catch (Exception $e) {
 				} catch (Exception $e) {
 					$content = $item->get_content ();
 					$content = $item->get_content ();
 				}
 				}
@@ -118,6 +120,10 @@ class Feed extends Model {
 			);
 			);
 		
 		
 			$entries[$entry->id ()] = $entry;
 			$entries[$entry->id ()] = $entry;
+			
+			if ($i > 10) {
+				break;
+			}
 		}
 		}
 	
 	
 		$this->entries = $entries;
 		$this->entries = $entries;

+ 9 - 0
public/data/Configuration.array.php

@@ -0,0 +1,9 @@
+<?php
+return array (
+	'posts_per_page' => 10,
+	'default_view' => 'all',
+	'display_posts' => 'no',
+	'sort_order' => 'low_to_high',
+	'old_entries' => 3,
+	'mail_login' => '',
+);