Permalink
Browse files

Rename getAjxpTmpDir to getTemporaryFolder

  • Loading branch information...
1 parent 02fd5c8 commit 350f6a35adc7bb37f01ccada41aa6a0e8a903233 @cdujeu cdujeu committed Oct 1, 2016
Showing with 40 additions and 40 deletions.
  1. +1 −1 core/src/core/src/lib/pclzip.lib.php
  2. +1 −1 core/src/core/src/pydio/Core/Services/ApplicationState.php
  3. +2 −2 core/src/core/src/pydio/Core/Utils/Http/BruteForceHelper.php
  4. +2 −2 core/src/core/src/pydio/Core/Utils/Vars/OptionsHelper.php
  5. +2 −2 core/src/plugins/access.fs/FsAccessDriver.php
  6. +1 −1 core/src/plugins/access.fs/FsAccessWrapper.php
  7. +1 −1 core/src/plugins/access.ftp/FtpAccessWrapper.php
  8. +4 −4 core/src/plugins/access.inbox/InboxAccessDriver.php
  9. +4 −4 core/src/plugins/access.inbox/InboxAccessWrapper.php
  10. +1 −1 core/src/plugins/access.s3/S3AccessWrapper.php
  11. +1 −1 core/src/plugins/access.sftp/SFTPAccessWrapper.php
  12. +1 −1 core/src/plugins/access.sftp_psl/SftpPSLAccessWrapper.php
  13. +1 −1 core/src/plugins/access.smb/SMBAccessWrapper.php
  14. +1 −1 core/src/plugins/access.swift/SwiftAccessWrapper.php
  15. +1 −1 core/src/plugins/action.compression/PluginCompression.php
  16. +2 −2 core/src/plugins/action.powerfs/PowerFSController.php
  17. +1 −1 core/src/plugins/core.access/src/Stream/StreamWrapper.php
  18. +4 −4 core/src/plugins/core.conf/AbstractConfDriver.php
  19. +1 −1 core/src/plugins/core.index/AbstractSearchEngineIndexer.php
  20. +1 −1 core/src/plugins/editor.diaporama/PThumb.lib.php
  21. +2 −2 core/src/plugins/editor.imagick/IMagickPreviewer.php
  22. +1 −1 core/src/plugins/meta.filehasher/FileHasher.php
  23. +3 −3 core/src/plugins/uploader.jumploader/Jumploader.php
  24. +1 −1 core/src/plugins/uploader.plupload/Pluploader.php
@@ -66,7 +66,7 @@
// define( 'PCLZIP_TEMPORARY_DIR', '/temp/' );
// define( 'PCLZIP_TEMPORARY_DIR', 'C:/Temp/' );
if (!defined('PCLZIP_TEMPORARY_DIR')) {
- define( 'PCLZIP_TEMPORARY_DIR', ApplicationState::getAjxpTmpDir() .DIRECTORY_SEPARATOR );
+ define( 'PCLZIP_TEMPORARY_DIR', ApplicationState::getTemporaryFolder() .DIRECTORY_SEPARATOR );
}
// ----- Optional threshold ratio for use of temporary files
@@ -230,7 +230,7 @@ public static function getWorkspaceShortcutURL($repository)
* @static
* @return mixed|null|string
*/
- public static function getAjxpTmpDir()
+ public static function getTemporaryFolder()
{
$conf = ConfService::getGlobalConf("AJXP_TMP_DIR");
if (!empty($conf)) {
@@ -41,7 +41,7 @@ class BruteForceHelper
*/
public static function getBruteForceLoginArray()
{
- $failedLog = ApplicationState::getAjxpTmpDir() . "/failedAJXP.log";
+ $failedLog = ApplicationState::getTemporaryFolder() . "/failedAJXP.log";
$loginAttempt = @file_get_contents($failedLog);
$loginArray = unserialize($loginAttempt);
$ret = array();
@@ -66,7 +66,7 @@ public static function setBruteForceLoginArray($loginArray, $validCurrent = fals
if($validCurrent && isSet($loginArray[$_SERVER["REMOTE_ADDR"]])){
unset($loginArray[$_SERVER["REMOTE_ADDR"]]);
}
- $failedLog = ApplicationState::getAjxpTmpDir() . "/failedAJXP.log";
+ $failedLog = ApplicationState::getTemporaryFolder() . "/failedAJXP.log";
@file_put_contents($failedLog, serialize($loginArray));
}
@@ -75,7 +75,7 @@ public static function filterFormElementsFromMeta(ContextInterface $ctx, $metada
}
$value = "";
} else {
- $file = ApplicationState::getAjxpTmpDir() . "/" . $value;
+ $file = ApplicationState::getTemporaryFolder() . "/" . $value;
if (file_exists($file)) {
$id = !empty($level["original_binary"]) ? $level["original_binary"] : null;
$id = ConfService::getConfStorageImpl()->saveBinary($binariesContext, $file, $id);
@@ -137,7 +137,7 @@ public static function parseStandardFormParameters(ContextInterface $ctx, &$repD
}
$value = "";
} else {
- $file = ApplicationState::getAjxpTmpDir() . "/" . $value;
+ $file = ApplicationState::getTemporaryFolder() . "/" . $value;
if (file_exists($file)) {
$id = !empty($repDef[$key . "_original_binary"]) ? $repDef[$key . "_original_binary"] : null;
$id = ConfService::getConfStorageImpl()->saveBinary($binariesContext, $file, $id);
@@ -656,7 +656,7 @@ public function downloadAction(ServerRequestInterface &$request, ResponseInterfa
if ($zip) {
// Make a temp zip and send it as download
$loggedUser = $ctx->getUser();
- $file = ApplicationState::getAjxpTmpDir() ."/".($loggedUser?$loggedUser->getId():"shared")."_".time()."tmpDownload.zip";
+ $file = ApplicationState::getTemporaryFolder() ."/".($loggedUser?$loggedUser->getId():"shared")."_".time()."tmpDownload.zip";
$zipFile = $this->makeZip($selection, $file, empty($dir)?"/":$dir);
if(!$zipFile) throw new PydioException("Error while compressing");
$localName = (empty($base)?"Files":$base).".zip";
@@ -804,7 +804,7 @@ public function switchAction(ServerRequestInterface &$request, ResponseInterface
} else {
$localName = (basename($dir)==""?"Files":basename($dir)).".zip";
}
- $file = ApplicationState::getAjxpTmpDir() ."/".($loggedUser?$loggedUser->getId():"shared")."_".time()."tmpCompression.zip";
+ $file = ApplicationState::getTemporaryFolder() ."/".($loggedUser?$loggedUser->getId():"shared")."_".time()."tmpCompression.zip";
if(isSet($httpVars["compress_flat"])) $baseDir = "__AJXP_ZIP_FLAT__/";
else $baseDir = $dir;
$zipFile = $this->makeZip($selection, $file, $baseDir, $taskId);
@@ -113,7 +113,7 @@ protected static function initPath($path, $streamType, $storeOpenContext = false
//print($streamType.$path);
if ($streamType == "file") {
if (self::$crtZip == null || !is_array(self::$currentListingKeys)) {
- $tmpDir = ApplicationState::getAjxpTmpDir() . DIRECTORY_SEPARATOR . md5(time()-rand());
+ $tmpDir = ApplicationState::getTemporaryFolder() . DIRECTORY_SEPARATOR . md5(time()-rand());
mkdir($tmpDir);
$tmpFileName = $tmpDir.DIRECTORY_SEPARATOR.basename($localPath);
Logger::debug(__CLASS__,__FUNCTION__,"Tmp file $tmpFileName");
@@ -79,7 +79,7 @@ class FtpAccessWrapper implements IAjxpWrapper
*/
public static function getRealFSReference($path, $persistent = false)
{
- $tmpFile = ApplicationState::getAjxpTmpDir() ."/".md5(time());
+ $tmpFile = ApplicationState::getTemporaryFolder() ."/".md5(time());
$tmpHandle = fopen($tmpFile, "wb");
self::copyFileInStream($path, $tmpHandle);
fclose($tmpHandle);
@@ -103,13 +103,13 @@ public static function getNodeData($nodePath){
$nodeObject = new AJXP_Node($nodePath);
$basename = $nodeObject->getLabel();
if($nodeObject->isRoot()){
- return ['stat' => stat(ApplicationState::getAjxpTmpDir())];
+ return ['stat' => stat(ApplicationState::getTemporaryFolder())];
}
$allNodes = self::getNodes($nodeObject->getContext(), false);
$nodeData = $allNodes[$basename];
if(!isSet($nodeData["stat"])){
if(in_array(pathinfo($basename, PATHINFO_EXTENSION), ["error", "invitation"])){
- $stat = stat(ApplicationState::getAjxpTmpDir());
+ $stat = stat(ApplicationState::getTemporaryFolder());
}else{
$url = $nodeData["url"];
$node = new AJXP_Node($url);
@@ -121,7 +121,7 @@ public static function getNodeData($nodePath){
Controller::applyHook("node.read", [&$node]);
$stat = stat($url);
}catch (\Exception $e){
- $stat = stat(ApplicationState::getAjxpTmpDir());
+ $stat = stat(ApplicationState::getTemporaryFolder());
}
if(is_array($stat) && $nodeObject->getContext()->hasUser()){
$acl = $nodeObject->getContext()->getUser()->getMergedRole()->getAcl($nodeData["meta"]["shared_repository_id"]);
@@ -217,7 +217,7 @@ public static function getNodes(ContextInterface $parentContext, $checkStats = f
$remoteShare = $ocsStore->remoteShareById($linkId);
$status = $remoteShare->getStatus();
if($status == OCS_INVITATION_STATUS_PENDING){
- $stat = stat(ApplicationState::getAjxpTmpDir());
+ $stat = stat(ApplicationState::getTemporaryFolder());
$ext = "invitation";
$meta["ajxp_mime"] = "invitation";
$meta["share_meta_type"] = 0;
@@ -136,7 +136,7 @@ public static function translateURL($path){
$node = $nodes[ltrim($nodePath, '/')];
if (empty($node) || ! isset($node['url'])) {
- return ApplicationState::getAjxpTmpDir();
+ return ApplicationState::getTemporaryFolder();
}
$url = $node['url'];
@@ -149,7 +149,7 @@ public static function translateURL($path){
}
if(empty($nodePath)){
- return ApplicationState::getAjxpTmpDir();
+ return ApplicationState::getTemporaryFolder();
}
if($pydioScheme){
@@ -181,14 +181,14 @@ public static function getRealFSReference($path, $persistent = false)
$realFilePointer = MetaStreamWrapper::getRealFSReference($url, true);
if(!$isRemote){
$ext = pathinfo(parse_url($url, PHP_URL_PATH), PATHINFO_EXTENSION);
- $tmpname = tempnam(ApplicationState::getAjxpTmpDir(), "real-file-inbox-pointer").".".$ext;
+ $tmpname = tempnam(ApplicationState::getTemporaryFolder(), "real-file-inbox-pointer").".".$ext;
copy($realFilePointer, $tmpname);
$realFilePointer = $tmpname;
}
self::$linkNode->getDriver();
return $realFilePointer;
}else{
- $tmpname = tempnam(ApplicationState::getAjxpTmpDir(), "real-file-inbox-pointer");
+ $tmpname = tempnam(ApplicationState::getTemporaryFolder(), "real-file-inbox-pointer");
$source = fopen($url, "r");
$dest = fopen($tmpname, "w");
stream_copy_to_stream($source, $dest);
@@ -277,7 +277,7 @@ public static function removeTmpFile($tmpDir, $tmpFile)
*/
public static function getRealFSReference($path, $persistent = false)
{
- $tmpFile = ApplicationState::getAjxpTmpDir() . "/" . md5(time()) . "." . pathinfo($path, PATHINFO_EXTENSION);
+ $tmpFile = ApplicationState::getTemporaryFolder() . "/" . md5(time()) . "." . pathinfo($path, PATHINFO_EXTENSION);
$tmpHandle = fopen($tmpFile, "wb");
self::copyFileInStream($path, $tmpHandle);
fclose($tmpHandle);
@@ -290,7 +290,7 @@ public static function removeTmpFile($tmpDir, $tmpFile)
public static function getRealFSReference($path, $persistent = false)
{
if ($persistent) {
- $tmpFile = ApplicationState::getAjxpTmpDir() ."/".md5(time());
+ $tmpFile = ApplicationState::getTemporaryFolder() ."/".md5(time());
$tmpHandle = fopen($tmpFile, "wb");
self::copyFileInStream($path, $tmpHandle);
fclose($tmpHandle);
@@ -114,7 +114,7 @@ protected static function initPath($path, $streamType = '', $storeOpenContext =
public static function getRealFSReference($path, $persistent = false)
{
if ($persistent) {
- $tmpFile = ApplicationState::getAjxpTmpDir() ."/".md5(time());
+ $tmpFile = ApplicationState::getTemporaryFolder() ."/".md5(time());
$tmpHandle = fopen($tmpFile, "wb");
self::copyFileInStream($path, $tmpHandle);
fclose($tmpHandle);
@@ -210,7 +210,7 @@ protected static function closeWrapper()
public static function getRealFSReference($path, $persistent = false)
{
if ($persistent) {
- $tmpFile = ApplicationState::getAjxpTmpDir() ."/".md5(time());
+ $tmpFile = ApplicationState::getTemporaryFolder() ."/".md5(time());
$tmpHandle = fopen($tmpFile, "wb");
self::copyFileInStream($path, $tmpHandle);
fclose($tmpHandle);
@@ -255,7 +255,7 @@ protected static function closeWrapper()
*/
public static function getRealFSReference($path, $persistent = false)
{
- $tmpFile = ApplicationState::getAjxpTmpDir() ."/".md5(time()).".".pathinfo($path, PATHINFO_EXTENSION);
+ $tmpFile = ApplicationState::getTemporaryFolder() ."/".md5(time()).".".pathinfo($path, PATHINFO_EXTENSION);
$tmpHandle = fopen($tmpFile, "wb", null, self::$cloudContext);
self::copyFileInStream($path, $tmpHandle);
fclose($tmpHandle);
@@ -141,7 +141,7 @@ public function receiveAction(\Psr\Http\Message\ServerRequestInterface &$request
throw new PydioException($messages["compression.17"]);
}
try {
- $tmpArchiveName = tempnam(ApplicationState::getAjxpTmpDir(), "tar-compression") . ".tar";
+ $tmpArchiveName = tempnam(ApplicationState::getTemporaryFolder(), "tar-compression") . ".tar";
$archive = new PharData($tmpArchiveName);
} catch (Exception $e) {
$postMessageStatus($e->getMessage(), Task::STATUS_FAILED);
@@ -83,7 +83,7 @@ public function switchAction(ServerRequestInterface &$request, ResponseInterface
case "postcompress_download":
- $archive = ApplicationState::getAjxpTmpDir() . DIRECTORY_SEPARATOR . $httpVars["ope_id"] . "_" . InputFilter::decodeSecureMagic($httpVars["archive_name"], InputFilter::SANITIZE_FILENAME);
+ $archive = ApplicationState::getTemporaryFolder() . DIRECTORY_SEPARATOR . $httpVars["ope_id"] . "_" . InputFilter::decodeSecureMagic($httpVars["archive_name"], InputFilter::SANITIZE_FILENAME);
// This is a real filename on a local FS => toStorageEncoding
$archive = TextEncoder::toStorageEncoding($archive);
$archiveName = $httpVars["archive_name"];
@@ -143,7 +143,7 @@ public function switchAction(ServerRequestInterface &$request, ResponseInterface
$opeId = substr(md5(time()), 0, 10);
$originalArchiveParam = $archiveName;
if ($request->getAttribute("action") == "precompress") {
- $archiveName = ApplicationState::getAjxpTmpDir() . DIRECTORY_SEPARATOR . $opeId . "_" . $archiveName;
+ $archiveName = ApplicationState::getTemporaryFolder() . DIRECTORY_SEPARATOR . $opeId . "_" . $archiveName;
}
chdir($rootDir);
$cmd = $this->getContextualOption($ctx, "ZIP_PATH") . " -r " . escapeshellarg($archiveName) . " " . implode(" ", $args);
@@ -249,7 +249,7 @@ public static function getRealFSReference($path, $persistent = false) {
$nodeStream = self::createStream($path);
$nodeStream->getContents();
- $tmpFile = ApplicationState::getAjxpTmpDir() ."/".md5(time()).".".pathinfo($path, PATHINFO_EXTENSION);
+ $tmpFile = ApplicationState::getTemporaryFolder() ."/".md5(time()).".".pathinfo($path, PATHINFO_EXTENSION);
$tmpHandle = fopen($tmpFile, "wb");
self::copyStreamInStream(PydioStreamWrapper::getResource($nodeStream), $tmpHandle);
@@ -1293,7 +1293,7 @@ public function switchAction(ServerRequestInterface $requestInterface, ResponseI
case "get_binary_param" :
if (isSet($httpVars["tmp_file"])) {
- $file = ApplicationState::getAjxpTmpDir() ."/". InputFilter::securePath($httpVars["tmp_file"]);
+ $file = ApplicationState::getTemporaryFolder() ."/". InputFilter::securePath($httpVars["tmp_file"]);
if (isSet($file)) {
session_write_close();
header("Content-Type:image/png");
@@ -1317,7 +1317,7 @@ public function switchAction(ServerRequestInterface $requestInterface, ResponseI
session_write_close();
if (isSet($httpVars["tmp_file"])) {
- $file = ApplicationState::getAjxpTmpDir() ."/". InputFilter::securePath($httpVars["tmp_file"]);
+ $file = ApplicationState::getTemporaryFolder() ."/". InputFilter::securePath($httpVars["tmp_file"]);
if (isSet($file)) {
header("Content-Type:image/png");
readfile($file);
@@ -1341,10 +1341,10 @@ public function switchAction(ServerRequestInterface $requestInterface, ResponseI
} else {
$rand = substr(md5(time()), 0, 6);
$tmp = $rand."-". $boxData->getClientFilename();
- $boxData->moveTo(ApplicationState::getAjxpTmpDir() . "/" . $tmp);
+ $boxData->moveTo(ApplicationState::getTemporaryFolder() . "/" . $tmp);
}
}
- if (isSet($tmp) && file_exists(ApplicationState::getAjxpTmpDir() ."/".$tmp)) {
+ if (isSet($tmp) && file_exists(ApplicationState::getTemporaryFolder() ."/".$tmp)) {
print('<script type="text/javascript">');
print('parent.formManagerHiddenIFrameSubmission("'.$tmp.'");');
print('</script>');
@@ -74,7 +74,7 @@ protected function extractIndexableContent($ajxpNode)
$pipe = true;
}
$realFile = call_user_func(array($ajxpNode->wrapperClassName, "getRealFSReference"), $ajxpNode->getUrl());
- $unoconv = "HOME=" . ApplicationState::getAjxpTmpDir() . " " . $unoconv . " --stdout -f $targetExt " . escapeshellarg($realFile);
+ $unoconv = "HOME=" . ApplicationState::getTemporaryFolder() . " " . $unoconv . " --stdout -f $targetExt " . escapeshellarg($realFile);
if ($pipe) {
$newTarget = str_replace(".$ext", ".pdf", $realFile);
$unoconv .= " > $newTarget";
@@ -516,7 +516,7 @@ function print_thumbnail($image, $width, $height, $return_img = false, $display_
$isStream = (preg_match("!^$wrappers_re://!", $target_file) === 1);
if ($isStream) {
$backToStreamTarget = $target_file;
- $target_file = tempnam(ApplicationState::getAjxpTmpDir(), "pthumb_");
+ $target_file = tempnam(ApplicationState::getTemporaryFolder(), "pthumb_");
}
switch ($format) {
@@ -328,7 +328,7 @@ public function generateJpegsCallback(ContextInterface $ctx, $masterFile, $targe
$isStream = (preg_match( "!^$wrappers_re://!", $targetFile ) === 1);
if ($isStream) {
$backToStreamTarget = $targetFile;
- $targetFile = tempnam(ApplicationState::getAjxpTmpDir(), "imagick_").".pdf";
+ $targetFile = tempnam(ApplicationState::getTemporaryFolder(), "imagick_").".pdf";
}else{
$backToStreamTarget = null;
}
@@ -351,7 +351,7 @@ public function generateJpegsCallback(ContextInterface $ctx, $masterFile, $targe
if (stripos(PHP_OS, "win") === 0) {
$unoconv = $this->pluginConf["UNOCONV"]." -o ".escapeshellarg(basename($unoDoc))." -f pdf ".escapeshellarg($masterFile);
} else {
- $unoconv = "HOME=". ApplicationState::getAjxpTmpDir() ." ".$unoconv." --stdout -f pdf ".escapeshellarg($masterFile)." > ".escapeshellarg(basename($unoDoc));
+ $unoconv = "HOME=". ApplicationState::getTemporaryFolder() ." ".$unoconv." --stdout -f pdf ".escapeshellarg($masterFile)." > ".escapeshellarg(basename($unoDoc));
}
if(defined('AJXP_LOCALE')){
putenv('LC_CTYPE='.AJXP_LOCALE);
@@ -227,7 +227,7 @@ public function switchActions($actionName, $httpVars, $fileVars, ContextInterfac
$fileUrl = $selection->getUniqueNode()->getUrl();
$file = MetaStreamWrapper::getRealFSReference($fileUrl, true);
if ($actionName == "filehasher_delta") {
- $deltaFile = tempnam(ApplicationState::getAjxpTmpDir(), $actionName."-delta");
+ $deltaFile = tempnam(ApplicationState::getTemporaryFolder(), $actionName."-delta");
$this->logDebug("Received signature file, should compute delta now");
\rsync_generate_delta($signature_delta_file, $file, $deltaFile);
$this->logDebug("Computed delta file, size is ".filesize($deltaFile));
Oops, something went wrong.

0 comments on commit 350f6a3

Please sign in to comment.