Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

* get port from local-*.ini file

 * build POST request
  • Loading branch information...
commit 6049283fba6e2586e6fffc08a3b29219c7a9db55 1 parent 7ec9ac0
Till! authored March 04, 2010

Showing 1 changed file with 24 additions and 1 deletion. Show diff stats Hide diff stats

  1. 25  couchdb/couchdb-lounge/run-compaction
25  couchdb/couchdb-lounge/run-compaction
@@ -45,6 +45,29 @@
45 45
  */
46 46
 
47 47
 
  48
+$username = '';
  49
+$password = '';
  50
+$database = '';
  51
+$server   = 'localhost';
  52
+
48 53
 foreach (glob('/couchdb/couchdb/etc/couchdb/local-*') as $file) {
49  
-    echo basename($file) . "\n";
  54
+    $port = basename($file);
  55
+    $port = str_replace('local-', '', $port);
  56
+    $port = str_replace('.ini', '', $port);
  57
+
  58
+    $compact = "http://{$server}:{$port}/{$database}/_compact";
  59
+
  60
+    $req = new HTTP_Request2;
  61
+    $req->setUrl($compact)
  62
+        ->setMethod(HTTP_Request2::METHOD_POST);
  63
+
  64
+    if (!empty($username)) {
  65
+        $req->setAuth($username, $password);
  66
+    }
  67
+
  68
+    $resp = $req->send();
  69
+
  70
+    $status = json_decode($resp->getBody());
  71
+
  72
+    var_dump($status);    
50 73
 }

0 notes on commit 6049283

Please sign in to comment.
Something went wrong with that request. Please try again.