Permalink
Browse files

Long process monitors driver and commands.

  • Loading branch information...
1 parent 1358c2d commit 4f95b7c4ab004715b069d875e940d02170f7da2f @PSF1 committed Aug 30, 2015
@@ -0,0 +1,66 @@
+<?php
+
+/*
+ * Pharinix Copyright (C) 2015 Pedro Pelaez <aaaaa976@gmail.com>
+ * Sources https://github.com/PSF1/pharinix
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+if (!defined("CMS_VERSION")) { header("HTTP/1.0 404 Not Found"); die(""); }
+
+if (!class_exists("commandLPClose")) {
+ class commandLPClose extends driverCommand {
+
+ public static function runMe(&$params, $debug = true) {
+ $params = array_merge(array(
+ 'id' => '',
+ ), $params);
+
+ include_once 'etc/drivers/longProcessMonitor.php';
+ return array('ok' => driverLPMonitor::close($params['id']));
+ }
+
+ public static function getHelp() {
+ return array(
+ "package" => 'core',
+ "description" => __("Close a monitor process."),
+ "parameters" => array(
+ 'id' => __('Monitor ID.'),
+ ),
+ "response" => array(
+ 'ok' => __("TRUE if exist and it's closed."),
+ ),
+ "type" => array(
+ "parameters" => array(
+ 'id' => 'string',
+ ),
+ "response" => array(
+ 'ok' => 'boolean',
+ ),
+ )
+ );
+ }
+
+ public static function getAccess($ignore = "") {
+ $me = __FILE__;
+ return parent::getAccess($me);
+ }
+
+// public static function getAccessFlags() {
+// return driverUser::PERMISSION_FILE_ALL_EXECUTE;
+// }
+ }
+}
+return new commandLPClose();
@@ -0,0 +1,66 @@
+<?php
+
+/*
+ * Pharinix Copyright (C) 2015 Pedro Pelaez <aaaaa976@gmail.com>
+ * Sources https://github.com/PSF1/pharinix
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+if (!defined("CMS_VERSION")) { header("HTTP/1.0 404 Not Found"); die(""); }
+
+if (!class_exists("commandLPRead")) {
+ class commandLPRead extends driverCommand {
+
+ public static function runMe(&$params, $debug = true) {
+ $params = array_merge(array(
+ 'id' => '',
+ ), $params);
+
+ include_once 'etc/drivers/longProcessMonitor.php';
+ return array('monitor' => driverLPMonitor::read($params['id']));
+ }
+
+ public static function getHelp() {
+ return array(
+ "package" => 'core',
+ "description" => __("Read the state of a monitor process."),
+ "parameters" => array(
+ 'id' => __('Monitor ID.'),
+ ),
+ "response" => array(
+ 'monitor' => __("Monitor object."),
+ ),
+ "type" => array(
+ "parameters" => array(
+ 'id' => 'string',
+ ),
+ "response" => array(
+ 'monitor' => 'object',
+ ),
+ )
+ );
+ }
+
+ public static function getAccess($ignore = "") {
+ $me = __FILE__;
+ return parent::getAccess($me);
+ }
+
+// public static function getAccessFlags() {
+// return driverUser::PERMISSION_FILE_ALL_EXECUTE;
+// }
+ }
+}
+return new commandLPRead();
@@ -0,0 +1,66 @@
+<?php
+
+/*
+ * Pharinix Copyright (C) 2015 Pedro Pelaez <aaaaa976@gmail.com>
+ * Sources https://github.com/PSF1/pharinix
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+if (!defined("CMS_VERSION")) { header("HTTP/1.0 404 Not Found"); die(""); }
+
+if (!class_exists("commandLPReadAll")) {
+ class commandLPReadAll extends driverCommand {
+
+ public static function runMe(&$params, $debug = true) {
+ $params = array_merge(array(
+ 'content' => false,
+ ), $params);
+
+ include_once 'etc/drivers/longProcessMonitor.php';
+ return array('monitors' => driverLPMonitor::getActives($params['content']));
+ }
+
+ public static function getHelp() {
+ return array(
+ "package" => 'core',
+ "description" => __("Read all active monitors process."),
+ "parameters" => array(
+ 'content' => __('Like you state too?'),
+ ),
+ "response" => array(
+ 'monitors' => __("List of monitors objects."),
+ ),
+ "type" => array(
+ "parameters" => array(
+ 'content' => 'boolean',
+ ),
+ "response" => array(
+ 'monitors' => 'array',
+ ),
+ )
+ );
+ }
+
+ public static function getAccess($ignore = "") {
+ $me = __FILE__;
+ return parent::getAccess($me);
+ }
+
+// public static function getAccessFlags() {
+// return driverUser::PERMISSION_FILE_ALL_EXECUTE;
+// }
+ }
+}
+return new commandLPReadAll();
@@ -0,0 +1,66 @@
+<?php
+
+/*
+ * Pharinix Copyright (C) 2015 Pedro Pelaez <aaaaa976@gmail.com>
+ * Sources https://github.com/PSF1/pharinix
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+if (!defined("CMS_VERSION")) { header("HTTP/1.0 404 Not Found"); die(""); }
+
+if (!class_exists("commandLPStart")) {
+ class commandLPStart extends driverCommand {
+
+ public static function runMe(&$params, $debug = true) {
+ $params = array_merge(array(
+ 'label' => __('Long process'),
+ ), $params);
+
+ include_once 'etc/drivers/longProcessMonitor.php';
+ return array('monitor' => driverLPMonitor::start(0, $params['label']));
+ }
+
+ public static function getHelp() {
+ return array(
+ "package" => 'core',
+ "description" => __("Start a new monitor process. Monitors are safe mode compatible."),
+ "parameters" => array(
+ 'label' => __('Global process label.'),
+ ),
+ "response" => array(
+ 'monitor' => __('Monitor object. The ID is in the id attribute.'),
+ ),
+ "type" => array(
+ "parameters" => array(
+ 'label' => 'string',
+ ),
+ "response" => array(
+ 'monitor' => 'object',
+ ),
+ )
+ );
+ }
+
+ public static function getAccess($ignore = "") {
+ $me = __FILE__;
+ return parent::getAccess($me);
+ }
+
+// public static function getAccessFlags() {
+// return driverUser::PERMISSION_FILE_ALL_EXECUTE;
+// }
+ }
+}
+return new commandLPStart();
Oops, something went wrong.

0 comments on commit 4f95b7c

Please sign in to comment.