Changeset 21801


Ignore:
Timestamp:
Mar 23, 2013, 11:02:04 AM (7 years ago)
Author:
rvelices
Message:

db changes for feature 2836 display # of comments/tags in menubar and feature 2557 recent photos should never be empty

Location:
trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions_user.inc.php

    r20545 r21801  
    460460INSERT IGNORE INTO '.USER_CACHE_TABLE.'
    461461  (user_id, need_update, cache_update_time, forbidden_categories, nb_total_images,
     462    last_photo_date,
    462463    image_access_type, image_access_list)
    463464  VALUES
    464465  ('.$userdata['id'].',\''.boolean_to_string($userdata['need_update']).'\','
    465466  .$userdata['cache_update_time'].',\''
    466   .$userdata['forbidden_categories'].'\','.$userdata['nb_total_images'].',\''
    467   .$userdata['image_access_type'].'\',\''.$userdata['image_access_list'].'\')';
     467  .$userdata['forbidden_categories'].'\','.$userdata['nb_total_images'].','.
     468  (empty($userdata['last_photo_date']) ? 'NULL': '\''.$userdata['last_photo_date'].'\'').
     469  ',\''.$userdata['image_access_type'].'\',\''.$userdata['image_access_list'].'\')';
    468470      pwg_query($query);
    469471    }
     
    679681 * @return array
    680682 */
    681 function get_computed_categories($userdata, $filter_days=null)
     683function get_computed_categories(&$userdata, $filter_days=null)
    682684{
    683685  $query = 'SELECT c.id AS cat_id, global_rank';
     
    703705
    704706  $query.= '
    705   GROUP BY c.id, c.global_rank';
     707  GROUP BY c.id';
    706708
    707709  $result = pwg_query($query);
    708710
     711  $userdata['last_photo_date'] = null;
    709712  $cats = array();
    710713  while ($row = pwg_db_fetch_assoc($result))
     
    714717    $row['count_images'] = (int)$row['nb_images'];
    715718    $row['max_date_last'] = $row['date_last'];
     719    if ($row['date_last'] > $userdata['last_photo_date'])
     720    {
     721      $userdata['last_photo_date'] = $row['date_last'];
     722    }
    716723
    717724    $cats += array($row['cat_id'] => $row);
     
    15161523            $sql_list[]=$table_prefix.'level<='.$user['level'];
    15171524          }
    1518           else if ( !empty($user['image_access_list']) and !empty($user['image_access_type']) )
     1525          elseif ( !empty($user['image_access_list']) and !empty($user['image_access_type']) )
    15191526          {
    15201527            $sql_list[]=$field_name.' '.$user['image_access_type']
  • trunk/install/piwigo_structure-mysql.sql

    r19548 r21801  
    353353  `forbidden_categories` mediumtext,
    354354  `nb_total_images` mediumint(8) unsigned default NULL,
     355  `last_photo_date` datetime DEFAULT NULL,
     356  `nb_available_tags` INT(5) DEFAULT NULL,
     357  `nb_available_comments` INT(5) DEFAULT NULL
    355358  `image_access_type` enum('NOT IN','IN') NOT NULL default 'NOT IN',
    356359  `image_access_list` mediumtext default NULL,
     
    417420  `level` tinyint unsigned NOT NULL default '0',
    418421  `activation_key` char(20) default NULL,
    419   UNIQUE KEY `user_infos_ui1` (`user_id`)
     422  PRIMARY KEY (`user_id`)
    420423) ENGINE=MyISAM;
    421424
Note: See TracChangeset for help on using the changeset viewer.