Changeset 17002 for trunk/admin/include
- Timestamp:
- Jul 25, 2012, 12:20:40 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/functions.php
r16167 r17002 1508 1508 pwg_query($query); 1509 1509 1510 $query = ' 1511 SELECT 1512 category_id, 1513 MAX(rank) AS max_rank 1514 FROM '.IMAGE_CATEGORY_TABLE.' 1515 WHERE rank IS NOT NULL 1516 AND category_id IN ('.implode(',', $categories).') 1517 GROUP BY category_id 1518 ;'; 1519 1520 $current_rank_of = simple_hash_from_query( 1521 $query, 1522 'category_id', 1523 'max_rank' 1524 ); 1525 1510 1526 $inserts = array(); 1511 1527 foreach ($categories as $category_id) 1512 1528 { 1529 if (!isset($current_rank_of[$category_id])) 1530 { 1531 $current_rank_of[$category_id] = 0; 1532 } 1533 1513 1534 foreach ($images as $image_id) 1514 1535 { 1536 $rank = ++$current_rank_of[$category_id]; 1537 1515 1538 array_push( 1516 1539 $inserts, … … 1518 1541 'image_id' => $image_id, 1519 1542 'category_id' => $category_id, 1543 'rank' => $rank, 1520 1544 ) 1521 1545 ); … … 2342 2366 function delete_element_derivatives($infos, $type='all') 2343 2367 { 2368 file_put_contents('/tmp/pwg24ws.log', "\n==== ".date('c')."\n".__FUNCTION__.' : '.var_export($infos, true)."\n", FILE_APPEND); 2344 2369 $path = $infos['path']; 2345 2370 if (!empty($infos['representative_ext']))
Note: See TracChangeset
for help on using the changeset viewer.