summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJörn Friedrich Dreyer <jfd@butonic.de>2013-02-22 07:02:51 -0800
committerJörn Friedrich Dreyer <jfd@butonic.de>2013-02-22 07:02:51 -0800
commite8da90d0f45ab870e3d5da6c766159c87bbb1b68 (patch)
tree9010016688ef9b7d357b7cda8c047dc9340a2e1d /apps
parent5c76fffc01cb01fca41863b9a35ea5f14175b861 (diff)
parent59582e0f3fb395378b88aec2a6d0689bb2ac039e (diff)
downloadnextcloud-server-e8da90d0f45ab870e3d5da6c766159c87bbb1b68.tar.gz
nextcloud-server-e8da90d0f45ab870e3d5da6c766159c87bbb1b68.zip
Merge pull request #1711 from owncloud/style-cleanup
Codestyle cleanup
Diffstat (limited to 'apps')
-rw-r--r--apps/files/ajax/upload.php3
-rw-r--r--apps/files_sharing/appinfo/update.php5
-rw-r--r--apps/files_sharing/lib/cache.php5
-rw-r--r--apps/files_sharing/lib/permissions.php3
-rw-r--r--apps/files_sharing/lib/share/file.php14
-rw-r--r--apps/files_sharing/lib/share/folder.php5
-rw-r--r--apps/files_sharing/lib/sharedstorage.php10
-rw-r--r--apps/files_sharing/public.php7
-rw-r--r--apps/files_sharing/templates/public.php20
-rw-r--r--apps/files_trashbin/lib/trash.php53
-rw-r--r--apps/files_versions/lib/versions.php36
-rw-r--r--apps/files_versions/templates/history.php3
-rw-r--r--apps/files_versions/templates/settings.php5
13 files changed, 114 insertions, 55 deletions
diff --git a/apps/files/ajax/upload.php b/apps/files/ajax/upload.php
index 9031c729eff..5b697777e47 100644
--- a/apps/files/ajax/upload.php
+++ b/apps/files/ajax/upload.php
@@ -26,8 +26,7 @@ foreach ($_FILES['files']['error'] as $error) {
UPLOAD_ERR_OK => $l->t('There is no error, the file uploaded with success'),
UPLOAD_ERR_INI_SIZE => $l->t('The uploaded file exceeds the upload_max_filesize directive in php.ini: ')
. ini_get('upload_max_filesize'),
- UPLOAD_ERR_FORM_SIZE => $l->t('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified'
- . ' in the HTML form'),
+ UPLOAD_ERR_FORM_SIZE => $l->t('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'),
UPLOAD_ERR_PARTIAL => $l->t('The uploaded file was only partially uploaded'),
UPLOAD_ERR_NO_FILE => $l->t('No file was uploaded'),
UPLOAD_ERR_NO_TMP_DIR => $l->t('Missing a temporary folder'),
diff --git a/apps/files_sharing/appinfo/update.php b/apps/files_sharing/appinfo/update.php
index 1d22b32b503..48e41e93048 100644
--- a/apps/files_sharing/appinfo/update.php
+++ b/apps/files_sharing/appinfo/update.php
@@ -52,7 +52,10 @@ if (version_compare($installedVersion, '0.3', '<')) {
}
catch (Exception $e) {
$update_error = true;
- OCP\Util::writeLog('files_sharing', 'Upgrade Routine: Skipping sharing "'.$row['source'].'" to "'.$shareWith.'" (error is "'.$e->getMessage().'")', OCP\Util::WARN);
+ OCP\Util::writeLog('files_sharing',
+ 'Upgrade Routine: Skipping sharing "'.$row['source'].'" to "'.$shareWith
+ .'" (error is "'.$e->getMessage().'")',
+ OCP\Util::WARN);
}
OC_Util::tearDownFS();
}
diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php
index 9655e447875..fb0f6c7b5a6 100644
--- a/apps/files_sharing/lib/cache.php
+++ b/apps/files_sharing/lib/cache.php
@@ -71,8 +71,9 @@ class Shared_Cache extends Cache {
}
} else {
$query = \OC_DB::prepare(
- 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `encrypted`
- FROM `*PREFIX*filecache` WHERE `fileid` = ?');
+ 'SELECT `fileid`, `storage`, `path`, `parent`, `name`, `mimetype`, `mimepart`,'
+ .' `size`, `mtime`, `encrypted`'
+ .' FROM `*PREFIX*filecache` WHERE `fileid` = ?');
$result = $query->execute(array($file));
$data = $result->fetchRow();
$data['fileid'] = (int)$data['fileid'];
diff --git a/apps/files_sharing/lib/permissions.php b/apps/files_sharing/lib/permissions.php
index 2b068ff9350..72c1ec96c46 100644
--- a/apps/files_sharing/lib/permissions.php
+++ b/apps/files_sharing/lib/permissions.php
@@ -33,7 +33,8 @@ class Shared_Permissions extends Permissions {
if ($fileId == -1) {
return \OCP\PERMISSION_READ;
}
- $source = \OCP\Share::getItemSharedWithBySource('file', $fileId, \OC_Share_Backend_File::FORMAT_SHARED_STORAGE, null, true);
+ $source = \OCP\Share::getItemSharedWithBySource('file', $fileId, \OC_Share_Backend_File::FORMAT_SHARED_STORAGE,
+ null, true);
if ($source) {
return $source['permissions'];
} else {
diff --git a/apps/files_sharing/lib/share/file.php b/apps/files_sharing/lib/share/file.php
index 6d3c55a008f..0aeb763d89a 100644
--- a/apps/files_sharing/lib/share/file.php
+++ b/apps/files_sharing/lib/share/file.php
@@ -72,7 +72,11 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
public function formatItems($items, $format, $parameters = null) {
if ($format == self::FORMAT_SHARED_STORAGE) {
// Only 1 item should come through for this format call
- return array('path' => $items[key($items)]['path'], 'permissions' => $items[key($items)]['permissions'], 'uid_owner' => $items[key($items)]['uid_owner']);
+ return array(
+ 'path' => $items[key($items)]['path'],
+ 'permissions' => $items[key($items)]['permissions'],
+ 'uid_owner' => $items[key($items)]['uid_owner']
+ );
} else if ($format == self::FORMAT_GET_FOLDER_CONTENTS) {
$files = array();
foreach ($items as $item) {
@@ -99,7 +103,13 @@ class OC_Share_Backend_File implements OCP\Share_Backend_File_Dependent {
}
$size += (int)$item['size'];
}
- return array('fileid' => -1, 'name' => 'Shared', 'mtime' => $mtime, 'mimetype' => 'httpd/unix-directory', 'size' => $size);
+ return array(
+ 'fileid' => -1,
+ 'name' => 'Shared',
+ 'mtime' => $mtime,
+ 'mimetype' => 'httpd/unix-directory',
+ 'size' => $size
+ );
} else if ($format == self::FORMAT_OPENDIR) {
$files = array();
foreach ($items as $item) {
diff --git a/apps/files_sharing/lib/share/folder.php b/apps/files_sharing/lib/share/folder.php
index 11c8c6b1e80..4426beec636 100644
--- a/apps/files_sharing/lib/share/folder.php
+++ b/apps/files_sharing/lib/share/folder.php
@@ -33,7 +33,8 @@ class OC_Share_Backend_Folder extends OC_Share_Backend_File implements OCP\Share
}
while (!empty($parents)) {
$parents = "'".implode("','", $parents)."'";
- $query = OC_DB::prepare('SELECT `fileid`, `name`, `mimetype` FROM `*PREFIX*filecache` WHERE `parent` IN ('.$parents.')');
+ $query = OC_DB::prepare('SELECT `fileid`, `name`, `mimetype` FROM `*PREFIX*filecache`'
+ .' WHERE `parent` IN ('.$parents.')');
$result = $query->execute();
$parents = array();
while ($file = $result->fetchRow()) {
@@ -47,4 +48,4 @@ class OC_Share_Backend_Folder extends OC_Share_Backend_File implements OCP\Share
return $children;
}
-} \ No newline at end of file
+}
diff --git a/apps/files_sharing/lib/sharedstorage.php b/apps/files_sharing/lib/sharedstorage.php
index 65812b7e2fd..c7521949da1 100644
--- a/apps/files_sharing/lib/sharedstorage.php
+++ b/apps/files_sharing/lib/sharedstorage.php
@@ -240,7 +240,8 @@ class Shared extends \OC\Files\Storage\Common {
public function file_put_contents($path, $data) {
if ($source = $this->getSourcePath($path)) {
// Check if permission is granted
- if (($this->file_exists($path) && !$this->isUpdatable($path)) || ($this->is_dir($path) && !$this->isCreatable($path))) {
+ if (($this->file_exists($path) && !$this->isUpdatable($path))
+ || ($this->is_dir($path) && !$this->isCreatable($path))) {
return false;
}
$info = array(
@@ -390,9 +391,12 @@ class Shared extends \OC\Files\Storage\Common {
}
public static function setup($options) {
- if (!\OCP\User::isLoggedIn() || \OCP\User::getUser() != $options['user'] || \OCP\Share::getItemsSharedWith('file')) {
+ if (!\OCP\User::isLoggedIn() || \OCP\User::getUser() != $options['user']
+ || \OCP\Share::getItemsSharedWith('file')) {
$user_dir = $options['user_dir'];
- \OC\Files\Filesystem::mount('\OC\Files\Storage\Shared', array('sharedFolder' => '/Shared'), $user_dir.'/Shared/');
+ \OC\Files\Filesystem::mount('\OC\Files\Storage\Shared',
+ array('sharedFolder' => '/Shared'),
+ $user_dir.'/Shared/');
}
}
diff --git a/apps/files_sharing/public.php b/apps/files_sharing/public.php
index 38d598f7780..f265a7dd014 100644
--- a/apps/files_sharing/public.php
+++ b/apps/files_sharing/public.php
@@ -171,7 +171,9 @@ if (isset($path)) {
$list->assign('files', $files, false);
$list->assign('disableSharing', true);
$list->assign('baseURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&path=', false);
- $list->assign('downloadURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&download&path=', false);
+ $list->assign('downloadURL',
+ OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&download&path=',
+ false);
$breadcrumbNav = new OCP\Template('files', 'part.breadcrumb', '');
$breadcrumbNav->assign('breadcrumb', $breadcrumb, false);
$breadcrumbNav->assign('baseURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&path=', false);
@@ -188,7 +190,8 @@ if (isset($path)) {
$folder->assign('usedSpacePercent', 0);
$tmpl->assign('folder', $folder->fetchPage(), false);
$tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true)));
- $tmpl->assign('downloadURL', OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&download&path=' . urlencode($getPath));
+ $tmpl->assign('downloadURL',
+ OCP\Util::linkToPublic('files') . $urlLinkIdentifiers . '&download&path=' . urlencode($getPath));
} else {
$tmpl->assign('dir', $dir);
diff --git a/apps/files_sharing/templates/public.php b/apps/files_sharing/templates/public.php
index 7776fd63b3c..f9ff12679bc 100644
--- a/apps/files_sharing/templates/public.php
+++ b/apps/files_sharing/templates/public.php
@@ -3,15 +3,20 @@
<input type="hidden" name="filename" value="<?php echo $_['filename'] ?>" id="filename">
<input type="hidden" name="mimetype" value="<?php echo $_['mimetype'] ?>" id="mimetype">
<header><div id="header">
- <a href="<?php echo link_to('', 'index.php'); ?>" title="" id="owncloud"><img class="svg" src="<?php echo image_path('', 'logo-wide.svg'); ?>" alt="ownCloud" /></a>
+ <a href="<?php echo link_to('', 'index.php'); ?>" title="" id="owncloud"><img class="svg"
+ src="<?php echo image_path('', 'logo-wide.svg'); ?>" alt="ownCloud" /></a>
<div class="header-right">
<?php if (isset($_['folder'])): ?>
- <span id="details"><?php echo $l->t('%s shared the folder %s with you', array($_['displayName'], $_['fileTarget'])) ?></span>
+ <span id="details"><?php echo $l->t('%s shared the folder %s with you',
+ array($_['displayName'], $_['fileTarget'])) ?></span>
<?php else: ?>
- <span id="details"><?php echo $l->t('%s shared the file %s with you', array($_['displayName'], $_['fileTarget'])) ?></span>
+ <span id="details"><?php echo $l->t('%s shared the file %s with you',
+ array($_['displayName'], $_['fileTarget'])) ?></span>
<?php endif; ?>
<?php if (!isset($_['folder']) || $_['allowZipDownload']): ?>
- <a href="<?php echo $_['downloadURL']; ?>" class="button" id="download"><img class="svg" alt="Download" src="<?php echo OCP\image_path("core", "actions/download.svg"); ?>" /><?php echo $l->t('Download')?></a>
+ <a href="<?php echo $_['downloadURL']; ?>" class="button" id="download"><img
+ class="svg" alt="Download" src="<?php echo OCP\image_path("core", "actions/download.svg"); ?>"
+ /><?php echo $l->t('Download')?></a>
<?php endif; ?>
</div>
</div></header>
@@ -27,9 +32,12 @@
<ul id="noPreview">
<li class="error">
<?php echo $l->t('No preview available for').' '.$_['fileTarget']; ?><br />
- <a href="<?php echo $_['downloadURL']; ?>" id="download"><img class="svg" alt="Download" src="<?php echo OCP\image_path("core", "actions/download.svg"); ?>" /><?php echo $l->t('Download')?></a>
+ <a href="<?php echo $_['downloadURL']; ?>" id="download"><img class="svg" alt="Download"
+ src="<?php echo OCP\image_path("core", "actions/download.svg"); ?>"
+ /><?php echo $l->t('Download')?></a>
</li>
</ul>
<?php endif; ?>
</div>
-<footer><p class="info"><a href="http://owncloud.org/">ownCloud</a> &ndash; <?php echo $l->t('web services under your control'); ?></p></footer>
+<footer><p class="info"><a href="http://owncloud.org/">ownCloud</a> &ndash;
+<?php echo $l->t('web services under your control'); ?></p></footer>
diff --git a/apps/files_trashbin/lib/trash.php b/apps/files_trashbin/lib/trash.php
index 8d54a471b42..2b8b32c3a16 100644
--- a/apps/files_trashbin/lib/trash.php
+++ b/apps/files_trashbin/lib/trash.php
@@ -23,9 +23,11 @@
namespace OCA\Files_Trashbin;
class Trashbin {
-
- const DEFAULT_RETENTION_OBLIGATION=180; // how long do we keep files in the trash bin if no other value is defined in the config file (unit: days)
- const DEFAULTMAXSIZE=50; // unit: percentage; 50% of available disk space/quota
+ // how long do we keep files in the trash bin if no other value is defined in the config file (unit: days)
+ const DEFAULT_RETENTION_OBLIGATION=180;
+
+ // unit: percentage; 50% of available disk space/quota
+ const DEFAULTMAXSIZE=50;
/**
* move file to the trash bin
@@ -60,7 +62,8 @@ class Trashbin {
$trashbinSize += self::copy_recursive($file_path, 'files_trashbin/'.$deleted.'.d'.$timestamp, $view);
if ( $view->file_exists('files_trashbin/'.$deleted.'.d'.$timestamp) ) {
- $query = \OC_DB::prepare("INSERT INTO *PREFIX*files_trash (id,timestamp,location,type,mime,user) VALUES (?,?,?,?,?,?)");
+ $query = \OC_DB::prepare("INSERT INTO *PREFIX*files_trash (id,timestamp,location,type,mime,user)"
+ ." VALUES (?,?,?,?,?,?)");
$result = $query->execute(array($deleted, $timestamp, $location, $type, $mime, $user));
if ( !$result ) { // if file couldn't be added to the database than also don't store it in the trash bin.
$view->deleteAll('files_trashbin/'.$deleted.'.d'.$timestamp);
@@ -70,12 +73,15 @@ class Trashbin {
if ( \OCP\App::isEnabled('files_versions') ) {
if ( $view->is_dir('files_versions'.$file_path) ) {
- $trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/files_versions/'.$file_path));
+ $trashbinSize += self::calculateSize(
+ new \OC_FilesystemView('/'. $user.'/files_versions/'.$file_path)
+ );
$view->rename('files_versions'.$file_path, 'versions_trashbin/'. $deleted.'.d'.$timestamp);
} else if ( $versions = \OCA\Files_Versions\Storage::getVersions($file_path) ) {
foreach ($versions as $v) {
$trashbinSize += $view->filesize('files_versions'.$v['path'].'.v'.$v['version']);
- $view->rename('files_versions'.$v['path'].'.v'.$v['version'], 'versions_trashbin/'. $deleted.'.v'.$v['version'].'.d'.$timestamp);
+ $view->rename('files_versions'.$v['path'].'.v'.$v['version'],
+ 'versions_trashbin/'. $deleted.'.v'.$v['version'].'.d'.$timestamp);
}
}
}
@@ -121,7 +127,8 @@ class Trashbin {
$trashbinSize += self::calculateSize(new \OC_FilesystemView('/'. $user.'/versions_trashbin'));
}
if ( $timestamp ) {
- $query = \OC_DB::prepare('SELECT location,type FROM *PREFIX*files_trash WHERE user=? AND id=? AND timestamp=?');
+ $query = \OC_DB::prepare('SELECT location,type FROM *PREFIX*files_trash'
+ .' WHERE user=? AND id=? AND timestamp=?');
$result = $query->execute(array($user,$filename,$timestamp))->fetchAll();
if ( count($result) != 1 ) {
\OC_Log::write('files_trashbin', 'trash bin database inconsistent!', \OC_Log::ERROR);
@@ -131,7 +138,7 @@ class Trashbin {
// if location no longer exists, restore file in the root directory
$location = $result[0]['location'];
if ( $result[0]['location'] != '/' &&
- (!$view->is_dir('files'.$result[0]['location']) ||
+ (!$view->is_dir('files'.$result[0]['location']) ||
!$view->isUpdatable('files'.$result[0]['location'])) ) {
$location = '';
}
@@ -165,16 +172,21 @@ class Trashbin {
$versionedFile = $file;
}
if ( $result[0]['type'] == 'dir' ) {
- $trashbinSize -= self::calculateSize(new \OC_FilesystemView('/'.$user.'/'.'versions_trashbin/'. $file));
- $view->rename(\OC_Filesystem::normalizePath('versions_trashbin/'. $file), \OC_Filesystem::normalizePath('files_versions/'.$location.'/'.$filename.$ext));
+ $trashbinSize -= self::calculateSize(
+ new \OC_FilesystemView('/'.$user.'/'.'versions_trashbin/'. $file)
+ );
+ $view->rename(\OC_Filesystem::normalizePath('versions_trashbin/'. $file),
+ \OC_Filesystem::normalizePath('files_versions/'.$location.'/'.$filename.$ext));
} else if ( $versions = self::getVersionsFromTrash($versionedFile, $timestamp) ) {
foreach ($versions as $v) {
if ($timestamp ) {
$trashbinSize -= $view->filesize('versions_trashbin/'.$versionedFile.'.v'.$v.'.d'.$timestamp);
- $view->rename('versions_trashbin/'.$versionedFile.'.v'.$v.'.d'.$timestamp, 'files_versions/'.$location.'/'.$filename.$ext.'.v'.$v);
+ $view->rename('versions_trashbin/'.$versionedFile.'.v'.$v.'.d'.$timestamp,
+ 'files_versions/'.$location.'/'.$filename.$ext.'.v'.$v);
} else {
$trashbinSize -= $view->filesize('versions_trashbin/'.$versionedFile.'.v'.$v);
- $view->rename('versions_trashbin/'.$versionedFile.'.v'.$v, 'files_versions/'.$location.'/'.$filename.$ext.'.v'.$v);
+ $view->rename('versions_trashbin/'.$versionedFile.'.v'.$v,
+ 'files_versions/'.$location.'/'.$filename.$ext.'.v'.$v);
}
}
}
@@ -280,7 +292,8 @@ class Trashbin {
$query = \OC_DB::prepare('SELECT location,type,id,timestamp FROM *PREFIX*files_trash WHERE user=?');
$result = $query->execute(array($user))->fetchAll();
- $retention_obligation = \OC_Config::getValue('trashbin_retention_obligation', self::DEFAULT_RETENTION_OBLIGATION);
+ $retention_obligation = \OC_Config::getValue('trashbin_retention_obligation',
+ self::DEFAULT_RETENTION_OBLIGATION);
$limit = time() - ($retention_obligation * 86400);
@@ -289,13 +302,17 @@ class Trashbin {
$filename = $r['id'];
if ( $r['timestamp'] < $limit ) {
if ($view->is_dir('files_trashbin/'.$filename.'.d'.$timestamp)) {
- $size += self::calculateSize(new \OC_FilesystemView('/'.$user.'/files_trashbin/'.$filename.'.d'.$timestamp));
+ $size += self::calculateSize(
+ new \OC_FilesystemView('/'.$user.'/files_trashbin/'.$filename.'.d'.$timestamp)
+ );
} else {
$size += $view->filesize('files_trashbin/'.$filename.'.d'.$timestamp);
}
$view->unlink('files_trashbin/'.$filename.'.d'.$timestamp);
if ($r['type'] == 'dir') {
- $size += self::calculateSize(new \OC_FilesystemView('/'.$user.'/versions_trashbin/'.$filename.'.d'.$timestamp));
+ $size += self::calculateSize(
+ new \OC_FilesystemView('/'.$user.'/versions_trashbin/'.$filename.'.d'.$timestamp)
+ );
$view->unlink('versions_trashbin/'.$filename.'.d'.$timestamp);
} else if ( $versions = self::getVersionsFromTrash($filename, $timestamp) ) {
foreach ($versions as $v) {
@@ -312,7 +329,8 @@ class Trashbin {
$availableSpace = $availableSpace + $size;
// if size limit for trash bin reached, delete oldest files in trash bin
if ($availableSpace < 0) {
- $query = \OC_DB::prepare('SELECT location,type,id,timestamp FROM *PREFIX*files_trash WHERE user=? ORDER BY timestamp ASC');
+ $query = \OC_DB::prepare('SELECT location,type,id,timestamp FROM *PREFIX*files_trash'
+ .' WHERE user=? ORDER BY timestamp ASC');
$result = $query->execute(array($user))->fetchAll();
$length = count($result);
$i = 0;
@@ -418,7 +436,8 @@ class Trashbin {
if (!file_exists($root)) {
return 0;
}
- $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($root), \RecursiveIteratorIterator::CHILD_FIRST);
+ $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($root),
+ \RecursiveIteratorIterator::CHILD_FIRST);
$size = 0;
foreach ($iterator as $path) {
diff --git a/apps/files_versions/lib/versions.php b/apps/files_versions/lib/versions.php
index 95c7991bad6..8a67de04d83 100644
--- a/apps/files_versions/lib/versions.php
+++ b/apps/files_versions/lib/versions.php
@@ -21,19 +21,19 @@ class Storage {
const DEFAULTMAXSIZE=50; // unit: percentage; 50% of available disk space/quota
private static $max_versions_per_interval = array(
- 1 => array('intervalEndsAfter' => 10, //first 10sec, one version every 2sec
- 'step' => 2),
- 2 => array('intervalEndsAfter' => 60, //next minute, one version every 10sec
- 'step' => 10),
- 3 => array('intervalEndsAfter' => 3600, //next hour, one version every minute
- 'step' => 60),
- 4 => array('intervalEndsAfter' => 86400, //next 24h, one version every hour
- 'step' => 3600),
- 5 => array('intervalEndsAfter' => 2592000, //next 30days, one version per day
- 'step' => 86400),
- 6 => array('intervalEndsAfter' => -1, //until the end one version per week
- 'step' => 604800),
- );
+ //first 10sec, one version every 2sec
+ 1 => array('intervalEndsAfter' => 10, 'step' => 2),
+ //next minute, one version every 10sec
+ 2 => array('intervalEndsAfter' => 60, 'step' => 10),
+ //next hour, one version every minute
+ 3 => array('intervalEndsAfter' => 3600, 'step' => 60),
+ //next 24h, one version every hour
+ 4 => array('intervalEndsAfter' => 86400, 'step' => 3600),
+ //next 30days, one version per day
+ 5 => array('intervalEndsAfter' => 2592000, 'step' => 86400),
+ //until the end one version per week
+ 6 => array('intervalEndsAfter' => -1, 'step' => 604800),
+ );
private static function getUidAndFilename($filename) {
$uid = \OC\Files\Filesystem::getOwner($filename);
@@ -239,7 +239,10 @@ class Storage {
$versions_fileview = new \OC\Files\View('/'.$uid.'/files_versions');
$versionsRoot = \OCP\Config::getSystemValue('datadirectory').$versions_fileview->getAbsolutePath('');
- $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($versionsRoot), \RecursiveIteratorIterator::CHILD_FIRST);
+ $iterator = new \RecursiveIteratorIterator(
+ new \RecursiveDirectoryIterator($versionsRoot),
+ \RecursiveIteratorIterator::CHILD_FIRST
+ );
$size = 0;
@@ -264,7 +267,10 @@ class Storage {
$versions_fileview = new \OC\Files\View('/'.$uid.'/files_versions');
$versionsRoot = \OCP\Config::getSystemValue('datadirectory').$versions_fileview->getAbsolutePath('');
- $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($versionsRoot), \RecursiveIteratorIterator::CHILD_FIRST);
+ $iterator = new \RecursiveIteratorIterator(
+ new \RecursiveDirectoryIterator($versionsRoot),
+ \RecursiveIteratorIterator::CHILD_FIRST
+ );
$versions = array();
diff --git a/apps/files_versions/templates/history.php b/apps/files_versions/templates/history.php
index 850ece89c98..c450af66ad5 100644
--- a/apps/files_versions/templates/history.php
+++ b/apps/files_versions/templates/history.php
@@ -22,7 +22,8 @@ if( isset( $_['message'] ) ) {
foreach ( $_['versions'] as $v ) {
echo ' ';
echo OCP\Util::formatDate( doubleval($v['version']) );
- echo ' <a href="'.OCP\Util::linkTo('files_versions', 'history.php', array('path' => $_['path'], 'revert' => $v['version'])) .'" class="button">Revert</a><br /><br />';
+ echo ' <a href="'.OCP\Util::linkTo('files_versions', 'history.php',
+ array('path' => $_['path'], 'revert' => $v['version'])) .'" class="button">Revert</a><br /><br />';
if ( $v['cur'] ) {
echo ' (<b>Current</b>)';
}
diff --git a/apps/files_versions/templates/settings.php b/apps/files_versions/templates/settings.php
index bfca8366f5d..3b8e4baf119 100644
--- a/apps/files_versions/templates/settings.php
+++ b/apps/files_versions/templates/settings.php
@@ -1,6 +1,9 @@
<form id="versionssettings">
<fieldset class="personalblock">
<legend><strong><?php echo $l->t('Files Versioning');?></strong></legend>
- <input type="checkbox" name="versions" id="versions" value="1" <?php if (OCP\Config::getSystemValue('versions', 'true')=='true') echo ' checked="checked"'; ?> /> <label for="versions"><?php echo $l->t('Enable'); ?></label> <br/>
+ <input type="checkbox" name="versions" id="versions" value="1"
+ <?php if (OCP\Config::getSystemValue('versions', 'true')=='true')
+ echo ' checked="checked"';
+ ?> /> <label for="versions"><?php echo $l->t('Enable'); ?></label> <br/>
</fieldset>
</form>