Thread Mail-Benachrichtigung oder RSS ... (22 answers)
Opened by lux at 2008-04-10 10:33

Hagen
 2008-04-24 13:09
#108807 #108807
User since
2007-09-06
233 Artikel
BenutzerIn
[default_avatar]
lux+2008-04-24 05:36:30--
Hagen+2008-04-23 09:30:05--
Wie lange wird denn diese 'Berechnung' gespeichert?

Das hängt von der Datenbank und der Konfiguration ab.


Kannst du mir mal ein Stichwort geben, wonach ich dafür suchen muss? Mich würde das vor allem für eine MySQL-DB interessieren.

Bzgl. den Joins in der DB-Abfrage für den RSS-Feed habe ich nichts gefunden, ob die besser sind oder nicht.

Die Abfrage habe ich wie folgt geändert:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
### SQL ###
        my $sql = "SELECT boards.id as board_id, threads.id as thread_id, messages.position as position, boards.name as board_name, threads.title as thread_title, messages.message_raw as message_raw";
        $sql .=   " FROM $PBoard::Config::DbTables{boards} AS boards,";
        $sql .=   " $PBoard::Config::DbTables{threads} as threads,";
        $sql .=   " $PBoard::Config::DbTables{messages} as messages,";
        $sql .=   " $PBoard::Config::DbTables{user_groups} as user_groups";
        $sql .=   " WHERE messages.thread = threads.id AND threads.boardID = boards.id";        
        $sql .=   " AND messages.status != 'deleted' AND threads.status != 'onhold' AND threads.status != 'deleted'";
        $sql .=   " AND boards.groupRequired <= 2 AND user_groups.level = 'user'";
        $sql .=   " AND boards.id = ?" if $board_id;
        $sql .=   " AND threads.id = ?" if $thread_id;
        $sql .=   " AND messages.authorId = ?" if $user_id;
        $sql .=   " AND ((UNIX_TIMESTAMP(NOW()) - UNIX_TIMESTAMP(messages.posttime)) <= (? * 24 * 60 * 60))" if lc($action) eq lc('lastMessagesDays');
        $sql .=   " AND messages.position = '1'" if lc($filter) eq 'no_replies';
        $sql .=   " ORDER BY messages.posttime DESC";
        $sql .=   " LIMIT ?";

        my @placeholders;
        push @placeholders, $board_id       if $board_id;
        push @placeholders, $thread_id      if $thread_id;
        push @placeholders, $user_id        if $user_id;
        push @placeholders, $last_entries   if lc($action) eq lc('lastMessagesDays');
        if (lc($action) eq lc('lastMessagesDays'))        { push @placeholders, $max_entries; } # if
        elsif (lc($action) eq lc('lastMessagesNumbers'))  { push @placeholders, $last_entries; } # if
        else                                              { push @placeholders, $max_entries; } # ifelse

        if ($debug) {
                print "\n\n$sql\n\n";
                foreach my $item (@placeholders) { print "-->".$item."\n";      
                } # foreach
        } # if

### DB ###
        my $storage = PBoard::Storage->new( { dbh => undef } );
        my $poard = PBoard->new( { cgi => $cgi, storage => $storage } );
        my $dbh = PBoard::DB::ConnectToDB( $poard );
        $storage->set_dbh( $dbh );
        my $sth = &PBoard::DB::FireSql( $poard, $sql, @placeholders );

### Feed erzeugen ###


Also die Abfrage nach 'groupRequired' und die Platzhalter wurden ergänzt.


Zusätzlich habe ich am Anfang noch
Code (perl): (dl )
1
2
3
        # thread_id prüfen
        $thread_id = 0 if ($thread_id !~ m|^[0-9]*$|) || ($thread_id < 0);
        $board_id = 0 if $thread_id;
eingefügt (Zeile 3).
Gruß
Hagen

View full thread Mail-Benachrichtigung oder RSS ...