Changeset 111


Ignore:
Timestamp:
03/27/2009 09:51:35 PM (3 years ago)
Author:
ofer
Message:

Changes for creating a "debug" build

Location:
trunk/WordPress/plugin/transposh
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WordPress/plugin/transposh

    • Property svn:ignore set to
      .project
  • trunk/WordPress/plugin/transposh/build.sh

    r66 r111  
    66 
    77VERSION=$1; 
     8DEBUG=$2; 
     9ZIPME=$3; 
    810 
    911if [ -z $VERSION ]; then 
    10     echo "Must enter a version number !!!" 
    11     echo "Usage: $0 0.1.0" 
    12     exit 
     12  echo "Must enter a version number !!!" 
     13  echo "Usage: $0 0.1.0 [[debug] zip]" 
     14  exit 
    1315fi 
    1416 
    1517TMP_DIR="tmp" 
    1618TRANSPOSH_DIR=$TMP_DIR/transposh 
    17  
    1819 
    1920echo "Building package for WordPress plugin version: $VERSION"; 
     
    3031# 
    3132for DIR in flags js; do 
    32     cp -r $DIR $TRANSPOSH_DIR 
    33     echo "added sub-directory $DIR" 
     33  cp -r $DIR $TRANSPOSH_DIR 
     34  echo "added sub-directory $DIR" 
    3435done; 
    3536echo 
     
    3940# 
    4041for FTYPE in css png txt; do 
    41     cp *.$FTYPE $TRANSPOSH_DIR 
    42     echo "added $FTYPE files" 
     42  cp *.$FTYPE $TRANSPOSH_DIR 
     43  echo "added $FTYPE files" 
    4344done; 
    4445echo 
     
    4748#Add php files while removing logging operations 
    4849# 
    49 echo "Adding .php files (without logging)" 
    50  
    51 for file in `find . -maxdepth 1 -iname '*.php' -printf "%p "`; do  
    52     sed "s/logger.*;//;s/require_once(\"logging.*//;s/<%VERSION%>/$VERSION/;" $file > $TRANSPOSH_DIR/$file 
    53     echo "added $file" 
    54 done; 
     50if [ "$DEBUG" != 'debug' ]; then 
     51  echo "Adding .php files (without logging)" 
     52  for file in `find . -maxdepth 1 -iname '*.php' -printf "%p "`; do  
     53  sed "s/logger.*;//;s/require_once(\"logging.*//;s/<%VERSION%>/$VERSION/;" $file > $TRANSPOSH_DIR/$file 
     54  echo "added $file" 
     55  done; 
     56else 
     57  echo "Adding .php files (with logging)" 
     58  cp *.php $TRANSPOSH_DIR 
     59fi 
    5560echo 
    5661 
     
    6469# Remove logging.php 
    6570# 
    66  
    67 rm $TRANSPOSH_DIR/logging.php 
    68 echo "removed logging.php" 
     71if [ "$DEBUG" != 'debug' ]; then 
     72  rm $TRANSPOSH_DIR/logging.php 
     73  echo "removed logging.php" 
     74else 
     75  rm $TRANSPOSH_DIR/screenshot*.png 
     76  echo "removed screenshots" 
     77fi 
    6978 
    7079# Remove .svn dirs 
    71 find tmp -name "*.svn*" -exec rm -rf {} \; 
     80find tmp -name "*.svn*" -exec rm -rf {} 2>/dev/null \; 
    7281echo "removed .svn dirs" 
    7382 
     
    7584#Generate zip file 
    7685#  
    77 #cd $TMP_DIR 
    78 #zip -r "transposh.$VERSION.zip" . 
    79 #cd - >/dev/null 
    80 #mv "$TMP_DIR/transposh.$VERSION.zip" .  
    81  
    82 #echo 
    83 #echo "transposh.$VERSION.zip is ready" 
     86if [ "$ZIPME" == 'zip' ]; then 
     87  cd $TMP_DIR 
     88  zip -rq "transposh.$VERSION.zip" . 
     89  cd - >/dev/null 
     90  mv "$TMP_DIR/transposh.$VERSION.zip" .  
     91  echo 
     92  echo "transposh.$VERSION.zip is ready" 
     93fi 
  • trunk/WordPress/plugin/transposh/logging.php

    r40 r111  
    11<?php 
    22/* 
    3  * Logging Utlis.  
     3 * Logging Utils. 
    44 */ 
    55 
     
    1313//Enable tracing level. 
    1414//0 - disabled. Higher numbers will show more debug information. 
    15 define ("DEBUG" , 0); 
     15define ("DEBUG" , 3); 
    1616 
    1717/* 
    18  * Print a message to log.  
     18 * Print a message to log. 
    1919 */ 
    20 function logger($msg, $severity=3)  
     20function logger($msg, $severity=3) 
    2121{ 
    2222    if($severity <= DEBUG) 
    2323    { 
    24         error_log(date(DATE_RFC822) . ": "  . $msg . "\n", 3,  "/var/tmp/transposh.log"); 
     24        error_log(date(DATE_RFC822) . ": "  . $msg . "\n", 3,  "/tmp/transposh.log"); 
    2525    } 
    2626} 
Note: See TracChangeset for help on using the changeset viewer.