Permalink
Browse files

Do not disable task / mq for minisites, as more actions rely on it.

Fix powerFS
  • Loading branch information...
1 parent 2cb8a77 commit cdacb3d6db7f24fdc78221c0849faeaf54b334a4 @cdujeu cdujeu committed Oct 6, 2016
@@ -22,6 +22,8 @@
namespace Pydio\Action\Compression;
use Exception;
+use Pydio\Access\Core\Model\AJXP_Node;
+use Pydio\Access\Core\Model\NodesDiff;
use Pydio\Access\Core\Model\UserSelection;
use Pydio\Access\Driver\StreamProvider\FS\FsAccessWrapper;
@@ -96,7 +98,7 @@ public function switchAction(ServerRequestInterface &$request, ResponseInterface
$response = $response->withBody($fileReader);
} else {
$response = $response->withHeader("Content-type", "text/html");
- $response->getBody()->write("<script>alert('Cannot find archive! Is ZIP correctly installed?');</script>");
+ $response->getBody()->write("<script>alert('".str_replace("'", "\'", $mess["powerfs.5"])."');</script>");
}
break;
@@ -109,7 +111,7 @@ public function switchAction(ServerRequestInterface &$request, ResponseInterface
if ($taskId === null) {
$task = TaskService::actionAsTask($ctx, $request->getAttribute("action"), $httpVars);
$task->setLabel($mess['powerfs.1']);
- $task->setFlags(Task::FLAG_STOPPABLE | Task::FLAG_HAS_PROGRESS);
+ $task->setFlags(Task::FLAG_HAS_PROGRESS);
TaskService::getInstance()->enqueueTask($task, $request, $response);
return;
}
@@ -177,25 +179,28 @@ public function switchAction(ServerRequestInterface &$request, ResponseInterface
}
$tok = strtok("\n");
}
- if ($finishedEchoed) $percent = 100;
- else $percent = min(round(count($handled) / count($todo) * 100), 100);
- TaskService::getInstance()->updateTaskStatus($taskId, Task::STATUS_RUNNING, "Creating archive " . $percent . " %", null, $percent);
+ if ($finishedEchoed) $newPercent = 100;
+ else $newPercent = min(round(count($handled) / count($todo) * 100), 100);
+ if($newPercent !== $percent){
+ TaskService::getInstance()->updateTaskStatus($taskId, Task::STATUS_RUNNING, str_replace("%s", $percent, $mess["powerfs.4"]), null, $percent);
+ }
+ $percent = $newPercent;
}
// avoid a busy wait
if ($percent < 100) usleep(1);
}
pclose($proc);
TaskService::getInstance()->updateTaskStatus($taskId, Task::STATUS_COMPLETE, "");
if ($request->getAttribute("action") === "compress") {
- $newNode = new \Pydio\Access\Core\Model\AJXP_Node($urlBase . $dir . "/" . $archiveName);
- $nodesDiff = new \Pydio\Access\Core\Model\NodesDiff();
+ $newNode = new AJXP_Node($urlBase . $dir . "/" . $archiveName);
+ $nodesDiff = new NodesDiff();
$nodesDiff->add($newNode);
Controller::applyHook("msg.instant", array($ctx, $nodesDiff->toXML()));
} else {
$archiveName = str_replace("'", "\'", $originalArchiveParam);
$jsCode = " PydioApi.getClient().downloadSelection(null, $('download_form'), 'postcompress_download', {ope_id:'" . $opeId . "',archive_name:'" . $archiveName . "'}); ";
$actionTrigger = new JsActionTrigger($jsCode, 0);
- Controller::applyHook("msg.instant", array($ctx, $actionTrigger->toXML()));
+ Controller::applyHook("msg.instant", array($ctx, $actionTrigger->toXML(), $ctx->getUser()->getId()));
}
@@ -23,4 +23,6 @@
"1" => "Vytváří se archiv, chvíli strpení",
"2" => "Znovu načíst aktuální adresář",
"3" => "Stahování archivu by mělo začít automaticky",
+ "4" => "Vytváří se archiv - %s%",
+ "5" => "Cannot find corresponding archive for download! Did you make sure to install the Zip binary on your server?",
);
@@ -22,5 +22,7 @@
// will be replaced by the application title
"1" => "Archiv wird erstellt. Bitte warten...",
"2" => "Aktuellen Ordner neu laden",
- "3" => "Der Download des Archivs sollte automatisch starten"
+ "3" => "Der Download des Archivs sollte automatisch starten",
+ "4" => "Archiv wird erstellt - %s%",
+ "5" => "Cannot find corresponding archive for download! Did you make sure to install the Zip binary on your server?",
);
@@ -20,7 +20,9 @@
*/
$mess = array(
// will be replaced by the application title
- "1" => "Creating archive, please wait",
+ "1" => "Launching archive creation in background, please wait.",
"2" => "Reload current folder",
"3" => "Archive download should start automatically",
+ "4" => "Creating archive - %s% done",
+ "5" => "Cannot find corresponding archive for download! Did you make sure to install the Zip binary on your server?",
);
@@ -22,5 +22,7 @@
// will be replaced by the application title
"1" => "Création de l'archive, veuillez patienter",
"2" => "Rechargement du répertoire",
- "3" => "Le téléchargement de l'archive devrait démarrer automatiquement"
+ "3" => "Le téléchargement de l'archive devrait démarrer automatiquement",
+ "4" => "Création de l'archive - %s%",
+ "5" => "Cannot find corresponding archive for download! Did you make sure to install the Zip binary on your server?",
);
@@ -22,5 +22,7 @@
// will be replaced by the application title
"1" => "Creazione archivio. Attendere...",
"2" => "Ricaricamento cartella corrente",
- "3" => "Il download dell'archivio partità automaticamente"
+ "3" => "Il download dell'archivio partità automaticamente",
+ "4" => "Creazione archivio - %s%",
+ "5" => "Cannot find corresponding archive for download! Did you make sure to install the Zip binary on your server?",
);
@@ -22,5 +22,7 @@
// will be replaced by the application title
"1" => "A criar o ficheiro, por favor aguarde",
"2" => "Actualize a pasta actual",
- "3" => "A Transferência do ficheiro deverá começar automaticamente"
+ "3" => "A Transferência do ficheiro deverá começar automaticamente",
+ "4" => "A criar o ficheiro - %s%",
+ "5" => "Cannot find corresponding archive for download! Did you make sure to install the Zip binary on your server?",
);
@@ -33,7 +33,7 @@ Class.create("PydioInstantMessenger", {
initialize : function(){
"use strict";
- if(window.ajxpMinisite) return;
+ //if(window.ajxpMinisite) return;
this.clientId = window.ajxpBootstrap.parameters.get("SECURE_TOKEN");
this.configs = pydio.getPluginConfigs("mq");
@@ -63,7 +63,7 @@ Class.create("PydioInstantMessenger", {
initForRepoId:function(repoId){
- if(window.WebSocket && this.configs.get("WS_ACTIVE")){
+ if(window.WebSocket && !window.ajxpMinisite && this.configs.get("WS_ACTIVE")){
if(this.ws) {
if(!repoId){
@@ -73,7 +73,7 @@
<rightsContext adminOnly="false" noUser="true" read="false" userLogged="true" write="false"/>
<processing>
<clientListener name="init"><![CDATA[
- if(!pydio.mqObserver && !pydio.mqObserverLoading && !window.ajxpMinisite){
+ if(!pydio.mqObserver && !pydio.mqObserverLoading){
pydio.mqObserverLoading = true;
ResourcesManager.prototype.loadJSResource('plugins/core.mq/class.PydioInstantMessenger.js', 'PydioInstantMessenger', function(){
pydio.mqObserver = new PydioInstantMessenger();
@@ -90,9 +90,9 @@ public function enqueueTask(Task $task, ServerRequestInterface $request = null,
return $response;
}
- $minisite = $request !== null && $request->getAttribute("minisite");
+ //$minisite = $request !== null && $request->getAttribute("minisite");
- if(ConfService::backgroundActionsSupported() && !ApplicationState::sapiIsCli() && !$minisite) {
+ if(ConfService::backgroundActionsSupported() && !ApplicationState::sapiIsCli() /*&& !$minisite*/) {
CliRunner::applyTaskInBackground($task);
return $response;

1 comment on commit cdacb3d

@Nanomani
Contributor
Nanomani commented on cdacb3d Oct 6, 2016 edited

It works better for minisite.
But this PR created after this is needed for winOS :-)
#1229

Please sign in to comment.