Skip to content
This repository was archived by the owner on Nov 25, 2020. It is now read-only.

Commit cdacb3d

Browse files
committed
Do not disable task / mq for minisites, as more actions rely on it.
Fix powerFS
1 parent 2cb8a77 commit cdacb3d

File tree

10 files changed

+35
-18
lines changed

10 files changed

+35
-18
lines changed

core/src/plugins/action.powerfs/PowerFSController.php

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
namespace Pydio\Action\Compression;
2323

2424
use Exception;
25+
use Pydio\Access\Core\Model\AJXP_Node;
26+
use Pydio\Access\Core\Model\NodesDiff;
2527
use Pydio\Access\Core\Model\UserSelection;
2628
use Pydio\Access\Driver\StreamProvider\FS\FsAccessWrapper;
2729

@@ -96,7 +98,7 @@ public function switchAction(ServerRequestInterface &$request, ResponseInterface
9698
$response = $response->withBody($fileReader);
9799
} else {
98100
$response = $response->withHeader("Content-type", "text/html");
99-
$response->getBody()->write("<script>alert('Cannot find archive! Is ZIP correctly installed?');</script>");
101+
$response->getBody()->write("<script>alert('".str_replace("'", "\'", $mess["powerfs.5"])."');</script>");
100102
}
101103
break;
102104

@@ -109,7 +111,7 @@ public function switchAction(ServerRequestInterface &$request, ResponseInterface
109111
if ($taskId === null) {
110112
$task = TaskService::actionAsTask($ctx, $request->getAttribute("action"), $httpVars);
111113
$task->setLabel($mess['powerfs.1']);
112-
$task->setFlags(Task::FLAG_STOPPABLE | Task::FLAG_HAS_PROGRESS);
114+
$task->setFlags(Task::FLAG_HAS_PROGRESS);
113115
TaskService::getInstance()->enqueueTask($task, $request, $response);
114116
return;
115117
}
@@ -177,25 +179,28 @@ public function switchAction(ServerRequestInterface &$request, ResponseInterface
177179
}
178180
$tok = strtok("\n");
179181
}
180-
if ($finishedEchoed) $percent = 100;
181-
else $percent = min(round(count($handled) / count($todo) * 100), 100);
182-
TaskService::getInstance()->updateTaskStatus($taskId, Task::STATUS_RUNNING, "Creating archive " . $percent . " %", null, $percent);
182+
if ($finishedEchoed) $newPercent = 100;
183+
else $newPercent = min(round(count($handled) / count($todo) * 100), 100);
184+
if($newPercent !== $percent){
185+
TaskService::getInstance()->updateTaskStatus($taskId, Task::STATUS_RUNNING, str_replace("%s", $percent, $mess["powerfs.4"]), null, $percent);
186+
}
187+
$percent = $newPercent;
183188
}
184189
// avoid a busy wait
185190
if ($percent < 100) usleep(1);
186191
}
187192
pclose($proc);
188193
TaskService::getInstance()->updateTaskStatus($taskId, Task::STATUS_COMPLETE, "");
189194
if ($request->getAttribute("action") === "compress") {
190-
$newNode = new \Pydio\Access\Core\Model\AJXP_Node($urlBase . $dir . "/" . $archiveName);
191-
$nodesDiff = new \Pydio\Access\Core\Model\NodesDiff();
195+
$newNode = new AJXP_Node($urlBase . $dir . "/" . $archiveName);
196+
$nodesDiff = new NodesDiff();
192197
$nodesDiff->add($newNode);
193198
Controller::applyHook("msg.instant", array($ctx, $nodesDiff->toXML()));
194199
} else {
195200
$archiveName = str_replace("'", "\'", $originalArchiveParam);
196201
$jsCode = " PydioApi.getClient().downloadSelection(null, $('download_form'), 'postcompress_download', {ope_id:'" . $opeId . "',archive_name:'" . $archiveName . "'}); ";
197202
$actionTrigger = new JsActionTrigger($jsCode, 0);
198-
Controller::applyHook("msg.instant", array($ctx, $actionTrigger->toXML()));
203+
Controller::applyHook("msg.instant", array($ctx, $actionTrigger->toXML(), $ctx->getUser()->getId()));
199204

200205
}
201206

core/src/plugins/action.powerfs/i18n/cs.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,6 @@
2323
"1" => "Vytváří se archiv, chvíli strpení",
2424
"2" => "Znovu načíst aktuální adresář",
2525
"3" => "Stahování archivu by mělo začít automaticky",
26+
"4" => "Vytváří se archiv - %s%",
27+
"5" => "Cannot find corresponding archive for download! Did you make sure to install the Zip binary on your server?",
2628
);

core/src/plugins/action.powerfs/i18n/de.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@
2222
// will be replaced by the application title
2323
"1" => "Archiv wird erstellt. Bitte warten...",
2424
"2" => "Aktuellen Ordner neu laden",
25-
"3" => "Der Download des Archivs sollte automatisch starten"
25+
"3" => "Der Download des Archivs sollte automatisch starten",
26+
"4" => "Archiv wird erstellt - %s%",
27+
"5" => "Cannot find corresponding archive for download! Did you make sure to install the Zip binary on your server?",
2628
);

core/src/plugins/action.powerfs/i18n/en.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
*/
2121
$mess = array(
2222
// will be replaced by the application title
23-
"1" => "Creating archive, please wait",
23+
"1" => "Launching archive creation in background, please wait.",
2424
"2" => "Reload current folder",
2525
"3" => "Archive download should start automatically",
26+
"4" => "Creating archive - %s% done",
27+
"5" => "Cannot find corresponding archive for download! Did you make sure to install the Zip binary on your server?",
2628
);

core/src/plugins/action.powerfs/i18n/fr.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@
2222
// will be replaced by the application title
2323
"1" => "Création de l'archive, veuillez patienter",
2424
"2" => "Rechargement du répertoire",
25-
"3" => "Le téléchargement de l'archive devrait démarrer automatiquement"
25+
"3" => "Le téléchargement de l'archive devrait démarrer automatiquement",
26+
"4" => "Création de l'archive - %s%",
27+
"5" => "Cannot find corresponding archive for download! Did you make sure to install the Zip binary on your server?",
2628
);

core/src/plugins/action.powerfs/i18n/it.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@
2222
// will be replaced by the application title
2323
"1" => "Creazione archivio. Attendere...",
2424
"2" => "Ricaricamento cartella corrente",
25-
"3" => "Il download dell'archivio partità automaticamente"
25+
"3" => "Il download dell'archivio partità automaticamente",
26+
"4" => "Creazione archivio - %s%",
27+
"5" => "Cannot find corresponding archive for download! Did you make sure to install the Zip binary on your server?",
2628
);

core/src/plugins/action.powerfs/i18n/pt.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,7 @@
2222
// will be replaced by the application title
2323
"1" => "A criar o ficheiro, por favor aguarde",
2424
"2" => "Actualize a pasta actual",
25-
"3" => "A Transferência do ficheiro deverá começar automaticamente"
25+
"3" => "A Transferência do ficheiro deverá começar automaticamente",
26+
"4" => "A criar o ficheiro - %s%",
27+
"5" => "Cannot find corresponding archive for download! Did you make sure to install the Zip binary on your server?",
2628
);

core/src/plugins/core.mq/class.PydioInstantMessenger.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Class.create("PydioInstantMessenger", {
3333
initialize : function(){
3434
"use strict";
3535

36-
if(window.ajxpMinisite) return;
36+
//if(window.ajxpMinisite) return;
3737

3838
this.clientId = window.ajxpBootstrap.parameters.get("SECURE_TOKEN");
3939
this.configs = pydio.getPluginConfigs("mq");
@@ -63,7 +63,7 @@ Class.create("PydioInstantMessenger", {
6363

6464
initForRepoId:function(repoId){
6565

66-
if(window.WebSocket && this.configs.get("WS_ACTIVE")){
66+
if(window.WebSocket && !window.ajxpMinisite && this.configs.get("WS_ACTIVE")){
6767

6868
if(this.ws) {
6969
if(!repoId){

core/src/plugins/core.mq/manifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
<rightsContext adminOnly="false" noUser="true" read="false" userLogged="true" write="false"/>
7474
<processing>
7575
<clientListener name="init"><![CDATA[
76-
if(!pydio.mqObserver && !pydio.mqObserverLoading && !window.ajxpMinisite){
76+
if(!pydio.mqObserver && !pydio.mqObserverLoading){
7777
pydio.mqObserverLoading = true;
7878
ResourcesManager.prototype.loadJSResource('plugins/core.mq/class.PydioInstantMessenger.js', 'PydioInstantMessenger', function(){
7979
pydio.mqObserver = new PydioInstantMessenger();

core/src/plugins/core.tasks/src/TaskService.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,9 @@ public function enqueueTask(Task $task, ServerRequestInterface $request = null,
9090
return $response;
9191
}
9292

93-
$minisite = $request !== null && $request->getAttribute("minisite");
93+
//$minisite = $request !== null && $request->getAttribute("minisite");
9494

95-
if(ConfService::backgroundActionsSupported() && !ApplicationState::sapiIsCli() && !$minisite) {
95+
if(ConfService::backgroundActionsSupported() && !ApplicationState::sapiIsCli() /*&& !$minisite*/) {
9696

9797
CliRunner::applyTaskInBackground($task);
9898
return $response;

0 commit comments

Comments
 (0)