Ignore:
Timestamp:
11/14/2009 4:28:52 AM (4 years ago)
Author:
lowjoel
Message:

Make sure only that the last 3 nightly builds are available at any one time.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/website/scripts/downloads.php

    r1312 r1313  
    217217        } 
    218218         
     219        //Insert the build into the database. 
    219220        mysql_query('START TRANSACTION'); 
    220221        mysql_query(sprintf('INSERT INTO downloads (Name, Released, `Type`, Version, PublisherID, Architecture, Filesize, Link) 
     
    237238         
    238239        mysql_query('COMMIT'); 
     240         
     241        //Ensure that only 3 builds are not superseded at any one time. 
     242        mysql_query('START TRANSACTION'); 
     243        mysql_query(sprintf('UPDATE downloads SET Superseded=1 
     244            WHERE Name LIKE \'%s%%\'', $path)); 
     245        mysql_query(sprintf('UPDATE downloads SET Superseded=0 
     246            WHERE Name LIKE \'%s%%\' 
     247            ORDER BY DownloadID DESC 
     248            LIMIT 3', $path)); 
     249        mysql_query('COMMIT'); 
     250 
    239251        return $buildId; 
    240252    } 
Note: See TracChangeset for help on using the changeset viewer.