Changeset 101 for trunk/userlist.php


Ignore:
Timestamp:
Feb 18, 2009, 7:32:52 AM (16 years ago)
Author:
george
Message:
  • Upraveno: Zrychleno velmi pomalé načítání seznamu uživatelů z databáze.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/userlist.php

    r91 r101  
    3333  <th><a href="?Order=LastLogin&amp;Desc='.$desc.'">Poslední připojení</a></th></tr>');
    3434
    35 $Query = 'SELECT ID,user, LastLogin, GM, (';
     35$Columns = '';
     36$Joins = '';
    3637foreach($TranslationTree as $Group)
    3738  if($Group['TablePrefix'] != '')
    38     $Query .= '(SELECT count(*) FROM `'.$Group['TablePrefix'].'` WHERE (User = user.ID) AND (Complete = 1) AND (Language <> 0)) + ';
    39 $Query .= '0) as NumberTranslate FROM `user` ORDER BY '.$order.' '.$desc.' LIMIT '.($_SESSION['Page'] - 1) * $Config['Web']['ItemsPerPage'].','.$Config['Web']['ItemsPerPage'];
     39  {
     40        $Columns .= 'COALESCE(T'.$Group['Id'].'.Count, 0) + ';
     41    $Joins .= ' LEFT JOIN (SELECT User, COUNT(User) as Count FROM `'.$Group['TablePrefix'].'` WHERE (Complete = 1) AND (Language <> 0) GROUP BY User) as T'.$Group['Id'].' ON user.ID=T'.$Group['Id'].'.User';
     42  }
     43
     44$Query = 'SELECT ID, user.user, LastLogin, GM, ('.substr($Columns, 0, -3).') as NumberTranslate FROM `user`'.$Joins.' ORDER BY '.$order.' '.$desc.' LIMIT '.($_SESSION['Page'] - 1) * $Config['Web']['ItemsPerPage'].','.$Config['Web']['ItemsPerPage'];
     45
    4046$ID = $Database->SQLCommand($Query);
    41 while($Line = mysql_fetch_array($ID))
     47while($Line = mysql_fetch_assoc($ID))
    4248{
    4349  if(Licence(LICENCE_MODERATOR))
Note: See TracChangeset for help on using the changeset viewer.