Author Topic: Langsames ACP  (Read 15422 times)

0 Members and 1 Guest are viewing this topic.

rinaldos

  • Guest
Langsames ACP
« on: February 23, 2007, 12:02:10 AM »
Hallo zusammen.
Bei mir dauert das öffnen des ACP knappe 30 Sekunden. Die Webseite läuft auf einem P4 2 GHz mit 512MB Ram.  Sobald ich ins ACP will geht auch die CPU Auslastung auf 100%. Dies geschieht auch wenn ich die Statistik    
[MOD] YaSt - Yet another Statistic Tool - Statistic Mod v1.01
ausführen möchte.
Woran kann das liegen?

Link zur Statistik: http://rinaldos.homeip.net/statistics.php?mode=all

Woran könnte das liegen? Denn ansonsten läuft die Webseite sehr flüssig und schnell :-)

LG
Ingo

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: Langsames ACP
« Reply #1 on: February 23, 2007, 04:01:35 PM »
Hatte aehnliches problem.

Loesung:

ersetze deine jetzige admin/home.php mit diesem kod:

Code: [Select]
<?php

/**************************************************************************

 *                                                                        *

 *    4images - A Web Based Image Gallery Management System               *

 *    ----------------------------------------------------------------    *

 *                                                                        *

 *             File: home.php                                             *

 *        Copyright: (C) 2002 Jan Sorgalla                                *

 *            Email: jan@4homepages.de                                    *

 *              Web: http://www.4homepages.de                             *

 *    Scriptversion: 1.7.4                                                *

 *                                                                        *

 *    Never released without support from: Nicky (http://www.nicky.net)   *

 *                                                                        *

 **************************************************************************

 *                                                                        *

 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *

 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *

 *    ---------------------------------------------------------------     *

 *    This script is NOT freeware! Please read the Copyright Notice       *

 *    (Licence.txt) for further information.                              *

 *                                                                        *

 *************************************************************************/



$stats_limit 5;



define('IN_CP'1);

define('ROOT_PATH''./../');

require(
'admin_global.php');



if (
$action == "") {

  
$action "home";

}



show_admin_header();



$ip_whois_link "http://www.ripe.net/perl/whois/?searchtext=";



if (
$action == "home") {

  if (!
defined('USER_INTEGRATION')) {

    
printf("<span class=\"headline\">%s</span><br /><br />"$lang['headline_whosonline']);

    echo 
"<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" width=\"100%\" align=\"center\"><tr><td class=\"tableborder\">\n<table cellpadding=\"3\" cellspacing=\"1\" border=\"0\" width=\"100%\">\n";

    echo 
"<tr class=\"tableseparator\">\n";

    echo 
"<td class=\"tableseparator\">".$lang['field_username']."</td>\n<td class=\"tableseparator\">".$lang['field_lastaction']."</td>\n<td class=\"tableseparator\">&nbsp;</td>\n<td class=\"tableseparator\">".$lang['field_ip']."</td>\n</tr>\n";



    
$num_total_online 0;

    
$num_visible_online 0;

    
$num_invisible_online 0;

    
$num_registered_online 0;

    
$num_guests_online 0;

    
$user_online_list "";

    
$prev_user_id "";

    
$prev_ip "";



    
$sql "SELECT ".get_user_table_field("u.""user_id").get_user_table_field(", u.""user_level").get_user_table_field(", u.""user_name").get_user_table_field(", u.""user_lastaction").get_user_table_field(", u.""user_location").get_user_table_field(", u.""user_invisible").", s.session_user_id, s.session_lastaction, s.session_ip

    FROM ("
.USERS_TABLE." u, ".SESSIONS_TABLE." s)

    WHERE "
.get_user_table_field("u.""user_id")." = s.session_user_id AND s.session_user_id <> ".GUEST." AND ".get_user_table_field("u.""user_lastaction")." > ".(time() - 300)."

    ORDER BY session_ip ASC"
;

    
$result $site_db->query($sql);



    while (
$row $site_db->fetch_array($result)) {

      if (
$row['session_user_id'] != $prev_user_id) {

        echo 
"<tr class=\"".get_row_bg()."\">\n";

        
$user_id $row['session_user_id'];

        
$username format_text($row[$user_table_fields['user_name']], 2);



        
$is_invisible = (isset($row[$user_table_fields['user_invisible']]) && $row[$user_table_fields['user_invisible']] == 1) ? 0;

        if (
$is_invisible) { // Invisible User but show to Admin

          
$invisibleuser "*";

        }

        else {

          
$invisibleuser "";

          
$num_visible_online++;

        }

        if (
$row[$user_table_fields['user_level']] == ADMIN) {

          
$username sprintf("<b>%s</b>"$username);

        }

        if (empty(
$user_profile_link)) {

          
$username "<a href=\"".$site_sess->url(ROOT_PATH."member.php?action=showprofile&amp;".URL_USER_ID."=".$user_id)."\" target=\"_blank\">".$username."</a>";

        }

        echo 
"<td>".$username.$invisibleuser."</td>\n";

        echo 
"<td>".format_date($config['date_format']." ".$config['time_format'], $row[$user_table_fields['user_lastaction']])."</td>\n";



        if (
eregi("Control Panel"$row[$user_table_fields['user_location']])) {

          echo 
"<td>Control Panel</td>";

        }

        else {

          echo 
"<td><a href=\"".$site_sess->url(ROOT_PATH.$row[$user_table_fields['user_location']])."\" target=\"_blank\">".$row[$user_table_fields['user_location']]."</a></td>\n";

        }

        echo 
"<td><a href=\"".$ip_whois_link.$row['session_ip']."\" target=\"_blank\">".$row['session_ip']."</a></td>\n";

        
$num_registered_online++;

      }

      
$prev_user_id $row['session_user_id'];

    }



    
$sql "SELECT session_user_id, session_lastaction, session_ip, session_location

            FROM "
.SESSIONS_TABLE."

            WHERE session_lastaction >= "
.(time() - 300)." AND session_user_id = ".GUEST;

    
$result $site_db->query($sql);



    
$num_guests_online 0;

    while (
$row $site_db->fetch_array($result)) {

      if (
$row['session_ip'] != $prev_ip) {

        echo 
"<tr class=\"".get_row_bg()."\">\n";

        echo 
"<td>".$lang['userlevel_guest']."</td>\n";

        echo 
"<td>".format_date($config['date_format']." ".$config['time_format'], $row['session_lastaction'])."</td>\n";

        if (
eregi("Control Panel"$row['session_location'])) {

          echo 
"<td>Control Panel</td>";

        }

        else {

          echo 
"<td><a href=\"".$site_sess->url(ROOT_PATH.$row['session_location'])."\" target=\"_blank\">".$row['session_location']."</a></td>\n";

        }

        echo 
"<td>".$row['session_ip']."</td>\n";

        echo 
"</tr>\n";

        
$num_guests_online++;

      }

      
$prev_ip $row['session_ip'];

    }



    echo 
"</table></td></tr></table><br />";



    
$num_total_online $num_registered_online $num_guests_online;

    
$num_invisible_online $num_registered_online $num_visible_online;



    
$lang['online_users'] = preg_replace("/".$site_template->start."num_total".$site_template->end."/siU"$num_total_online$lang['online_users']);

    
$lang['online_users'] = preg_replace("/".$site_template->start."num_registered".$site_template->end."/siU"$num_registered_online$lang['online_users']);

    
$lang['online_users'] = preg_replace("/".$site_template->start."num_guests".$site_template->end."/siU"$num_guests_online$lang['online_users']);

    
printf ("<b>%s</b><br /><br /><br />"$lang['online_users']);

  } 
// End defined('USER_INTEGRATION')



  
$total_images 0;

  
$total_categories 0;

  foreach (
$cat_cache as $val) {

    
$total_categories++;

    if (isset(
$val['num_images'])) {

      
$total_images += $val['num_images'];

    }

  }



  

}

show_admin_footer();

?>


Muesste jetzt 200% schneller laufen. Die ganzen stats in dem ACP brauch man ja nicht.

Offline mawenzi

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: Langsames ACP
« Reply #2 on: February 23, 2007, 04:19:22 PM »
... oder die admin/home.php teilen und mit entsprechenden Links im Menue versehen...
... 1. Teil : "who is online" in admin/home.php ...
Code: [Select]
if ($action == "") {
  $action = "home";
}
show_admin_header();
if ($action == "home") {
...
hier der alte code für "who is online"
...
}

... 2. Teil : "statisics" in  admin/home.php ...
Code: [Select]
if ($action == "home_2") {
...
hier der alte code für "statistics"
...
}
show_admin_footer();

?>

... 3. Teil : "Menue" in  admin/index.php vor ...
Code: [Select]
show_nav_header($lang['nav_categories_main']);
... die neuen Menuepunkte  einfügen ...
Code: [Select]
show_nav_header('Home - Admin Control Panel');
show_nav_option('ACP Home - Wer ist online ?', "home.php?action=home");
show_nav_option('ACP Home - Statistik', "home.php?action=home_2");

...entspricht in der Effektivität dem Vorschlag von trez, nur dass die Statistik nicht verloren ist, sie aber nicht jedes mal in der ACP-Startseite mit aufgerufen wird, aber über den neuen Menue-Pukt im ACP bei Bedarf aufgerufen werden kann ...
... so habe ich mein ACP beschleunigt ...  :mrgreen:
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

rinaldos

  • Guest
Re: Langsames ACP
« Reply #3 on: February 24, 2007, 09:27:09 AM »
Hallo zusammen :-)

Beide Versionen beschleunigen das ACP ungemein. Nutze ich aber Mawenzi's Version dauert auf einmal das laden des Statistikteils ca. 60 sek :-( Hm, ob ich irgendwo etwas falsch eingebaut habe?

Teil 1:
--
if ($action == "") {
  $action = "home";                       
}

show_admin_header();

$ip_whois_link = "http://www.ripe.net/perl/whois/?searchtext=";

if ($action == "home_1") {                                      <- nach home_1 geändert
  if (!defined('USER_INTEGRATION')) {
---

und hier Teil 2
---
    printf ("<b>%s</b><br /><br /><br />", $lang['online_users']);
  } // End defined('USER_INTEGRATION')
}
if ($action == "home_2") {
  $total_images = 0;
  $total_categories = 0;
  foreach ($cat_cache as $val) {
    $total_categories++;
    if (isset($val['num_images'])) {#
---

Gruß
Ingo

rinaldos

  • Guest
Re: Langsames ACP
« Reply #4 on: February 27, 2007, 01:13:09 PM »
:-)
Danke für die Antwort.

Habe nun mal Ivans Version eingebaut. Funktioniert genauso gut wie die Idee von Mawenzi. Aber woran kann es liegen das die Statistik Ausgaben so lange dauern? Vielleicht habe ich ja noch woanders einen Fehler. Auf jedenfall wird das ACP wieder schnell geladen :-)
Danke erstmal für die wundervolle kompetente Hilfe :-)

Gruß
Ingo

rinaldos

  • Guest
Re: Langsames ACP
« Reply #5 on: February 27, 2007, 05:07:53 PM »
Hallo Ivan,
dann liegt es mit dem MOD, YET ANOTHER STATISTIC also auch an den abfragen? Dann muss ich mir wohl eine schneller Statistik irgendwo suchen :-) Schauen wir mal was sich noch so anbietet.

Danke für die Antwort, dann suche ich da mal nicht weiter :-)

Gruß
Ingo

Offline trez

  • Hero Member
  • *****
  • Posts: 613
    • View Profile
    • blog / photography
Re: Langsames ACP
« Reply #6 on: February 27, 2007, 05:15:53 PM »
Hallo Ivan,
dann liegt es mit dem MOD, YET ANOTHER STATISTIC also auch an den abfragen? Dann muss ich mir wohl eine schneller Statistik irgendwo suchen :-) Schauen wir mal was sich noch so anbietet.

Danke für die Antwort, dann suche ich da mal nicht weiter :-)

Gruß
Ingo

Alle statistik mods arbeiten nach dem gleichen prinzip. Von daher, am besten keinen statistik mod verwenden, oder nur begrenzt aufrufen.