PHP Classes

File: SQL File

Recommend this page to a friend!
  Packages of Matthew Asham   Binkterm PHP   database/migrations/v1.10.11.1_recalc_filearea_stats.sql   Download  
File: database/migrations/v1.10.11.1_recalc_filearea_stats.sql
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: Binkterm PHP
Bulletin board system based on the Web
Author: By
Last change:
Date: 5 days ago
Size: 439 bytes
 

Contents

Class file image Download
-- Recalculate file_count and total_size for all file areas to fix stale counters -- (e.g. from files rejected by virus scanner without updating stats) UPDATE file_areas fa SET file_count = ( SELECT COUNT(*) FROM files WHERE file_area_id = fa.id AND status = 'approved' ), total_size = ( SELECT COALESCE(SUM(filesize), 0) FROM files WHERE file_area_id = fa.id AND status = 'approved' ), updated_at = NOW();