summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-01-09 00:33:22 +0100
committerMorris Jobke <hey@morrisjobke.de>2015-01-09 00:33:22 +0100
commit6a5f12beca175a0b9a951fa844eacfd21a8df3de (patch)
tree8e1b1b00109daaa1c7dd1f24f3f585d94c7a5b52 /lib
parent5311d92c5c9dc0de297e36e4009b1e99f386e6bd (diff)
parentf579f2bd948ca73a1af720e19517af9bdde11748 (diff)
downloadnextcloud-server-6a5f12beca175a0b9a951fa844eacfd21a8df3de.tar.gz
nextcloud-server-6a5f12beca175a0b9a951fa844eacfd21a8df3de.zip
Merge pull request #12988 from owncloud/logfile_download
Logfile download
Diffstat (limited to 'lib')
-rw-r--r--lib/private/log/owncloud.php9
-rw-r--r--lib/public/appframework/http/datadownloadresponse.php42
2 files changed, 50 insertions, 1 deletions
diff --git a/lib/private/log/owncloud.php b/lib/private/log/owncloud.php
index d257bd12d2a..c8ae61032aa 100644
--- a/lib/private/log/owncloud.php
+++ b/lib/private/log/owncloud.php
@@ -111,7 +111,7 @@ class OC_Log_Owncloud {
$entriesCount = 0;
$lines = 0;
// Loop through each character of the file looking for new lines
- while ($pos >= 0 && $entriesCount < $limit) {
+ while ($pos >= 0 && ($limit === null ||$entriesCount < $limit)) {
fseek($handle, $pos);
$ch = fgetc($handle);
if ($ch == "\n" || $pos == 0) {
@@ -141,4 +141,11 @@ class OC_Log_Owncloud {
}
return $entries;
}
+
+ /**
+ * @return string
+ */
+ public static function getLogFilePath() {
+ return self::$logFile;
+ }
}
diff --git a/lib/public/appframework/http/datadownloadresponse.php b/lib/public/appframework/http/datadownloadresponse.php
new file mode 100644
index 00000000000..326be927b2e
--- /dev/null
+++ b/lib/public/appframework/http/datadownloadresponse.php
@@ -0,0 +1,42 @@
+<?php
+/**
+ * @author Georg Ehrke
+ * @copyright 2014 Georg Ehrke <georg@ownCloud.com>
+ *
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+namespace OCP\AppFramework\Http;
+
+class DataDownloadResponse extends DownloadResponse {
+ /**
+ * @var string
+ */
+ private $data;
+
+ /**
+ * Creates a response that prompts the user to download the text
+ * @param string $data text to be downloaded
+ * @param string $filename the name that the downloaded file should have
+ * @param string $contentType the mimetype that the downloaded file should have
+ */
+ public function __construct($data, $filename, $contentType) {
+ $this->data = $data;
+ parent::__construct($filename, $contentType);
+ }
+
+ /**
+ * @param string $data
+ */
+ public function setData($data) {
+ $this->data = $data;
+ }
+
+ /**
+ * @return string
+ */
+ public function render() {
+ return $this->data;
+ }
+}