Permalink
Browse files

TaskController is a "SqlTableProvider" plugin.

  • Loading branch information...
1 parent a546843 commit 4aba2d4c2ad75904e7b1ff80c95d6882e0efae71 @cdujeu cdujeu committed May 24, 2016
@@ -191,11 +191,13 @@ public function sendInstantMessage($xmlContent, $repositoryId, $targetUserId = n
$input["NODE_PATHES"] = $nodePathes;
}
-
- // Publish on NSQ
- $nsq = new nsqphp;
- $nsq->publishTo("127.0.0.1", 1);
- $nsq->publish('im', new \nsqphp\Message\Message(json_encode($input)));
+ $host = $this->getFilteredOption("WS_SERVER_HOST");
+ if(!empty($host) && !empty($port)){
+ // Publish on NSQ
+ $nsq = new nsqphp;
+ $nsq->publishTo($host, 1);
+ $nsq->publish('im', new \nsqphp\Message\Message(json_encode($input)));
+ }
$this->hasPendingMessage = true;
@@ -217,8 +219,9 @@ public function appendRefreshInstruction(ResponseInterface &$responseInterface){
}
/**
- * @param $request
- * @param $response
+ * @param ServerRequestInterface $request
+ * @param ResponseInterface $response
+ * @throws \Pydio\Core\Exception\AuthRequiredException
*/
public function clientChannelMethod(ServerRequestInterface $request, ResponseInterface &$response)
{
@@ -13,5 +13,5 @@ CREATE TABLE IF NOT EXISTS `ajxp_tasks` (
`nodes` text NOT NULL,
PRIMARY KEY (`uid`),
KEY `userId` (`userId`,`status`),
- FULLTEXT KEY `nodes` (`nodes`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Task persistence layer';
+ INDEX (nodes(40))
+) DEFAULT CHARSET=utf8 COMMENT='Task persistence layer';
@@ -0,0 +1,20 @@
+CREATE TABLE ajxp_tasks (
+ uid VARCHAR(255) NOT NULL ,
+ flags INTEGER NOT NULL,
+ label VARCHAR(255) NOT NULL,
+ userId VARCHAR(255) NOT NULL,
+ wsId VARCHAR(32) NOT NULL,
+ status INTEGER NOT NULL,
+ status_msg VARCHAR(500) NOT NULL,
+ progress INTEGER NOT NULL,
+ schedule VARCHAR(500) NOT NULL,
+ action VARCHAR(255) NOT NULL,
+ parameters VARCHAR(500) NOT NULL,
+ nodes VARCHAR(500) NOT NULL
+);
+
+CREATE INDEX ajxp_task_idx ON ajxp_tasks ('uid');
+CREATE INDEX ajxp_task_usr_idx ON ajxp_tasks ('userId');
+CREATE INDEX ajxp_task_status_idx ON ajxp_tasks ('status');
+CREATE INDEX ajxp_task_nodes_idx ON ajxp_tasks ('nodes');
+
@@ -0,0 +1,19 @@
+CREATE TABLE ajxp_tasks (
+ uid text NOT NULL ,
+ flags integer NOT NULL,
+ label text NOT NULL,
+ userId text NOT NULL,
+ wsId text NOT NULL,
+ status INTEGER NOT NULL,
+ status_msg text NOT NULL,
+ progress INTEGER NOT NULL,
+ schedule text NOT NULL,
+ action text NOT NULL,
+ parameters text NOT NULL,
+ nodes text NOT NULL
+);
+
+CREATE INDEX ajxp_task_idx ON ajxp_tasks (uid);
+CREATE INDEX ajxp_task_usr_idx ON ajxp_tasks (userId);
+CREATE INDEX ajxp_task_status_idx ON ajxp_tasks (status);
+CREATE INDEX ajxp_task_nodes_idx ON ajxp_tasks (nodes);
@@ -27,6 +27,7 @@
use Pydio\Core\Http\Message\UserMessage;
use Pydio\Core\Http\SimpleRestResourceRouter;
use Pydio\Core\PluginFramework\Plugin;
+use Pydio\Core\PluginFramework\SqlTableProvider;
use Pydio\Core\Services\AuthService;
use Pydio\Core\Services\ConfService;
use Pydio\Core\Utils\Utils;
@@ -35,7 +36,7 @@
defined('AJXP_EXEC') or die('Access not allowed');
-class TaskController extends Plugin
+class TaskController extends Plugin implements SqlTableProvider
{
public function init($options)
@@ -143,7 +144,7 @@ public function attachTasksToNode(AJXP_Node &$node, $isContextNode = false, $det
public function enrichConsumeChannel(ServerRequestInterface &$requestInterface, ResponseInterface &$responseInterface){
if(AuthService::getLoggedUser() == null || ConfService::getRepository() == null){
- return [];
+ return;
}
$respType = &$responseInterface->getBody();
if(!$respType instanceof \Pydio\Core\Http\Response\SerializableResponseStream && !$respType->getSize()){
@@ -157,5 +158,15 @@ public function enrichConsumeChannel(ServerRequestInterface &$requestInterface,
}
-
+ /**
+ * Install SQL table using a dibi driver data
+ * @param $param array("SQL_DRIVER" => $dibiDriverData)
+ * @return mixed
+ */
+ public function installSQLTables($param)
+ {
+ $p = Utils::cleanDibiDriverParameters($param["SQL_DRIVER"]);
+ return Utils::runCreateTablesQuery($p, $this->getBaseDir()."/create.sql");
+ }
+
}
@@ -28,6 +28,7 @@
use Pydio\Conf\Core\AbstractAjxpUser;
use Pydio\Core\Controller\Controller;
use Pydio\Core\Exception\PydioException;
+use Pydio\Core\PluginFramework\SqlTableProvider;
use Pydio\Core\Services\AuthService;
use Pydio\Core\Services\ConfService;
use Pydio\Core\Utils\Utils;

0 comments on commit 4aba2d4

Please sign in to comment.