Changeset 1325

Show
Ignore:
Timestamp:
02/07/07 13:21:37 (2 years ago)
Author:
jm3
Message:

refactored perl and shell scripts so they all use the new config mechanism

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • feedmelinks/.t

    r395 r1325  
    1 <% 
     1<?php 
    22        include_once( "modules/utils.inc.php" ); 
    33        include( "$modules/header.insecure.inc.php" ); 
    4  
    5 $tok =  $_COOKIE["c_pass_token"]; 
    6 $u   =  $_COOKIE["c_uid"]; 
    7 $sessionUserId = $u; 
    84 
    95if( $tok && $tok == md5( getPasswdForUser( $u ))) { 
     
    2218 
    2319        conClose( $con_pageName ); 
    24 %
     20?
    2521 
    2622 
    2723 
    28 <% } %
     24<?php } ?
  • feedmelinks/_config/parse-config.xsl

    r1314 r1325  
    4646                                <xsl:for-each select="/servers/server[@name=$server-name]/@*"> 
    4747sub get_<xsl:value-of select="translate(name(.), '-', '_')" /> { 
    48         return "<xsl:value-of select="." />"
     48        return '<xsl:value-of select="." />'
    4949} 
    5050                                </xsl:for-each> 
  • feedmelinks/_config/servers-template.xml

    r1323 r1325  
    1818                webserver-root="/path/to/your/webserver/root" 
    1919                database-name="db_name" 
     20                database-user="db_username" 
     21                database-password="db_password" 
    2022                maintainer-email="you@whatevs.obvs.com" 
    2123                spamsafe-email="&nbsp;@&amp;encoded-somehow.com" 
     
    3739                webserver-root="/home/whatever/your/name/here/www/" 
    3840                database-name="db_name" 
     41                database-user="db_username" 
     42                database-password="db_password" 
    3943                maintainer-email="your-email@your-domain.com" 
    4044                spamsafe-email="somehow-obscured@domain.com" 
  • feedmelinks/bin/add-link.pl

    r1084 r1325  
    11#!/usr/local/bin/perl 
     2use FeedMeLinks::Environment; 
    23use strict; 
    34# takes an email as stdin, "authenticates" the sender against  
     
    2425my $tagName = "new"; 
    2526 
    26 open(LOG, ">>/home/fml/public_html/_logs/mail.log") or die "can't open file"; 
     27open(LOG, ">>" . get_webserver_root() . "/_logs/mail.log") or die "can't open file"; 
    2728print LOG "--- starting run ---\n" if( $verbose ); 
    2829 
     
    7475if( $headersDone && $title && $submitter && $link ) { 
    7576        print LOG "adding link to db\n" if( $verbose ); 
    76         my $dsn = "DBI:mysql:database=fml_fml;host=localhost"; # FIXME: need to retrieve this from our config arrays... 
    77         my $dbh = DBI->connect($dsn, "fml_fml", "fml"); 
     77        my $dsn = "DBI:mysql:database=" . get_database_name() . ";host=localhost"; # FIXME: need to retrieve this from our config arrays... 
     78        my $dbh = DBI->connect($dsn, get_database_user(), get_database_password() ); 
    7879 
    7980        if( ! $dbh ) { 
  • feedmelinks/bin/configure.sh

    r1314 r1325  
    1515xml="_config/servers.xml" 
    1616sp="stringparam" 
     17 
     18if [ ! -d "_config" ]; 
     19then 
     20        echo "Please run configure.sh from within your feedmelinks svn checkout directory." 
     21        exit 1 
     22fi 
     23 
     24if [ ! -f "$xml" ]; 
     25then 
     26        echo "First, copy servers-template.xml to servers.xml (in the _config) folder, and fill in the values for your database and server paths" 
     27        exit 1 
     28fi 
    1729 
    1830root=`xsltproc --$sp server-name $s --$sp mode atom --$sp atom webserver-root $xsl $xml` 
  • feedmelinks/bin/create-ddl.sh

    r1185 r1325  
    11#!/bin/sh 
    22 
    3 # export the table structure of the DB 
     3. env.sh # read in environment config vars  
    44 
    5 mysqldump -u fml_fml -pfml fml_fml --no-data 
     5# export the table structure of the whole DB 
     6mysqldump -u `get_database_user` -p`get_database_password` `get_database_name` --no-data 
    67 
  • feedmelinks/bin/heuristics.sh

    r1310 r1325  
    11#!/bin/sh 
    22# TODO: check for minima before building indices 
     3 
     4. env.sh 
    35 
    46if [ "$#" -lt 2 ] 
     
    4446 
    4547# db auth: 
    46 u=fml_fml 
    47 db=fml_fml 
    48 p=fml 
     48u=`get_database_user` 
     49db=`get_database_name` 
     50p=`get_database_password` 
    4951 
    5052for USER in $USERS 
  • feedmelinks/bin/snuff-these-users.sh

    r1310 r1325  
    11#!/bin/sh 
    2 # TODO: check for minima before building indices 
     2# snuff a list of users passed in on the command line 
     3# FIXME: REMEMBER that this does NOT privatize all their links, tags, etc. -- currently, only snuffing via php does that. 
     4 
     5. env.sh # read in environment config vars  
    36 
    47if [ "$#" -lt 1 ]  
     
    1215for user in $USERS 
    1316do 
    14         mysql -u fml_fml -pfml fml_fml -B -e "update linksUsers set snuffed  = 1 where linksUsers.userid = '$user';" 
    15         mysql -u fml_fml -pfml fml_fml -B -e "update linksUsers set disabled = 1 where linksUsers.userid = '$user';" 
     17        mysql -u `get_database_user` -p`get_database_password` `get_database_name` -B -e "update linksUsers set snuffed  = 1 where linksUsers.userid = '$user';" 
     18        mysql -u `get_database_user` -p`get_database_password` `get_database_name` -B -e "update linksUsers set disabled = 1 where linksUsers.userid = '$user';" 
    1619done 
    1720 
     21exit 0 
     22