diff options
author | Dries Buytaert <dries@buytaert.net> | 2007-08-26 07:20:07 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2007-08-26 07:20:07 +0000 |
commit | 31c357f9c8e4ffe9f635189fa1315495bc427752 (patch) | |
tree | a69254d5c76912f7f2975f2ed2bbd3dd54be7d05 | |
parent | be9b7e300408aa7dd7a17fe521c6516d1b9e025a (diff) | |
download | brdo-31c357f9c8e4ffe9f635189fa1315495bc427752.tar.gz brdo-31c357f9c8e4ffe9f635189fa1315495bc427752.tar.bz2 |
- Patch #170004 by pwolanin: removed db_num_rows() in book_update_6000.
-rw-r--r-- | modules/book/book.install | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/modules/book/book.install b/modules/book/book.install index 59ade1733..fdbafe48a 100644 --- a/modules/book/book.install +++ b/modules/book/book.install @@ -150,20 +150,10 @@ function book_update_6000() { $update_count = 400; // Update this many at a time $result = db_query_range("SELECT * FROM {book_temp}", $_SESSION['book_update_6000_orphans']['from'], $update_count); - - if (db_num_rows($result)) { - $_SESSION['book_update_6000_orphans']['from'] += $update_count; - } - else { - // Done with this part - if (!empty($_SESSION['book_update_6000_orphans']['book'])) { - // The orphans' parent is added last, so it will be processed first. - $_SESSION['book_update_6000'][] = $_SESSION['book_update_6000_orphans']['book']; - } - $_SESSION['book_update_6000_orphans'] = FALSE; - } + $has_rows = FALSE; // Go through the next $update_count book pages and locate the orphans. while ($book = db_fetch_array($result)) { + $has_rows = TRUE; // Orphans are defined as nodes whose parent does not exist in the table. if ($book['parent'] && !db_result(db_query("SELECT COUNT(*) FROM {book_temp} WHERE nid = %d", $book['parent']))) { if (empty($_SESSION['book_update_6000_orphans']['book'])) { @@ -179,6 +169,17 @@ function book_update_6000() { } } } + if ($has_rows) { + $_SESSION['book_update_6000_orphans']['from'] += $update_count; + } + else { + // Done with this part + if (!empty($_SESSION['book_update_6000_orphans']['book'])) { + // The orphans' parent is added last, so it will be processed first. + $_SESSION['book_update_6000'][] = $_SESSION['book_update_6000_orphans']['book']; + } + $_SESSION['book_update_6000_orphans'] = FALSE; + } $ret['#finished'] = FALSE; return $ret; } |