X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=ext%2Faction_helpers%2Fphp%2FREADME.markdown;fp=ext%2Faction_helpers%2Fphp%2FREADME.markdown;h=ad677f66a94b4f10886ba535f8b8df59976cac02;hb=b87d2f4e68281062df1913440ca5753ae63314a9;hp=0000000000000000000000000000000000000000;hpb=ab0ea530b8ac956091f17b104ab2311336cfc250;p=packages%2Fprecise%2Fmcollective.git diff --git a/ext/action_helpers/php/README.markdown b/ext/action_helpers/php/README.markdown new file mode 100644 index 0000000..ad677f6 --- /dev/null +++ b/ext/action_helpers/php/README.markdown @@ -0,0 +1,38 @@ +A simple helper to assist with writing MCollective actions in PHP. + +Given an action as below: + +
+action "echo" do
+   validate :message, String
+
+   implemented_by "/tmp/echo.php"
+end
+
+ +The following PHP script will implement the echo action externally +replying with _message_ and _timestamp_ + +
+<?php
+    require("mcollective_action.php");
+
+    $mc = new MCollectiveAction();
+    $mc->message = $mc->data["message"];
+    $mc->timestamp = strftime("%c");
+    $mc->info("some text to info log on the server");
+?>
+
+ +Calling it with _mco rpc_ results in: + +
+$ mco rpc test echo message="hello world"
+Determining the amount of hosts matching filter for 2 seconds .... 1
+
+ * [ ============================================================> ] 1 / 1
+
+
+nephilim.ml.org                         : OK
+    {:message=>"hello world", :time=>"Tue Mar 15 19:20:53 +0000 2011"}
+