From e3aff8b7ee9619e7f535509457547b4d51de37f3 Mon Sep 17 00:00:00 2001 From: Kai Hendry Date: Thu, 18 Jul 2013 20:48:03 +0800 Subject: [PATCH] Slow migration from shell to PHP. Sad I know. --- create.php | 46 ++++++++++++++++++++++++++++++++++++++++++++++ fetch-tweets.sh | 1 + 2 files changed, 47 insertions(+) create mode 100755 create.php diff --git a/create.php b/create.php new file mode 100755 index 0000000..fa7ab7a --- /dev/null +++ b/create.php @@ -0,0 +1,46 @@ + + + + + + + Fetching tweets of <?php echo $id; ?> + + + +
+
+ +Attempting to update $id"; +} else { + if (!mkdir("u/$id", 0777, true)) { + die("Failed to create u/$id directory."); + } +} + +chdir("u/$id"); +symlink ("../../index.html", "index.html"); +symlink ("../../grep.php", "grep.php"); + +if (strpos($id, '_') !== false) { +echo "

Goto http://$HTTP_HOST/u/$id to grep!

"; +} else { +echo "

Goto http://$id.$HTTP_HOST to grep!

"; +} + +symlink ("$id.txt", "tweets.txt"); +echo `sed -e "s,TIMESTAMP,$(date)," ../../greptweet.appcache > greptweet.appcache`; + +echo "
";
+echo `../../fetch-tweets.sh $id & disown`;
diff --git a/fetch-tweets.sh b/fetch-tweets.sh
index 1cc1c80..bd04824 100755
--- a/fetch-tweets.sh
+++ b/fetch-tweets.sh
@@ -1,5 +1,6 @@
 #!/usr/bin/env bash
 # vim: set ts=4 sw=4
+exec 2>&1
 
 if test -d lock
 then