summaryrefslogtreecommitdiffstats
path: root/files
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-01-30 23:32:55 +0100
committerRobin Appelman <icewind@owncloud.com>2012-01-30 23:32:55 +0100
commitffecc3e4341102714a89ab6b5643c666c1feb0ee (patch)
tree8bfb658e085259440a1ad686a68bd3c1fff1f229 /files
parent8543e797132a0b99127d7813e24dbb9c024a4fe8 (diff)
downloadnextcloud-server-ffecc3e4341102714a89ab6b5643c666c1feb0ee.tar.gz
nextcloud-server-ffecc3e4341102714a89ab6b5643c666c1feb0ee.zip
start of proper feedback during filessytem scan
Diffstat (limited to 'files')
-rw-r--r--files/ajax/scan.php11
-rw-r--r--files/js/files.js12
2 files changed, 15 insertions, 8 deletions
diff --git a/files/ajax/scan.php b/files/ajax/scan.php
index dec949a819b..01236c83da1 100644
--- a/files/ajax/scan.php
+++ b/files/ajax/scan.php
@@ -2,15 +2,18 @@
require_once '../../lib/base.php';
+$eventSource=new OC_EventSource();
+
$force=isset($_GET['force']) and $_GET['force']=='true';
$checkOnly=isset($_GET['checkonly']) and $_GET['checkonly']=='true';
//create the file cache if necesary
if($force or !OC_FileCache::inCache('')){
if(!$checkOnly){
- OC_FileCache::scan('');
+ OC_FileCache::scan('',false,$eventSource);
}
- OC_JSON::success(array("data" => array( "done" => true)));
+ $eventSource->send('success',true);
}else{
- OC_JSON::success(array("data" => array( "done" => false)));
-} \ No newline at end of file
+ $eventSource->send('success',false);
+}
+$eventSource->close(); \ No newline at end of file
diff --git a/files/js/files.js b/files/js/files.js
index 649f193aa2d..28259606cea 100644
--- a/files/js/files.js
+++ b/files/js/files.js
@@ -348,13 +348,17 @@ $(document).ready(function() {
function scanFiles(force){
force=!!force; //cast to bool
$('#scanning-message').show();
- $.get(OC.filePath('files','ajax','scan.php'),{force:force}, function(response) {
- if(response && response.data && response.data.done){
+ var scannerEventSource=new OC.EventSource(OC.filePath('files','ajax','scan.php'),{force:force});
+ scannerEventSource.listen('scanned',function(file){
+ console.log(file);//TODO: make this into proper feedback
+ });
+ scannerEventSource.listen('success',function(success){
+ if(success){
window.location.reload();
}else{
- alert('error')
+ alert('error while scanning');
}
- }, "json");
+ });
}
function boolOperationFinished(data, callback) {