Exemplo n.º 1
0
 /**
  * update the filesystem after a delete has been detected
  * @param string path
  * @param string root (optional)
  */
 public static function delete($path, $root = false)
 {
     $cached = OC_FileCache_Cached::get($path, $root);
     if (!isset($cached['size'])) {
         return;
     }
     $size = $cached['size'];
     OC_FileCache::increaseSize(dirname($path), -$size, $root);
     OC_FileCache::delete($path, $root);
 }
Exemplo n.º 2
0
                    $shareType = OCP\Share::SHARE_TYPE_USER;
                    $shareWith = $row['uid_shared_with'];
                }
            }
            OC_User::setUserId($row['uid_owner']);
            //we need to setup the filesystem for the user, otherwise OC_FileSystem::getRoot will fail and break
            OC_Util::setupFS($row['uid_owner']);
            try {
                OCP\Share::shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions);
            } 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);
            }
            OC_Util::tearDownFS();
        }
    }
    if ($update_error) {
        OCP\Util::writeLog('files_sharing', 'There were some problems upgrading the sharing of files', OCP\Util::ERROR);
    }
    // NOTE: Let's drop the table after more testing
    // 	$query = OCP\DB::prepare('DROP TABLE `*PREFIX*sharing`');
    // 	$query->execute();
}
if (version_compare($installedVersion, '0.3.3', '<')) {
    OC_User::useBackend(new OC_User_Database());
    OC_App::loadApps(array('authentication'));
    $users = OC_User::getUsers();
    foreach ($users as $user) {
        OC_FileCache::delete('Shared', '/' . $user . '/files/');
    }
}