allow manually scanning of specific directories

This commit is contained in:
Robin Appelman 2012-04-24 23:56:51 +02:00
parent 9b134b0636
commit fa502e160d
2 changed files with 4 additions and 3 deletions

View File

@ -5,6 +5,7 @@ require_once '../../lib/base.php';
set_time_limit(0);//scanning can take ages set_time_limit(0);//scanning can take ages
$force=isset($_GET['force']) and $_GET['force']=='true'; $force=isset($_GET['force']) and $_GET['force']=='true';
$dir=isset($_GET['dir'])?$_GET['dir']:'';
$checkOnly=isset($_GET['checkonly']) and $_GET['checkonly']=='true'; $checkOnly=isset($_GET['checkonly']) and $_GET['checkonly']=='true';
if(!$checkOnly){ if(!$checkOnly){
@ -16,7 +17,7 @@ if(!$checkOnly){
if($force or !OC_FileCache::inCache('')){ if($force or !OC_FileCache::inCache('')){
if(!$checkOnly){ if(!$checkOnly){
OC_DB::beginTransaction(); OC_DB::beginTransaction();
OC_FileCache::scan('',$eventSource); OC_FileCache::scan($dir,$eventSource);
OC_FileCache::clean(); OC_FileCache::clean();
OC_DB::commit(); OC_DB::commit();
$eventSource->send('success',true); $eventSource->send('success',true);

View File

@ -370,12 +370,12 @@ $(document).ready(function() {
}, "json"); }, "json");
}); });
function scanFiles(force){ function scanFiles(force,dir){
force=!!force; //cast to bool force=!!force; //cast to bool
scanFiles.scanning=true; scanFiles.scanning=true;
$('#scanning-message').show(); $('#scanning-message').show();
$('#fileList').remove(); $('#fileList').remove();
var scannerEventSource=new OC.EventSource(OC.filePath('files','ajax','scan.php'),{force:force}); var scannerEventSource=new OC.EventSource(OC.filePath('files','ajax','scan.php'),{force:force,dir:dir});
scanFiles.cancel=scannerEventSource.close.bind(scannerEventSource); scanFiles.cancel=scannerEventSource.close.bind(scannerEventSource);
scannerEventSource.listen('scanning',function(data){ scannerEventSource.listen('scanning',function(data){
$('#scan-count').text(data.count+' files scanned'); $('#scan-count').text(data.count+' files scanned');