mirror of
https://github.com/Piwigo/Piwigo.git
synced 2025-04-29 12:49:57 +03:00
- feature 832: Folders with no images sql optimization
- recent pics are sorted by date descending, and only then by conf['order_by'] - updated prototype.js to version 1.6 git-svn-id: http://piwigo.org/svn/trunk@2424 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
154420540b
commit
f9927090e0
4 changed files with 3819 additions and 2860 deletions
|
@ -88,6 +88,8 @@ while ($row = mysql_fetch_assoc($result))
|
||||||
}
|
}
|
||||||
else if ($conf['allow_random_representative'])
|
else if ($conf['allow_random_representative'])
|
||||||
{// searching a random representant among elements in sub-categories
|
{// searching a random representant among elements in sub-categories
|
||||||
|
if ($row['count_images']>0)
|
||||||
|
{
|
||||||
$query = '
|
$query = '
|
||||||
SELECT image_id
|
SELECT image_id
|
||||||
FROM '.CATEGORIES_TABLE.' AS c INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic
|
FROM '.CATEGORIES_TABLE.' AS c INNER JOIN '.IMAGE_CATEGORY_TABLE.' AS ic
|
||||||
|
@ -113,10 +115,13 @@ SELECT image_id
|
||||||
list($image_id) = mysql_fetch_row($subresult);
|
list($image_id) = mysql_fetch_row($subresult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ // searching a random representant among representant of sub-categories
|
{ // searching a random representant among representant of sub-categories
|
||||||
|
if ($row['count_categories']>0 and $row['count_images']>0)
|
||||||
|
{
|
||||||
$query = '
|
$query = '
|
||||||
SELECT representative_picture_id
|
SELECT representative_picture_id
|
||||||
FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.'
|
FROM '.CATEGORIES_TABLE.' INNER JOIN '.USER_CACHE_CATEGORIES_TABLE.'
|
||||||
ON id = cat_id and user_id = '.$user['id'].'
|
ON id = cat_id and user_id = '.$user['id'].'
|
||||||
WHERE uppercats LIKE \''.$row['uppercats'].',%\'
|
WHERE uppercats LIKE \''.$row['uppercats'].',%\'
|
||||||
|
@ -131,13 +136,14 @@ SELECT representative_picture_id
|
||||||
).'
|
).'
|
||||||
ORDER BY RAND()
|
ORDER BY RAND()
|
||||||
LIMIT 0,1
|
LIMIT 0,1
|
||||||
;';
|
;';
|
||||||
$subresult = pwg_query($query);
|
$subresult = pwg_query($query);
|
||||||
if (mysql_num_rows($subresult) > 0)
|
if (mysql_num_rows($subresult) > 0)
|
||||||
{
|
{
|
||||||
list($image_id) = mysql_fetch_row($subresult);
|
list($image_id) = mysql_fetch_row($subresult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (isset($image_id))
|
if (isset($image_id))
|
||||||
{
|
{
|
||||||
|
|
|
@ -394,6 +394,15 @@ SELECT image_id
|
||||||
// +-----------------------------------------------------------------------+
|
// +-----------------------------------------------------------------------+
|
||||||
else if ($page['section'] == 'recent_pics')
|
else if ($page['section'] == 'recent_pics')
|
||||||
{
|
{
|
||||||
|
if ( !isset($page['super_order_by']) )
|
||||||
|
{
|
||||||
|
$conf['order_by'] = str_replace(
|
||||||
|
'ORDER BY ',
|
||||||
|
'ORDER BY date_available DESC,',
|
||||||
|
$conf['order_by']
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$query = '
|
$query = '
|
||||||
SELECT DISTINCT(id)
|
SELECT DISTINCT(id)
|
||||||
FROM '.IMAGES_TABLE.'
|
FROM '.IMAGES_TABLE.'
|
||||||
|
|
2908
tools/prototype.js
vendored
2908
tools/prototype.js
vendored
File diff suppressed because it is too large
Load diff
|
@ -153,7 +153,7 @@ function pwgSelectMethod(methodName)
|
||||||
function onSuccess_getMethodDetails(transport)
|
function onSuccess_getMethodDetails(transport)
|
||||||
{
|
{
|
||||||
var result = pwgGetJsonResult(transport);
|
var result = pwgGetJsonResult(transport);
|
||||||
fillNewMethod( gCachedMethods[result.name] = $H(result) );
|
fillNewMethod( gCachedMethods[result.name] = result );
|
||||||
}
|
}
|
||||||
|
|
||||||
function fillNewMethod(method)
|
function fillNewMethod(method)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue