Don't slurp in entire file. Props tellyworth. see #4421

git-svn-id: http://svn.automattic.com/wordpress/trunk@5802 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-07-15 17:55:12 +00:00
parent d8d651221c
commit b6978b2123
1 changed files with 33 additions and 26 deletions

View File

@ -85,13 +85,17 @@ class WP_Import {
function get_entries() { function get_entries() {
set_magic_quotes_runtime(0); set_magic_quotes_runtime(0);
$importdata = array_map('rtrim', file($this->file)); // Read the file into an array
$this->posts = array(); $this->posts = array();
$this->categories = array(); $this->categories = array();
$num = 0; $num = 0;
$doing_entry = false; $doing_entry = false;
foreach ($importdata as $importline) {
$fp = fopen($this->file, 'r');
if ($fp) {
while ( !feof($fp) ) {
$importline = rtrim(fgets($fp));
if ( false !== strpos($importline, '<wp:category>') ) { if ( false !== strpos($importline, '<wp:category>') ) {
preg_match('|<wp:category>(.*?)</wp:category>|is', $importline, $category); preg_match('|<wp:category>(.*?)</wp:category>|is', $importline, $category);
$this->categories[] = $category[1]; $this->categories[] = $category[1];
@ -119,6 +123,9 @@ class WP_Import {
$this->posts_processed[$post_ID][1] = 0; $this->posts_processed[$post_ID][1] = 0;
} }
} }
fclose($fp);
}
} }
function get_wp_authors() { function get_wp_authors() {