Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2014-03-18 20:14:38 +0400
committerThomas Müller <thomas.mueller@tmit.eu>2014-03-18 20:14:38 +0400
commit6b9ae27b90ee5649fcab2417ebaf14e87559756e (patch)
treea5ce01aee8c99e2d4a37c1f090c7a1d82443af41 /apps
parentf6c3667efa32d0fa24307b3acc3a239081bf6410 (diff)
drop file cache migration OC5 -> OC6
Diffstat (limited to 'apps')
-rw-r--r--apps/files/ajax/upgrade.php44
-rw-r--r--apps/files/index.php135
-rw-r--r--apps/files/js/upgrade.js28
-rw-r--r--apps/files/templates/upgrade.php4
4 files changed, 62 insertions, 149 deletions
diff --git a/apps/files/ajax/upgrade.php b/apps/files/ajax/upgrade.php
deleted file mode 100644
index 7237b02c0b0..00000000000
--- a/apps/files/ajax/upgrade.php
+++ /dev/null
@@ -1,44 +0,0 @@
-<?php
-set_time_limit(0); //scanning can take ages
-session_write_close();
-
-$user = OC_User::getUser();
-$eventSource = new OC_EventSource();
-$listener = new UpgradeListener($eventSource);
-$legacy = new \OC\Files\Cache\Legacy($user);
-
-if ($legacy->hasItems()) {
- OC_Hook::connect('\OC\Files\Cache\Upgrade', 'migrate_path', $listener, 'upgradePath');
-
- OC_DB::beginTransaction();
- $upgrade = new \OC\Files\Cache\Upgrade($legacy);
- $count = $legacy->getCount();
- $eventSource->send('total', $count);
- $upgrade->upgradePath('/' . $user . '/files');
- OC_DB::commit();
-}
-\OC\Files\Cache\Upgrade::upgradeDone($user);
-$eventSource->send('done', true);
-$eventSource->close();
-
-class UpgradeListener {
- /**
- * @var OC_EventSource $eventSource
- */
- private $eventSource;
-
- private $count = 0;
- private $lastSend = 0;
-
- public function __construct($eventSource) {
- $this->eventSource = $eventSource;
- }
-
- public function upgradePath($path) {
- $this->count++;
- if ($this->count > ($this->lastSend + 5)) {
- $this->lastSend = $this->count;
- $this->eventSource->send('count', $this->count);
- }
- }
-}
diff --git a/apps/files/index.php b/apps/files/index.php
index ad7a2e210ed..c66cd40fb56 100644
--- a/apps/files/index.php
+++ b/apps/files/index.php
@@ -62,22 +62,17 @@ if ($isIE8 && isset($_GET['dir'])){
$ajaxLoad = false;
$files = array();
$user = OC_User::getUser();
-if (\OC\Files\Cache\Upgrade::needUpgrade($user)) { //dont load anything if we need to upgrade the cache
- $needUpgrade = true;
-} else {
- if ($isIE8){
- // after the redirect above, the URL will have a format
- // like "files#?dir=path" which means that no path was given
- // (dir is not set). In that specific case, we don't return any
- // files because the client will take care of switching the dir
- // to the one from the hash, then ajax-load the initial file list
- $files = array();
- $ajaxLoad = true;
- }
- else{
- $files = \OCA\Files\Helper::getFiles($dir);
- }
- $needUpgrade = false;
+if ($isIE8){
+ // after the redirect above, the URL will have a format
+ // like "files#?dir=path" which means that no path was given
+ // (dir is not set). In that specific case, we don't return any
+ // files because the client will take care of switching the dir
+ // to the one from the hash, then ajax-load the initial file list
+ $files = array();
+ $ajaxLoad = true;
+}
+else{
+ $files = \OCA\Files\Helper::getFiles($dir);
}
$config = \OC::$server->getConfig();
@@ -97,62 +92,56 @@ $breadcrumbNav->assign('baseURL', OCP\Util::linkTo('files', 'index.php') . '?dir
$permissions = $dirInfo->getPermissions();
-if ($needUpgrade) {
- OCP\Util::addscript('files', 'upgrade');
- $tmpl = new OCP\Template('files', 'upgrade', 'user');
- $tmpl->printPage();
-} else {
- // information about storage capacities
- $storageInfo=OC_Helper::getStorageInfo($dir);
- $freeSpace=$storageInfo['free'];
- $uploadLimit=OCP\Util::uploadLimit();
- $maxUploadFilesize=OCP\Util::maxUploadFilesize($dir);
- $publicUploadEnabled = $config->getAppValue('core', 'shareapi_allow_public_upload', 'yes');
- // if the encryption app is disabled, than everything is fine (INIT_SUCCESSFUL status code)
- $encryptionInitStatus = 2;
- if (OC_App::isEnabled('files_encryption')) {
- $session = new \OCA\Encryption\Session(new \OC\Files\View('/'));
- $encryptionInitStatus = $session->getInitialized();
- }
-
- $trashEnabled = \OCP\App::isEnabled('files_trashbin');
- $trashEmpty = true;
- if ($trashEnabled) {
- $trashEmpty = \OCA\Files_Trashbin\Trashbin::isEmpty($user);
- }
+// information about storage capacities
+$storageInfo=OC_Helper::getStorageInfo($dir);
+$freeSpace=$storageInfo['free'];
+$uploadLimit=OCP\Util::uploadLimit();
+$maxUploadFilesize=OCP\Util::maxUploadFilesize($dir);
+$publicUploadEnabled = $config->getAppValue('core', 'shareapi_allow_public_upload', 'yes');
+// if the encryption app is disabled, than everything is fine (INIT_SUCCESSFUL status code)
+$encryptionInitStatus = 2;
+if (OC_App::isEnabled('files_encryption')) {
+ $session = new \OCA\Encryption\Session(new \OC\Files\View('/'));
+ $encryptionInitStatus = $session->getInitialized();
+}
- $isCreatable = \OC\Files\Filesystem::isCreatable($dir . '/');
- $fileHeader = (!isset($files) or count($files) > 0);
- $emptyContent = ($isCreatable and !$fileHeader) or $ajaxLoad;
-
- OCP\Util::addscript('files', 'fileactions');
- OCP\Util::addscript('files', 'files');
- OCP\Util::addscript('files', 'keyboardshortcuts');
- $tmpl = new OCP\Template('files', 'index', 'user');
- $tmpl->assign('fileList', $list->fetchPage());
- $tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage());
- $tmpl->assign('dir', $dir);
- $tmpl->assign('isCreatable', $isCreatable);
- $tmpl->assign('permissions', $permissions);
- $tmpl->assign('files', $files);
- $tmpl->assign('trash', $trashEnabled);
- $tmpl->assign('trashEmpty', $trashEmpty);
- $tmpl->assign('uploadMaxFilesize', $maxUploadFilesize); // minimium of freeSpace and uploadLimit
- $tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize));
- $tmpl->assign('freeSpace', $freeSpace);
- $tmpl->assign('uploadLimit', $uploadLimit); // PHP upload limit
- $tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true)));
- $tmpl->assign('usedSpacePercent', (int)$storageInfo['relative']);
- $tmpl->assign('isPublic', false);
- $tmpl->assign('publicUploadEnabled', $publicUploadEnabled);
- $tmpl->assign("encryptedFiles", \OCP\Util::encryptedFiles());
- $tmpl->assign("mailNotificationEnabled", $config->getAppValue('core', 'shareapi_allow_mail_notification', 'yes'));
- $tmpl->assign("allowShareWithLink", $config->getAppValue('core', 'shareapi_allow_links', 'yes'));
- $tmpl->assign("encryptionInitStatus", $encryptionInitStatus);
- $tmpl->assign('disableSharing', false);
- $tmpl->assign('ajaxLoad', $ajaxLoad);
- $tmpl->assign('emptyContent', $emptyContent);
- $tmpl->assign('fileHeader', $fileHeader);
-
- $tmpl->printPage();
+$trashEnabled = \OCP\App::isEnabled('files_trashbin');
+$trashEmpty = true;
+if ($trashEnabled) {
+ $trashEmpty = \OCA\Files_Trashbin\Trashbin::isEmpty($user);
}
+
+$isCreatable = \OC\Files\Filesystem::isCreatable($dir . '/');
+$fileHeader = (!isset($files) or count($files) > 0);
+$emptyContent = ($isCreatable and !$fileHeader) or $ajaxLoad;
+
+OCP\Util::addscript('files', 'fileactions');
+OCP\Util::addscript('files', 'files');
+OCP\Util::addscript('files', 'keyboardshortcuts');
+$tmpl = new OCP\Template('files', 'index', 'user');
+$tmpl->assign('fileList', $list->fetchPage());
+$tmpl->assign('breadcrumb', $breadcrumbNav->fetchPage());
+$tmpl->assign('dir', $dir);
+$tmpl->assign('isCreatable', $isCreatable);
+$tmpl->assign('permissions', $permissions);
+$tmpl->assign('files', $files);
+$tmpl->assign('trash', $trashEnabled);
+$tmpl->assign('trashEmpty', $trashEmpty);
+$tmpl->assign('uploadMaxFilesize', $maxUploadFilesize); // minimium of freeSpace and uploadLimit
+$tmpl->assign('uploadMaxHumanFilesize', OCP\Util::humanFileSize($maxUploadFilesize));
+$tmpl->assign('freeSpace', $freeSpace);
+$tmpl->assign('uploadLimit', $uploadLimit); // PHP upload limit
+$tmpl->assign('allowZipDownload', intval(OCP\Config::getSystemValue('allowZipDownload', true)));
+$tmpl->assign('usedSpacePercent', (int)$storageInfo['relative']);
+$tmpl->assign('isPublic', false);
+$tmpl->assign('publicUploadEnabled', $publicUploadEnabled);
+$tmpl->assign("encryptedFiles", \OCP\Util::encryptedFiles());
+$tmpl->assign("mailNotificationEnabled", $config->getAppValue('core', 'shareapi_allow_mail_notification', 'yes'));
+$tmpl->assign("allowShareWithLink", $config->getAppValue('core', 'shareapi_allow_links', 'yes'));
+$tmpl->assign("encryptionInitStatus", $encryptionInitStatus);
+$tmpl->assign('disableSharing', false);
+$tmpl->assign('ajaxLoad', $ajaxLoad);
+$tmpl->assign('emptyContent', $emptyContent);
+$tmpl->assign('fileHeader', $fileHeader);
+
+$tmpl->printPage();
diff --git a/apps/files/js/upgrade.js b/apps/files/js/upgrade.js
deleted file mode 100644
index 714adf824a1..00000000000
--- a/apps/files/js/upgrade.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2014
- *
- * This file is licensed under the Affero General Public License version 3
- * or later.
- *
- * See the COPYING-README file.
- *
- */
-
-/* global OC */
-$(document).ready(function () {
- var eventSource, total, bar = $('#progressbar');
- console.log('start');
- bar.progressbar({value: 0});
- eventSource = new OC.EventSource(OC.filePath('files', 'ajax', 'upgrade.php'));
- eventSource.listen('total', function (count) {
- total = count;
- console.log(count + ' files needed to be migrated');
- });
- eventSource.listen('count', function (count) {
- bar.progressbar({value: (count / total) * 100});
- console.log(count);
- });
- eventSource.listen('done', function () {
- document.location.reload();
- });
-});
diff --git a/apps/files/templates/upgrade.php b/apps/files/templates/upgrade.php
deleted file mode 100644
index e03f086e47d..00000000000
--- a/apps/files/templates/upgrade.php
+++ /dev/null
@@ -1,4 +0,0 @@
-<div id="upgrade">
- <?php p($l->t('Upgrading filesystem cache...'));?>
- <div id="progressbar" />
-</div>