mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-04-07 14:06:11 +08:00
php: create folder with logs
This commit is contained in:
@ -32,7 +32,11 @@ require_once( dirname(__FILE__) . '/config.php' );
|
||||
require_once( dirname(__FILE__) . '/functions.php' );
|
||||
|
||||
function sendlog($msg, $logFileName) {
|
||||
file_put_contents($logFileName, $msg . PHP_EOL, FILE_APPEND);
|
||||
$logsFolder = "logs/";
|
||||
if (!file_exists($logsFolder)) {
|
||||
mkdir($logsFolder);
|
||||
}
|
||||
file_put_contents($logsFolder . $logFileName, $msg . PHP_EOL, FILE_APPEND);
|
||||
}
|
||||
|
||||
function guid() {
|
||||
@ -201,7 +205,7 @@ function getStoragePath($fileName, $userAddress = NULL) {
|
||||
if (!file_exists($directory) && !is_dir($directory)) {
|
||||
mkdir($directory);
|
||||
}
|
||||
sendlog("getStoragePath result: " . $directory . $fileName, "logs/common.log");
|
||||
sendlog("getStoragePath result: " . $directory . $fileName, "common.log");
|
||||
return $directory . $fileName;
|
||||
}
|
||||
|
||||
@ -248,7 +252,7 @@ function getVirtualPath($forDocumentServer) {
|
||||
|
||||
|
||||
$virtPath = serverPath($forDocumentServer) . '/' . $storagePath . getCurUserHostAddress() . '/';
|
||||
sendlog("getVirtualPath virtPath: " . $virtPath, "logs/common.log");
|
||||
sendlog("getVirtualPath virtPath: " . $virtPath, "common.log");
|
||||
return $virtPath;
|
||||
}
|
||||
|
||||
|
||||
@ -62,7 +62,7 @@
|
||||
|
||||
if(!@copy(dirname(__FILE__) . DIRECTORY_SEPARATOR . "app_data" . DIRECTORY_SEPARATOR . $demoName, getStoragePath($demoFilename)))
|
||||
{
|
||||
sendlog("Copy file error to ". getStoragePath($demoFilename), "logs/common.log");
|
||||
sendlog("Copy file error to ". getStoragePath($demoFilename), "common.log");
|
||||
//Copy error!!!
|
||||
}
|
||||
|
||||
|
||||
@ -52,7 +52,7 @@ if (isset($_GET["type"]) && !empty($_GET["type"])) { //Checks if type value exis
|
||||
|
||||
nocache_headers();
|
||||
|
||||
sendlog(serialize($_GET),"logs/webedior-ajax.log");
|
||||
sendlog(serialize($_GET), "webedior-ajax.log");
|
||||
|
||||
$type = $_GET["type"];
|
||||
|
||||
@ -144,8 +144,8 @@ function download() {
|
||||
}
|
||||
|
||||
function track() {
|
||||
sendlog("Track START", "logs/webedior-ajax.log");
|
||||
sendlog("_GET params: " . serialize( $_GET ), "logs/webedior-ajax.log");
|
||||
sendlog("Track START", "webedior-ajax.log");
|
||||
sendlog("_GET params: " . serialize( $_GET ), "webedior-ajax.log");
|
||||
|
||||
global $_trackerStatus;
|
||||
$data;
|
||||
@ -163,7 +163,7 @@ function track() {
|
||||
return $result;
|
||||
}
|
||||
|
||||
sendlog("InputStream data: " . serialize($data), "logs/webedior-ajax.log");
|
||||
sendlog("InputStream data: " . serialize($data), "webedior-ajax.log");
|
||||
|
||||
$status = $_trackerStatus[$data["status"]];
|
||||
|
||||
@ -183,12 +183,12 @@ function track() {
|
||||
$key = getDocEditorKey(downloadUri);
|
||||
|
||||
try {
|
||||
sendlog("Convert " . $downloadUri . " from " . $downloadExt . " to " . $curExt, "logs/webedior-ajax.log");
|
||||
sendlog("Convert " . $downloadUri . " from " . $downloadExt . " to " . $curExt, "webedior-ajax.log");
|
||||
$convertedUri;
|
||||
$percent = GetConvertedUri($downloadUri, $downloadExt, $curExt, $key, FALSE, $convertedUri);
|
||||
$downloadUri = $convertedUri;
|
||||
} catch (Exception $e) {
|
||||
sendlog("Convert after save ".$e->getMessage(), "logs/webedior-ajax.log");
|
||||
sendlog("Convert after save ".$e->getMessage(), "webedior-ajax.log");
|
||||
$result["error"] = "error: " . $e->getMessage();
|
||||
return $result;
|
||||
}
|
||||
@ -208,7 +208,7 @@ function track() {
|
||||
break;
|
||||
}
|
||||
|
||||
sendlog("track result: " . serialize($result), "logs/webedior-ajax.log");
|
||||
sendlog("track result: " . serialize($result), "webedior-ajax.log");
|
||||
return $result;
|
||||
}
|
||||
|
||||
@ -274,7 +274,7 @@ function delete() {
|
||||
unlink($filePath);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
sendlog("Deletion ".$e->getMessage(), "logs/webedior-ajax.log");
|
||||
sendlog("Deletion ".$e->getMessage(), "webedior-ajax.log");
|
||||
$result["error"] = "error: " . $e->getMessage();
|
||||
return $result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user