Hi, On Mon, 2003-03-24 at 13:48, Francois Zbinden wrote: > I'm looking for a fast way to count all pages / articles / topics / > snippets > in a sitegroup. Writing a recursivly function with mgd_list_xxx seems to > be too slow. Is there another way? A "select count(*) from xxx where > sitegroup=x" > should done this but direcly access to midgard database is very bad I > know.
A select directly into the database does not hurt integrity. You will
need the password to the MySQL db, to go that route though.
If you stick to midgard-php, lookup the mgd_list_topic_articles_all_fast
function, It will save you some off the recursion.
Also, remember that you don't have to do a full fetch of all lists,
because all list objects have a member 'N', which holds the total number
of fetchable objects in the list.
<?php
$articles = mgd_list_topic_articles_all_fast(0);
if($articles)
$article_count = $articles->N;
?>
Cheers,
--
Envida http://www.envida.net/
Armand A. Verstappen Graadt van Roggenweg 328
[EMAIL PROTECTED] 3531 AH Utrecht
tel: +31 (0)30 298 2255 Postbus 19127
fax: +31 (0)30 298 2111 3501 DC Utrecht
signature.asc
Description: This is a digitally signed message part
