Permalink
Browse files

updated database so it includes time threads were added and added upd…

…ate sql; now sorts threads by board/timeadded/ID; will probably show time added on the interface in future and let you sort by each column
  • Loading branch information...
anon e moose anon e moose
anon e moose authored and anon e moose committed May 21, 2012
1 parent 4433fd8 commit 2e488498149e63299a91c56099117c62ee26de9f
Showing with 5 additions and 3 deletions.
  1. +2 −2 chan_archiver.php
  2. +1 −0 chanarchive-update2.sql
  3. +2 −1 chanarchive.sql
View
@@ -230,7 +230,7 @@ public function addThread( $threadid, $board, $description )
if ( $num > 0 )
return false;
// guess we don't, lets add it
- $query = mysql_query( sprintf( "INSERT INTO `Threads` ( `ID`, `Board`, `Status`, `LastChecked`, `Description` ) VALUES ( '%s', '%s', '1', '0', '%s' )", $threadid, $board, $description ) );
+ $query = mysql_query( sprintf( "INSERT INTO `Threads` ( `ID`, `Board`, `Status`, `LastChecked`, `Description`, `TimeAdded` ) VALUES ( '%s', '%s', '1', '0', '%s', '%s' )", $threadid, $board, $description, time() ) );
if ( !$query )
die( 'Could not add thread: ' . mysql_error() );
$this->closeDB();
@@ -289,7 +289,7 @@ public function getOngoingThreadCount()
public function getThreads()
{
$this->connectDB();
- $query = mysql_query( "SELECT * FROM `Threads`" );
+ $query = mysql_query( "SELECT * FROM `Threads` ORDER BY `Board`, `TimeAdded`, `ID` ASC" );
if ( !$query )
die( 'Could not query database: ' . mysql_error() );
$thrarray = array();
View
@@ -0,0 +1 @@
+ALTER TABLE `Threads` ADD `TimeAdded` INT( 15 ) NOT NULL
View
@@ -31,7 +31,8 @@ CREATE TABLE IF NOT EXISTS `Threads` (
`Board` varchar(10) COLLATE utf8_unicode_ci NOT NULL,
`Description` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`Status` tinyint(1) NOT NULL,
- `LastChecked` int(12) NOT NULL
+ `LastChecked` int(15) NOT NULL,
+ `TimeAdded` int(15) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
-- --------------------------------------------------------

0 comments on commit 2e48849

Please sign in to comment.