Changeset 21658


Ignore:
Timestamp:
03/17/13 20:32:17 (6 years ago)
Author:
mistic100
Message:

move update time from categories_table to category_filters_table

Location:
extensions/SmartAlbums
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • extensions/SmartAlbums/admin/cat_list.php

    r21358 r21658  
    2121    permalink, 
    2222    dir, 
    23     smart_update 
     23    cf.updated 
    2424  FROM '.CATEGORIES_TABLE.' AS cat 
    2525  INNER JOIN '.CATEGORY_FILTERS_TABLE.' AS cf 
    2626    ON cf.category_id = cat.id 
     27  GROUP BY id 
    2728  ORDER BY global_rank ASC 
    2829;'; 
     
    146147      'ID'          => $category['id'], 
    147148      'IMG_COUNT'   => !empty($categories_count_images[ $category['id'] ]) ? $categories_count_images[ $category['id'] ] : 0, 
    148       'LAST_UPDATE' => format_date($category['smart_update'], true), 
     149      'LAST_UPDATE' => format_date($category['updated'], true), 
    149150 
    150151      'U_JUMPTO'    => make_index_url(array('category' => $category)), 
  • extensions/SmartAlbums/include/functions.inc.php

    r19722 r21658  
    5252   
    5353  $query = ' 
    54 UPDATE '.CATEGORIES_TABLE.' 
    55   SET smart_update = NOW() 
    56   WHERE id = '.$cat_id.' 
     54UPDATE '.CATEGORY_FILTERS_TABLE.' 
     55  SET updated = NOW() 
     56  WHERE category_id = '.$cat_id.' 
    5757;'; 
    5858  pwg_query($query); 
     
    689689    INNER JOIN '.CATEGORY_FILTERS_TABLE.' AS cf 
    690690    ON c.id = cf.category_id 
    691   WHERE smart_update < DATE_SUB(NOW(), INTERVAL '.$conf['SmartAlbums']['update_timeout'].' DAY) 
     691  WHERE updated < DATE_SUB(NOW(), INTERVAL '.$conf['SmartAlbums']['update_timeout'].' DAY) 
    692692;'; 
    693693   
  • extensions/SmartAlbums/include/install.inc.php

    r21358 r21658  
    4646  `type` varchar(16) NOT NULL, 
    4747  `cond` varchar(16) NULL, 
    48   `value` text 
     48  `value` text NULL, 
     49  `updated` DATETIME NOT NULL DEFAULT "1970-01-01 00:00:00" 
    4950) ENGINE=MyISAM DEFAULT CHARSET=utf8 
    5051;'); 
     
    5758  } 
    5859   
    59   // new column on category table 
     60  // remove column on category table, moved to category filters table 
    6061  $result = pwg_query('SHOW COLUMNS FROM `' . CATEGORIES_TABLE . '` LIKE "smart_update";'); 
     62  if (pwg_db_num_rows($result)) 
     63  { 
     64    pwg_query('UPDATE `' . $prefixeTable . 'category_filters` AS f SET updated = ( SELECT smart_update FROM `' . CATEGORIES_TABLE . '` AS c WHERE c.id = f.category_id );'); 
     65    pwg_query('ALTER TABLE `' . CATEGORIES_TABLE . '` DROP `smart_update`;'); 
     66  } 
     67   
     68  // new column on category filters table 
     69  $result = pwg_query('SHOW COLUMNS FROM `' . $prefixeTable . 'category_filters` LIKE "updated";'); 
    6170  if (!pwg_db_num_rows($result)) 
    6271  {       
    63     pwg_query('ALTER TABLE `' . CATEGORIES_TABLE . '` ADD `smart_update` DATETIME NOT NULL;'); 
     72    pwg_query('ALTER TABLE `' . $prefixeTable . 'category_filters` ADD `updated` DATETIME NOT NULL DEFAULT "1970-01-01 00:00:00"'); 
    6473  } 
    6574   
  • extensions/SmartAlbums/maintain.inc.php

    r19446 r21658  
    2424  pwg_query('DROP TABLE `' . $prefixeTable . 'category_filters`;'); 
    2525  pwg_query('ALTER TABLE `' . IMAGE_CATEGORY_TABLE . '` DROP `smart`;'); 
    26   pwg_query('ALTER TABLE `' . CATEGORIES_TABLE . '` DROP `smart_update`;'); 
    2726  pwg_query('DELETE FROM `' . CONFIG_TABLE . '` WHERE param = \'SmartAlbums\' LIMIT 1;'); 
    2827} 
Note: See TracChangeset for help on using the changeset viewer.