add explicit installation 'test' dir subfolder
authorMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Mon, 15 Sep 2014 05:41:28 +0000 (07:41 +0200)
committerMatteo Nastasi (mop) <nastasi@alternativeoutput.it>
Mon, 15 Sep 2014 05:41:28 +0000 (07:41 +0200)
INSTALL.sh
web/Obj/curl-de-sac.phh
webtest/cds_test01.php

index 670329e..e8de2f7 100755 (executable)
@@ -274,15 +274,19 @@ for i in $(find web -type d | grep '/' | sed 's/^....//g'); do
     install -d ${web_path}/$i 
 done
 
-for i in $(find web -name '.htaccess' -o -name '*.php' -o -name '*.phh' -o -name '*.pho' -o -name '*.css' -o -name '*.js' -o -name '*.mp3' -o -name '*.swf' -o -name 'terms-of-service*' | sed 's/^....//g'); do
+for i in $(find web -name '.htaccess' -o -name '*.php' -o -name '*.phh' -o -name '*.pho' -o -name '*.html' -o -name '*.css' -o -name '*.js' -o -name '*.mp3' -o -name '*.swf' -o -name 'terms-of-service*' | sed 's/^....//g'); do
     install -m 644 "web/$i" "${web_path}/$i"
 done
 if [ "$test_add" = "TRUE" ]; then
-    for i in $(find webtest -name '.htaccess' -o -name '*.phh' -o -name '*.pho' -o -name '*.css' -o -name '*.js' -o -name '*.mp3' -o -name '*.swf' -o -name 'terms-of-service*' | sed 's/^........//g'); do
-        install -m 644 "webtest/$i" "${web_path}/$i"
+    for i in $(find webtest -type d | grep '/' | sed 's/^........//g'); do
+        install -d ${web_path}/test/$i
+    done
+
+    for i in $(find webtest -name '.htaccess' -o -name '*.phh' -o -name '*.pho' -o -name '*.html' -o -name '*.css' -o -name '*.js' -o -name '*.mp3' -o -name '*.swf' -o -name 'terms-of-service*' | sed 's/^........//g'); do
+        install -m 644 "webtest/$i" "${web_path}/test/$i"
     done
     for i in $(find webtest -name '*.php' | sed 's/^........//g'); do
-        install -m 755 "webtest/$i" "${web_path}/$i"
+        install -m 755 "webtest/$i" "${web_path}/test/$i"
     done
 fi
 
index 01ba78b..c66c58b 100644 (file)
@@ -67,16 +67,23 @@ class CDS_cmd_cls {
         $this->cds = $cds;
     }
 
-    static function pre_create($cds, $url)
+    static function pre_create($cds, $url, $opts=NULL)
     {
         if ($cds->dbg_get() > 2) { printf("CURL: curl_init\n"); }
         if (($ch = curl_init()) == FALSE)
             return FALSE;
         curl_setopt($ch, CURLOPT_URL, $url);
-        curl_setopt($ch, CURLOPT_HEADER, 0);
-        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
-        curl_setopt($ch, CURLOPT_FORBID_REUSE, true);
-        curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: close'));
+        if ($opts == NULL) {
+            curl_setopt($ch, CURLOPT_HEADER, 0);
+            curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
+            curl_setopt($ch, CURLOPT_FORBID_REUSE, true);
+            curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: close'));
+        }
+        else {
+            foreach($opts as $opt => $value) {
+                curl_setopt($ch, $opt, $value);
+            }
+        }
         return ($ch);
     }
 
index eeaa97c..8183449 100755 (executable)
@@ -4,7 +4,7 @@
 define('WEB_URL', 'http://localhost/curl-de-sac');
 define('DBG_LEVEL', 0);
 
-require_once('Obj/curl-de-sac.phh');
+require_once('../Obj/curl-de-sac.phh');
 
 class short_cmd extends CDS_cmd {
     var $short_data;
@@ -196,7 +196,7 @@ function main()
 
          if ($i == 2) {
             printf("MAIN: load 'short'\n");
-            if ($cds->execute("short", WEB_URL.'/short.php') == FALSE) {
+            if ($cds->execute("short", WEB_URL.'/test/short.php') == FALSE) {
                 printf("MAIN: push 'short' command failed\n");
                 exit(123);
             }
@@ -204,7 +204,7 @@ function main()
 
          if ($i == 3) {
             printf("MAIN: load 'short'\n");
-            if ($cds->execute("short", WEB_URL.'/short.php') == FALSE) {
+            if ($cds->execute("short", WEB_URL.'/test/short.php') == FALSE) {
                 printf("MAIN: push 'short' command failed\n");
                 exit(123);
             }
@@ -212,7 +212,7 @@ function main()
 
         if ($i == 4) {
             printf("MAIN: load 'long'\n");
-            if ($cds->execute("long", WEB_URL.'/long.php') == FALSE) {
+            if ($cds->execute("long", WEB_URL.'/test/long.php') == FALSE) {
                 printf("MAIN: push 'long' command failed\n");
                 exit(123);
             }