From c46e9a37675055f15da7900dfcc2f259f791758f Mon Sep 17 00:00:00 2001 From: Retro_Guy Date: Thu, 24 Dec 2020 20:12:50 -0700 Subject: [PATCH] Add script to build db for 0.6.7 and comments in INSTALL.md --- INSTALL.md | 12 ++++++--- build-overview-db.php | 60 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 build-overview-db.php diff --git a/INSTALL.md b/INSTALL.md index 1511db6..594ffc5 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -46,11 +46,17 @@ Upgrading: 1. Disable cron job and kill any running nntp servers (ps aux | grep nntp) -2. Run upgrade script and answer promts +2. BACKUP spool dir. Default example: 'cd /var/spool' then 'tar zcvf rslight.tgz rslight/*' -3. Compare upgrade config files in config dir /upgrade and change your exsiting config as necessary +3. Run upgrade script and answer prompts -4. Enable cron job and check that everything works after it runs the first time +4. Compare upgrade config files in config dir /upgrade and change your exsiting config as necessary + +5. If upgrading from a version prior to 0.6.7 it is REQUIRED to run the provided +script 'build-overview-db.php' at this point. Read the script for instructions. +NOTE: If upgrading and your spool dir does not include any files ending in .db3, you need to do this. + +6. Enable cron job and check that everything works after it runs the first time If you have trouble, post to rocksolid.nodes.help and we'll try to help. diff --git a/build-overview-db.php b/build-overview-db.php new file mode 100644 index 0000000..e5ffcd6 --- /dev/null +++ b/build-overview-db.php @@ -0,0 +1,60 @@ +prepare($sql); + $overviewfp = fopen($argv[1].'-overview', 'r'); + echo "Building $database"; + $i = 0; + while($data=fgets($overviewfp)) { + $parts=preg_split("/(:#rsl#:|\t)/", $data);; + $stmt->execute([$parts[0], $parts[1], $parts[2], $parts[3], $parts[4], $parts[5]]); + if($i++ > 100) { + echo '.'; + $i = 0; + } + } + echo "\nFinished.\n"; + fclose($overviewfp); + $dbh = null; + +function rslight_db_open($database, $table) { + try { + $dbh = new PDO('sqlite:'.$database); + } catch (PDOExeption $e) { + echo 'Connection failed: '.$e->getMessage(); + exit; + } + $dbh->exec("CREATE TABLE IF NOT EXISTS $table( + id INTEGER PRIMARY KEY, + newsgroup TEXT, + number TEXT, + msgid TEXT, + date TEXT, + name TEXT, + subject TEXT)"); + return($dbh); +} +?>