예제 #1
0
 /**
  * get the list of all unindexed files for the user
  *
  * @return array
  */
 public static function getUnindexed()
 {
     $files = array();
     $absoluteRoot = Filesystem::getView()->getAbsolutePath('/');
     $mounts = \OC\Files\Mount::findIn($absoluteRoot);
     $mount = \OC\Files\Mount::find($absoluteRoot);
     if (!in_array($mount, $mounts)) {
         $mounts[] = $mount;
     }
     $query = \OC_DB::prepare('SELECT `*PREFIX*filecache`.`fileid`' . ' FROM `*PREFIX*filecache`' . ' LEFT JOIN `*PREFIX*lucene_status`' . ' ON `*PREFIX*filecache`.`fileid` = `*PREFIX*lucene_status`.`fileid`' . ' WHERE `storage` = ?' . ' AND `status` is null OR `status` = "N"');
     foreach ($mounts as $mount) {
         $storage = $mount->getStorage();
         //only index local files for now
         if ($storage instanceof \OC\Files\Storage\Local) {
             $cache = $storage->getCache();
             $numericId = $cache->getNumericStorageId();
             $result = $query->execute(array($numericId));
             if (!$result) {
                 return false;
             }
             while ($row = $result->fetchRow()) {
                 $files[] = $row['fileid'];
             }
         }
     }
     return $files;
 }