comparison reloadarticle.php @ 3:0dcdb73cbcbf

Increased article body length to 16MB in database scheme, cleaned up the code, added a script to forcefully reload an individual article
author Ivo Smits <Ivo@UCIS.nl>
date Tue, 12 Apr 2011 01:47:09 +0200
parents
children 005339a1b2ce
comparison
equal deleted inserted replaced
2:40e545510a57 3:0dcdb73cbcbf
1 #!/usr/bin/php
2 <?php
3 chdir(__DIR__);
4 require_once './common.php';
5
6 if (count($_SERVER['argv']) < 2) die('Not enough arguments (usage: [server] [messageid])');
7 $messageid = $_SERVER['argv'][2];
8 $db->update('DELETE FROM `messages` WHERE `messageid` = ?', $messageid);
9 $socket = stream_socket_client($_SERVER['argv'][1]);
10 if ($socket === FALSE) die("Could not connect to peer\n");
11 $line = nntp_readline($socket);
12 $code = strtok($line, " \t");
13 if ($code == 200) {
14 } else if ($code == 201) {
15 } else die("Error code $code\n");
16 nntp_writeline($socket, 'ARTICLE <'.$messageid.'>');
17 $line = nntp_readline($socket);
18 $code = strtok($line, " \t");
19 if ($code != 220) die("Error code $code\n");
20 strtok(" \t"); //article number
21 $lines = nntp_readlines($socket);
22 nntp_article_store($lines);
23
24 function writelog($line) {
25 print($line."\n");
26 }