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

Commit 4b005cf

Browse files
committed
Replace the ["extension"] to "PATHINFO_EXTENSION" and change the progress number to whole number
1 parent 40fc8bd commit 4b005cf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

core/src/plugins/action.compression/class.PluginCompression.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function receiveAction($action, $httpVars, $fileVars)
126126
try {
127127
$archive->addFile(AJXP_MetaStreamWrapper::getRealFSReference($fullPath), $fileName);
128128
$counterCompression++;
129-
file_put_contents($progressCompressionFileName, sprintf($messages["compression.6"], round(($counterCompression / count($tabAllFiles)) * 100, 2) . " %"));
129+
file_put_contents($progressCompressionFileName, sprintf($messages["compression.6"], round(($counterCompression / count($tabAllFiles)) * 100, 0, PHP_ROUND_HALF_DOWN) . " %"));
130130
} catch (Exception $e) {
131131
unlink($tmpArchiveName);
132132
throw $e;
@@ -155,7 +155,7 @@ public function receiveAction($action, $httpVars, $fileVars)
155155
file_put_contents($progressCompressionFileName, "SUCCESS");
156156
}
157157
}
158-
elseif ($action == "check_compression_status") {
158+
elseif ($action == "check_compression_status") {
159159
$archivePath = AJXP_Utils::decodeSecureMagic($httpVars["archive_path"]);
160160
$progressCompression = file_get_contents($progressCompressionFileName);
161161
if ($progressCompression != "SUCCESS") {
@@ -186,7 +186,7 @@ public function receiveAction($action, $httpVars, $fileVars)
186186
$counterExtract = 0;
187187
$currentAllPydioPath = $currentDirUrl . $fileArchive;
188188
$pharCurrentAllPydioPath = "phar://" . AJXP_MetaStreamWrapper::getRealFSReference($currentAllPydioPath);
189-
$pathInfoCurrentAllPydioPath = pathinfo($currentAllPydioPath)["extension"];
189+
$pathInfoCurrentAllPydioPath = pathinfo($currentAllPydioPath, PATHINFO_EXTENSION);
190190
//WE TAKE ONLY TAR, TAR.GZ AND TAR.BZ2 ARCHIVES
191191
foreach ($authorizedExtension as $extension => $strlenExtension) {
192192
if ($pathInfoCurrentAllPydioPath == $extension) {
@@ -239,7 +239,7 @@ public function receiveAction($action, $httpVars, $fileVars)
239239
$newNode = new AJXP_Node($currentDirUrl . $onlyFileName . DIRECTORY_SEPARATOR . $fileNameInArchive);
240240
AJXP_Controller::applyHook("node.change", array(null, $newNode, false));
241241
$counterExtract++;
242-
file_put_contents($progressExtractFileName, sprintf($messages["compression.12"], round(($counterExtract / $archive->count()) * 100, 2) . " %"));
242+
file_put_contents($progressExtractFileName, sprintf($messages["compression.12"], round(($counterExtract / $archive->count()) * 100, 0, PHP_ROUND_HALF_DOWN) . " %"));
243243
}
244244
} catch (Exception $e) {
245245
throw new AJXP_Exception($e);

0 commit comments

Comments
 (0)