]> gitweb.fluxo.info Git - httruta.git/commitdiff
Coding style and minor fixes
authorSilvio Rhatto <rhatto@riseup.net>
Mon, 26 Aug 2013 01:04:26 +0000 (22:04 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Mon, 26 Aug 2013 01:04:26 +0000 (22:04 -0300)
config
lib/httracker/functions
scuttler

diff --git a/config b/config
index f692713c0c0c48f43786476f478dde369a0b26d9..37a4b917d7cce3b3cfdd20d0df91b4d5f2451929 100644 (file)
--- a/config
+++ b/config
@@ -9,3 +9,5 @@ USER="arquivo"
 GROUP="arquivo"
 DEPTH="2"
 EXT_DEPTH="1"
+SCUTTLE_USER="links"
+SCUTTLE_GROUP="links"
index 1a4fa7ffdf91119ee97b09d2898ffbbcd387d0ae..08852069723a985358472926deecf9fed49e2375 100644 (file)
@@ -3,6 +3,7 @@
 # Misc httracker functions.
 #
 
+# Set common httrack options
 function httracker_opts {
   OPTS=" --mirror                 \
          --continue               \
@@ -15,6 +16,7 @@ function httracker_opts {
          --path ${target}"
 }
 
+# Download URLs, mirror mode
 function httracker_get {
   # Options
   local url="$1"
@@ -54,13 +56,14 @@ function httracker_get {
   fi
 }
 
+# Download URLs, incremental mode
 function httracker_get_incremental {
-  # Creates target dir
+  # Create target dir
   year=`date +%Y`
   month=`date +%m`
   day=`date +%d`
   target=${MIRRORDIR}/${year}/${month}
-  sudo -u links mkdir -p ${target}
+  sudo -u ${USER} mkdir -p ${target}
 
   # Basic options
   httracker_opts
@@ -70,32 +73,33 @@ function httracker_get_incremental {
     OPTS="--user $USER"
   fi
 
-  # Grabs URLs from the network
-  httrack ${OPTS}                  \
-          --user links             \
-          --list ${URLS}           \
-          --path ${target}
+  # Grab URLs from the network
+  httrack ${OPTS} --list ${URLS}
 }
 
+# Get SemanticScuttle parameter
 function httracker_scuttle_config() {
   grep ${1} ${CONFIGFILE} | sed -e s/\[^\'\]\*\'// -e s/\'\.\*\$//
 }
 
+# Query a mysql database
 function httracker_sqlquery {
   mysql --skip-column-names --batch \
-        --user=${dbuser}          \
-        --password=${dbpass}      \
-        --database=${dbname}      \
-        --host=${dbhost}          \
+        --user=${DBUSER}          \
+        --password=${DBPASS}      \
+        --database=${DBNAME}      \
+        --host=${DBHOST}          \
         --execute="${1}"
 }
 
+# Iterate over all URLs
 function httracker_iterate {
   for link in `cat $URLS | xargs`; do
     httracker_get "$link"
   done
 }
 
+# Create basic folders
 function httracker_setup_folders {
   mkdir -p $MIRRORS $TMP
 
index d3d6c398561e64f21574705ccb6676e7764d1eef..2aa61a5c7b7d95f7913ad9009e99d81dab1ed4b9 100755 (executable)
--- a/scuttler
+++ b/scuttler
@@ -16,17 +16,17 @@ httracker_setup_folders
 BASEDIR=/var/sites/links
 SCUTTLEDIR=`basename $( find ${BASEDIR} -maxdepth 1 -iname "SemanticScuttle-*" | head -n 1 )`
 CONFIGFILE=${BASEDIR}/${SCUTTLEDIR}/data/config.php
-dbuser=`httracker_scuttle_config dbuser`
-dbpass=`httracker_scuttle_config dbpass`
-dbname=`httracker_scuttle_config dbname`
-dbhost=`httracker_scuttle_config dbhost`
+DBUSER=`httracker_scuttle_config dbuser`
+DBPASS=`httracker_scuttle_config dbpass`
+DBNAME=`httracker_scuttle_config dbname`
+DBHOST=`httracker_scuttle_config dbhost`
 
 # So we can run both applications in parallel
 URLS="$URLS_SCUTTLER"
 
 # Get URLs from database
 touch ${URLS}
-chown links.links ${URLS}
+chown ${SCUTTLE_USER}.${SCUTTLE_GROUP} ${URLS}
 chmod 600 ${URLS}
 httracker_sqlquery "select bAddress from sc_bookmarks;" > ${URLS}