Timeout bei Aufruf der Frontend-Gruppenberechtigungen
Timeout bei Aufruf der Frontend-Gruppenberechtigungen
Hallo
Mit Contenido 4.8.7 kriege ich beim Aufruf der Frontend-Berechtigungen einer Gruppe einen Timeout.
[05-Aug-2008 06:14:49] PHP Fatal error: Maximum execution time of 30 seconds exceeded in /xxx/xxx/xxx/contenido/includes/functions.general.php on line 761
Mit Contenido 4.8.7 kriege ich beim Aufruf der Frontend-Berechtigungen einer Gruppe einen Timeout.
[05-Aug-2008 06:14:49] PHP Fatal error: Maximum execution time of 30 seconds exceeded in /xxx/xxx/xxx/contenido/includes/functions.general.php on line 761
-
- Beiträge: 3626
- Registriert: Di 12. Okt 2004, 20:00
- Wohnort: Voerde (Niederrhein)
- Kontaktdaten:
Habe folgendes gerade im SVN eingecheckt:
Datei "contenido/plugins/frontendlogic/category/category.php" ändern zu:
Gleiche Liste wird bei mir dann in 0,07 Sekunden erzeugt.
Datei "contenido/plugins/frontendlogic/category/category.php" ändern zu:
Code: Alles auswählen
<?php
/**
* Project:
* Contenido Content Management System
*
* Description:
*
* Requirements:
* @con_php_req 5.0
*
*
* @package Contenido Backend classes
* @version 1.1.1
* @author Andreas Lindner, Unknown
* @copyright four for business AG <www.4fb.de>
* @license http://www.contenido.org/license/LIZENZ.txt
* @link http://www.4fb.de
* @link http://www.contenido.org
*
* {@internal
* created
* modified 2008-08-06, Ingo van Peeren - replaced genericdb-code due to performance issues (ticket #)
*
* $Id:
* }}
*
*/
if(!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
cInclude("classes", "class.frontend.logic.php");
class frontendlogic_category extends FrontendLogic
{
function getFriendlyName ()
{
return i18n("Category", "frontendlogic_category");
}
function listActions ()
{
$actions = array();
$actions["access"] = i18n("Access category", "frontendlogic_category");
return ($actions);
}
function listItems ()
{
global $lang, $db, $cfg;
if (!is_object($db)) {
$db = new DB_Contenido;
}
$sSQL = "SELECT
b.idcatlang,
b.name,
c.level
FROM
".$cfg['tab']['cat']." AS a,
".$cfg['tab']['cat_lang']." AS b,
".$cfg['tab']['cat_tree']." AS c
WHERE
a.idcat = b.idcat AND
a.idcat = c.idcat AND
b.idlang = ".$lang." AND
b.public = 0
ORDER BY c.idtree ASC";
$db->query($sSQL);
while ($db->next_record()) {
$items[$db->f("idcatlang")] =
'<span style="padding-left: '.($db->f("level")*10).'px;">'.htmldecode($db->f("name")).'</span>';
}
return ($items);
}
}
?>
-
- Beiträge: 3626
- Registriert: Di 12. Okt 2004, 20:00
- Wohnort: Voerde (Niederrhein)
- Kontaktdaten:
Das Problem tritt anscheinend durch das Hinzufügen des 2. JOIN auf:
Code: Alles auswählen
$cApiCategoryCollection->link("cApiCategoryTreeCollection");
-
- Beiträge: 3626
- Registriert: Di 12. Okt 2004, 20:00
- Wohnort: Voerde (Niederrhein)
- Kontaktdaten:
OK, fieser Bug. Aber wo ganz anders: "contenido/classes/drivers/mysql/class.gdb.mysql.php".
Die Methode "buildJoinQuery" macht folgendes:
Das ist resultiert dann in einem
Die Methode "buildJoinQuery" macht folgendes:
Code: Alles auswählen
$join = "LEFT JOIN $destinationTable AS $destinationClass ON " . Contenido_Security::toInteger($sourceClass.$primaryKey) . " = " . Contenido_Security::toInteger($destinationClass.$primaryKey);
Code: Alles auswählen
ON 0 = 0
-
- Beiträge: 3626
- Registriert: Di 12. Okt 2004, 20:00
- Wohnort: Voerde (Niederrhein)
- Kontaktdaten:
OK, sehe gerade, das ist im SVN schon gefixt.
"contenido/classes/drivers/mysql/class.gdb.mysql.php" ändern in:
"contenido/classes/drivers/mysql/class.gdb.mysql.php" ändern in:
Code: Alles auswählen
<?php
/**
* Project:
* Contenido Content Management System
*
* Description:
* MySQL Driver for GenericDB
*
* Requirements:
* @con_php_req 5.0
*
*
* @package Contenido Backend classes
* @version 1.12
* @author Bjoern Behrens
* @copyright four for business AG <www.4fb.de>
* @license http://www.contenido.org/license/LIZENZ.txt
* @link http://www.4fb.de
* @link http://www.contenido.org
*
* {@internal
* created 2006-05-10
* modified 2008-05-23 Added Debug_DevNull and Debug_VisibleAdv
*
* $Id: class.gdb.mysql.php 659 2008-08-04 22:17:55Z HerrB $
* }}
*
*/
if(!defined('CON_FRAMEWORK')) {
die('Illegal call');
}
cInclude("classes", 'drivers/class.gdb.driver.php');
cInclude("classes", "class.security.php");
class gdbMySQL extends gdbDriver
{
function buildJoinQuery ($destinationTable, $destinationClass, $destinationPrimaryKey, $sourceClass, $primaryKey)
{
// Build a regular LEFT JOIN
$field = "$destinationClass.$destinationPrimaryKey";
$tables = "";
$join = "LEFT JOIN $destinationTable AS $destinationClass ON " .
Contenido_Security::toString($sourceClass . "." . $primaryKey) . " = " .
Contenido_Security::toString($destinationClass . "." . $primaryKey);
$where = "";
return array("field" => $field, "table" => $tables, "join" => $join, "where" => $where);
}
function buildOperator ($sField, $sOperator, $sRestriction)
{
$sOperator = strtolower($sOperator);
$sWhereStatement = "";
switch ($sOperator)
{
case "matchbool":
$sqlStatement = "MATCH (%s) AGAINST ('%s' IN BOOLEAN MODE)";
$sWhereStatement = sprintf($sqlStatement, $sField, $this->_oItemClassInstance->_inFilter($sRestriction));
break;
case "match":
$sqlStatement = "MATCH (%s) AGAINST ('%s')";
$sWhereStatement = sprintf($sqlStatement, $sField, $this->_oItemClassInstance->_inFilter($sRestriction));
break;
case "like":
$sqlStatement = "%s LIKE '%%%s%%'";
$sWhereStatement = sprintf($sqlStatement, Contenido_Security::toString($sField), $this->_oItemClassInstance->_inFilter($sRestriction));
break;
case "likeleft":
$sqlStatement = "%s LIKE '%s%%'";
$sWhereStatement = sprintf($sqlStatement, Contenido_Security::toString($sField), $this->_oItemClassInstance->_inFilter($sRestriction));
break;
case "likeright":
$sqlStatement = "%s LIKE '%%%s'";
$sWhereStatement = sprintf($sqlStatement, Contenido_Security::toString($sField), $this->_oItemClassInstance->_inFilter($sRestriction));
break;
case "notlike":
$sqlStatement = "%s NOT LIKE '%%%s%%'";
$sWhereStatement = sprintf($sqlStatement, Contenido_Security::toString($sField), $this->_oItemClassInstance->_inFilter($sRestriction));
break;
case "notlikeleft":
$sqlStatement = "%s NOT LIKE '%s%%'";
$sWhereStatement = sprintf($sqlStatement, Contenido_Security::toString($sField), $this->_oItemClassInstance->_inFilter($sRestriction));
break;
case "notlikeright":
$sqlStatement = "%s NOT LIKE '%%%s'";
$sWhereStatement = sprintf($sqlStatement, Contenido_Security::toString($sField), $this->_oItemClassInstance->_inFilter($sRestriction));
break;
case "diacritics":
cInclude("classes", "class.chartable.php");
if (!is_object($GLOBALS["_cCharTable"]))
{
$GLOBALS["_cCharTable"] = new cCharacterConverter;
}
$aliasSearch = array ();
$metaCharacters = array ("*", "[", "]", "^", '$', "\\", "*", "'", '"', '+');
for ($i = 0; $i < strlen($sRestriction); $i ++)
{
$char = substr($sRestriction, $i, 1);
$aliases = array ();
$aliases = array_merge($aliases, $GLOBALS["_cCharTable"]->fetchDiacriticCharactersForNormalizedChar($this->_sEncoding, $char));
$normalizedChars = $GLOBALS["_cCharTable"]->fetchNormalizedCharsForDiacriticCharacter($this->_sEncoding, $char);
foreach ($normalizedChars as $normalizedChar)
{
$aliases = array_merge($aliases, $GLOBALS["_cCharTable"]->fetchDiacriticCharactersForNormalizedChar($this->_sEncoding, $normalizedChar));
}
$aliases = array_merge($aliases, $normalizedChars);
if (count($aliases) > 0)
{
$aliases[] = $char;
$allAliases = array ();
foreach ($aliases as $alias)
{
$alias1 = $this->_oItemClassInstance->_inFilter($alias);
$allAliases[] = $alias1;
$allAliases[] = $alias;
}
$allAliases = array_unique($allAliases);
$aliasSearch[] = "(".implode("|", $allAliases).")";
} else
{
$addChars = array();
if (in_array($char, $metaCharacters))
{
$addChars[] = "\\\\".$char;
} else
{
$addChars[] = $char;
$vChar = $this->_oItemClassInstance->_inFilter($char);
if ($char != $vChar)
{
if (in_array($vChar, $metaCharacters))
{
$addChars[] = "\\\\".$vChar;
} else {
$addChars[] = $vChar;
}
}
}
$aliasSearch[] = "(".implode("|", $addChars).")";
}
}
$restriction = "'".implode("", $aliasSearch)."'";
$sWhereStatement = implode(" ", array ($sField, "REGEXP", $restriction));
break;
case "fulltext":
break;
case "in":
if (is_array($sRestriction))
{
$items = array();
foreach ($sRestriction as $key => $sRestrictionItem)
{
$items[] = "'".$this->_oItemClassInstance->_inFilter($sRestrictionItem)."'";
}
$sRestriction = implode(", ", $items);
} else {
$sRestriction = "'" . $sRestriction ."'";
}
$sWhereStatement = implode(" ", array($sField, "IN (", $sRestriction, ")"));
break;
default :
$sRestriction = "'".$this->_oItemClassInstance->_inFilter($sRestriction)."'";
$sWhereStatement = implode(" ", array ($sField, $sOperator, $sRestriction));
}
return $sWhereStatement;
}
}
?>