@@ -32,129 +32,129 @@  | 
                                                    ||
| 32 | 32 | |
| 33 | 33 |  class Favorites implements IFilter { | 
                                                        
| 34 | 34 | |
| 35 | - /** @var IL10N */  | 
                                                        |
| 36 | - protected $l;  | 
                                                        |
| 37 | -  | 
                                                        |
| 38 | - /** @var IURLGenerator */  | 
                                                        |
| 39 | - protected $url;  | 
                                                        |
| 40 | -  | 
                                                        |
| 41 | - /** @var IManager */  | 
                                                        |
| 42 | - protected $activityManager;  | 
                                                        |
| 43 | -  | 
                                                        |
| 44 | - /** @var Helper */  | 
                                                        |
| 45 | - protected $helper;  | 
                                                        |
| 46 | -  | 
                                                        |
| 47 | - /** @var IDBConnection */  | 
                                                        |
| 48 | - protected $db;  | 
                                                        |
| 49 | -  | 
                                                        |
| 50 | - /**  | 
                                                        |
| 51 | - * @param IL10N $l  | 
                                                        |
| 52 | - * @param IURLGenerator $url  | 
                                                        |
| 53 | - * @param IManager $activityManager  | 
                                                        |
| 54 | - * @param Helper $helper  | 
                                                        |
| 55 | - * @param IDBConnection $db  | 
                                                        |
| 56 | - */  | 
                                                        |
| 57 | -	public function __construct(IL10N $l, IURLGenerator $url, IManager $activityManager, Helper $helper, IDBConnection $db) { | 
                                                        |
| 58 | - $this->l = $l;  | 
                                                        |
| 59 | - $this->url = $url;  | 
                                                        |
| 60 | - $this->activityManager = $activityManager;  | 
                                                        |
| 61 | - $this->helper = $helper;  | 
                                                        |
| 62 | - $this->db = $db;  | 
                                                        |
| 63 | - }  | 
                                                        |
| 64 | -  | 
                                                        |
| 65 | - /**  | 
                                                        |
| 66 | - * @return string Lowercase a-z only identifier  | 
                                                        |
| 67 | - * @since 11.0.0  | 
                                                        |
| 68 | - */  | 
                                                        |
| 69 | -	public function getIdentifier() { | 
                                                        |
| 70 | - return 'files_favorites';  | 
                                                        |
| 71 | - }  | 
                                                        |
| 72 | -  | 
                                                        |
| 73 | - /**  | 
                                                        |
| 74 | - * @return string A translated string  | 
                                                        |
| 75 | - * @since 11.0.0  | 
                                                        |
| 76 | - */  | 
                                                        |
| 77 | -	public function getName() { | 
                                                        |
| 78 | -		return $this->l->t('Favorites'); | 
                                                        |
| 79 | - }  | 
                                                        |
| 80 | -  | 
                                                        |
| 81 | - /**  | 
                                                        |
| 82 | - * @return int  | 
                                                        |
| 83 | - * @since 11.0.0  | 
                                                        |
| 84 | - */  | 
                                                        |
| 85 | -	public function getPriority() { | 
                                                        |
| 86 | - return 10;  | 
                                                        |
| 87 | - }  | 
                                                        |
| 88 | -  | 
                                                        |
| 89 | - /**  | 
                                                        |
| 90 | - * @return string Full URL to an icon, empty string when none is given  | 
                                                        |
| 91 | - * @since 11.0.0  | 
                                                        |
| 92 | - */  | 
                                                        |
| 93 | -	public function getIcon() { | 
                                                        |
| 94 | -		return $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/star-dark.svg')); | 
                                                        |
| 95 | - }  | 
                                                        |
| 96 | -  | 
                                                        |
| 97 | - /**  | 
                                                        |
| 98 | - * @param string[] $types  | 
                                                        |
| 99 | - * @return string[] An array of allowed apps from which activities should be displayed  | 
                                                        |
| 100 | - * @since 11.0.0  | 
                                                        |
| 101 | - */  | 
                                                        |
| 102 | -	public function filterTypes(array $types) { | 
                                                        |
| 103 | - return array_intersect([  | 
                                                        |
| 104 | - 'file_created',  | 
                                                        |
| 105 | - 'file_changed',  | 
                                                        |
| 106 | - 'file_deleted',  | 
                                                        |
| 107 | - 'file_restored',  | 
                                                        |
| 108 | - ], $types);  | 
                                                        |
| 109 | - }  | 
                                                        |
| 110 | -  | 
                                                        |
| 111 | - /**  | 
                                                        |
| 112 | - * @return string[] An array of allowed apps from which activities should be displayed  | 
                                                        |
| 113 | - * @since 11.0.0  | 
                                                        |
| 114 | - */  | 
                                                        |
| 115 | -	public function allowedApps() { | 
                                                        |
| 116 | - return ['files'];  | 
                                                        |
| 117 | - }  | 
                                                        |
| 118 | -  | 
                                                        |
| 119 | - /**  | 
                                                        |
| 120 | - * @param IQueryBuilder $query  | 
                                                        |
| 121 | - */  | 
                                                        |
| 122 | -	public function filterFavorites(IQueryBuilder $query) { | 
                                                        |
| 123 | -		try { | 
                                                        |
| 124 | - $user = $this->activityManager->getCurrentUserId();  | 
                                                        |
| 125 | -		} catch (\UnexpectedValueException $e) { | 
                                                        |
| 126 | - return;  | 
                                                        |
| 127 | - }  | 
                                                        |
| 128 | -  | 
                                                        |
| 129 | -		try { | 
                                                        |
| 130 | - $favorites = $this->helper->getFavoriteFilePaths($user);  | 
                                                        |
| 131 | -		} catch (\RuntimeException $e) { | 
                                                        |
| 132 | - return;  | 
                                                        |
| 133 | - }  | 
                                                        |
| 134 | -  | 
                                                        |
| 135 | - $limitations = [];  | 
                                                        |
| 136 | -		if (!empty($favorites['items'])) { | 
                                                        |
| 137 | -			$limitations[] = $query->expr()->in('file', $query->createNamedParameter($favorites['items'], IQueryBuilder::PARAM_STR_ARRAY)); | 
                                                        |
| 138 | - }  | 
                                                        |
| 139 | -		foreach ($favorites['folders'] as $favorite) { | 
                                                        |
| 140 | -			$limitations[] = $query->expr()->like('file', $query->createNamedParameter( | 
                                                        |
| 141 | - $this->db->escapeLikeParameter($favorite . '/') . '%'  | 
                                                        |
| 142 | - ));  | 
                                                        |
| 143 | - }  | 
                                                        |
| 144 | -  | 
                                                        |
| 145 | -		if (empty($limitations)) { | 
                                                        |
| 146 | - return;  | 
                                                        |
| 147 | - }  | 
                                                        |
| 148 | -  | 
                                                        |
| 149 | -		$function = $query->createFunction(' | 
                                                        |
| 35 | + /** @var IL10N */  | 
                                                        |
| 36 | + protected $l;  | 
                                                        |
| 37 | +  | 
                                                        |
| 38 | + /** @var IURLGenerator */  | 
                                                        |
| 39 | + protected $url;  | 
                                                        |
| 40 | +  | 
                                                        |
| 41 | + /** @var IManager */  | 
                                                        |
| 42 | + protected $activityManager;  | 
                                                        |
| 43 | +  | 
                                                        |
| 44 | + /** @var Helper */  | 
                                                        |
| 45 | + protected $helper;  | 
                                                        |
| 46 | +  | 
                                                        |
| 47 | + /** @var IDBConnection */  | 
                                                        |
| 48 | + protected $db;  | 
                                                        |
| 49 | +  | 
                                                        |
| 50 | + /**  | 
                                                        |
| 51 | + * @param IL10N $l  | 
                                                        |
| 52 | + * @param IURLGenerator $url  | 
                                                        |
| 53 | + * @param IManager $activityManager  | 
                                                        |
| 54 | + * @param Helper $helper  | 
                                                        |
| 55 | + * @param IDBConnection $db  | 
                                                        |
| 56 | + */  | 
                                                        |
| 57 | +    public function __construct(IL10N $l, IURLGenerator $url, IManager $activityManager, Helper $helper, IDBConnection $db) { | 
                                                        |
| 58 | + $this->l = $l;  | 
                                                        |
| 59 | + $this->url = $url;  | 
                                                        |
| 60 | + $this->activityManager = $activityManager;  | 
                                                        |
| 61 | + $this->helper = $helper;  | 
                                                        |
| 62 | + $this->db = $db;  | 
                                                        |
| 63 | + }  | 
                                                        |
| 64 | +  | 
                                                        |
| 65 | + /**  | 
                                                        |
| 66 | + * @return string Lowercase a-z only identifier  | 
                                                        |
| 67 | + * @since 11.0.0  | 
                                                        |
| 68 | + */  | 
                                                        |
| 69 | +    public function getIdentifier() { | 
                                                        |
| 70 | + return 'files_favorites';  | 
                                                        |
| 71 | + }  | 
                                                        |
| 72 | +  | 
                                                        |
| 73 | + /**  | 
                                                        |
| 74 | + * @return string A translated string  | 
                                                        |
| 75 | + * @since 11.0.0  | 
                                                        |
| 76 | + */  | 
                                                        |
| 77 | +    public function getName() { | 
                                                        |
| 78 | +        return $this->l->t('Favorites'); | 
                                                        |
| 79 | + }  | 
                                                        |
| 80 | +  | 
                                                        |
| 81 | + /**  | 
                                                        |
| 82 | + * @return int  | 
                                                        |
| 83 | + * @since 11.0.0  | 
                                                        |
| 84 | + */  | 
                                                        |
| 85 | +    public function getPriority() { | 
                                                        |
| 86 | + return 10;  | 
                                                        |
| 87 | + }  | 
                                                        |
| 88 | +  | 
                                                        |
| 89 | + /**  | 
                                                        |
| 90 | + * @return string Full URL to an icon, empty string when none is given  | 
                                                        |
| 91 | + * @since 11.0.0  | 
                                                        |
| 92 | + */  | 
                                                        |
| 93 | +    public function getIcon() { | 
                                                        |
| 94 | +        return $this->url->getAbsoluteURL($this->url->imagePath('core', 'actions/star-dark.svg')); | 
                                                        |
| 95 | + }  | 
                                                        |
| 96 | +  | 
                                                        |
| 97 | + /**  | 
                                                        |
| 98 | + * @param string[] $types  | 
                                                        |
| 99 | + * @return string[] An array of allowed apps from which activities should be displayed  | 
                                                        |
| 100 | + * @since 11.0.0  | 
                                                        |
| 101 | + */  | 
                                                        |
| 102 | +    public function filterTypes(array $types) { | 
                                                        |
| 103 | + return array_intersect([  | 
                                                        |
| 104 | + 'file_created',  | 
                                                        |
| 105 | + 'file_changed',  | 
                                                        |
| 106 | + 'file_deleted',  | 
                                                        |
| 107 | + 'file_restored',  | 
                                                        |
| 108 | + ], $types);  | 
                                                        |
| 109 | + }  | 
                                                        |
| 110 | +  | 
                                                        |
| 111 | + /**  | 
                                                        |
| 112 | + * @return string[] An array of allowed apps from which activities should be displayed  | 
                                                        |
| 113 | + * @since 11.0.0  | 
                                                        |
| 114 | + */  | 
                                                        |
| 115 | +    public function allowedApps() { | 
                                                        |
| 116 | + return ['files'];  | 
                                                        |
| 117 | + }  | 
                                                        |
| 118 | +  | 
                                                        |
| 119 | + /**  | 
                                                        |
| 120 | + * @param IQueryBuilder $query  | 
                                                        |
| 121 | + */  | 
                                                        |
| 122 | +    public function filterFavorites(IQueryBuilder $query) { | 
                                                        |
| 123 | +        try { | 
                                                        |
| 124 | + $user = $this->activityManager->getCurrentUserId();  | 
                                                        |
| 125 | +        } catch (\UnexpectedValueException $e) { | 
                                                        |
| 126 | + return;  | 
                                                        |
| 127 | + }  | 
                                                        |
| 128 | +  | 
                                                        |
| 129 | +        try { | 
                                                        |
| 130 | + $favorites = $this->helper->getFavoriteFilePaths($user);  | 
                                                        |
| 131 | +        } catch (\RuntimeException $e) { | 
                                                        |
| 132 | + return;  | 
                                                        |
| 133 | + }  | 
                                                        |
| 134 | +  | 
                                                        |
| 135 | + $limitations = [];  | 
                                                        |
| 136 | +        if (!empty($favorites['items'])) { | 
                                                        |
| 137 | +            $limitations[] = $query->expr()->in('file', $query->createNamedParameter($favorites['items'], IQueryBuilder::PARAM_STR_ARRAY)); | 
                                                        |
| 138 | + }  | 
                                                        |
| 139 | +        foreach ($favorites['folders'] as $favorite) { | 
                                                        |
| 140 | +            $limitations[] = $query->expr()->like('file', $query->createNamedParameter( | 
                                                        |
| 141 | + $this->db->escapeLikeParameter($favorite . '/') . '%'  | 
                                                        |
| 142 | + ));  | 
                                                        |
| 143 | + }  | 
                                                        |
| 144 | +  | 
                                                        |
| 145 | +        if (empty($limitations)) { | 
                                                        |
| 146 | + return;  | 
                                                        |
| 147 | + }  | 
                                                        |
| 148 | +  | 
                                                        |
| 149 | +        $function = $query->createFunction(' | 
                                                        |
| 150 | 150 | CASE  | 
                                                        
| 151 | 151 |  				WHEN ' . $query->getColumnName('app') . ' <> ' . $query->createNamedParameter('files') . ' THEN 1 | 
                                                        
| 152 | 152 |  				WHEN ' . $query->getColumnName('app') . ' = ' . $query->createNamedParameter('files') . ' | 
                                                        
| 153 | 153 |  					AND (' . implode(' OR ', $limitations) . ') | 
                                                        
| 154 | 154 | THEN 1  | 
                                                        
| 155 | 155 | END = 1'  | 
                                                        
| 156 | - );  | 
                                                        |
| 156 | + );  | 
                                                        |
| 157 | 157 | |
| 158 | - $query->andWhere($function);  | 
                                                        |
| 159 | - }  | 
                                                        |
| 158 | + $query->andWhere($function);  | 
                                                        |
| 159 | + }  | 
                                                        |
| 160 | 160 | }  | 
                                                        
@@ -138,7 +138,7 @@ discard block  | 
                                                    ||
| 138 | 138 | }  | 
                                                        
| 139 | 139 |  		foreach ($favorites['folders'] as $favorite) { | 
                                                        
| 140 | 140 |  			$limitations[] = $query->expr()->like('file', $query->createNamedParameter( | 
                                                        
| 141 | - $this->db->escapeLikeParameter($favorite . '/') . '%'  | 
                                                        |
| 141 | + $this->db->escapeLikeParameter($favorite.'/').'%'  | 
                                                        |
| 142 | 142 | ));  | 
                                                        
| 143 | 143 | }  | 
                                                        
| 144 | 144 | |
@@ -148,9 +148,9 @@ discard block  | 
                                                    ||
| 148 | 148 | |
| 149 | 149 |  		$function = $query->createFunction(' | 
                                                        
| 150 | 150 | CASE  | 
                                                        
| 151 | -				WHEN ' . $query->getColumnName('app') . ' <> ' . $query->createNamedParameter('files') . ' THEN 1 | 
                                                        |
| 152 | -				WHEN ' . $query->getColumnName('app') . ' = ' . $query->createNamedParameter('files') . ' | 
                                                        |
| 153 | -					AND (' . implode(' OR ', $limitations) . ') | 
                                                        |
| 151 | +				WHEN ' . $query->getColumnName('app').' <> '.$query->createNamedParameter('files').' THEN 1 | 
                                                        |
| 152 | +				WHEN ' . $query->getColumnName('app').' = '.$query->createNamedParameter('files').' | 
                                                        |
| 153 | +					AND (' . implode(' OR ', $limitations).') | 
                                                        |
| 154 | 154 | THEN 1  | 
                                                        
| 155 | 155 | END = 1'  | 
                                                        
| 156 | 156 | );  | 
                                                        
@@ -26,60 +26,60 @@  | 
                                                    ||
| 26 | 26 | use OCP\ITagManager;  | 
                                                        
| 27 | 27 | |
| 28 | 28 |  class Helper { | 
                                                        
| 29 | - /** If a user has a lot of favorites the query might get too slow and long */  | 
                                                        |
| 30 | - const FAVORITE_LIMIT = 50;  | 
                                                        |
| 29 | + /** If a user has a lot of favorites the query might get too slow and long */  | 
                                                        |
| 30 | + const FAVORITE_LIMIT = 50;  | 
                                                        |
| 31 | 31 | |
| 32 | - /** @var ITagManager */  | 
                                                        |
| 33 | - protected $tagManager;  | 
                                                        |
| 32 | + /** @var ITagManager */  | 
                                                        |
| 33 | + protected $tagManager;  | 
                                                        |
| 34 | 34 | |
| 35 | - /**  | 
                                                        |
| 36 | - * @param ITagManager $tagManager  | 
                                                        |
| 37 | - */  | 
                                                        |
| 38 | -	public function __construct(ITagManager $tagManager) { | 
                                                        |
| 39 | - $this->tagManager = $tagManager;  | 
                                                        |
| 40 | - }  | 
                                                        |
| 35 | + /**  | 
                                                        |
| 36 | + * @param ITagManager $tagManager  | 
                                                        |
| 37 | + */  | 
                                                        |
| 38 | +    public function __construct(ITagManager $tagManager) { | 
                                                        |
| 39 | + $this->tagManager = $tagManager;  | 
                                                        |
| 40 | + }  | 
                                                        |
| 41 | 41 | |
| 42 | - /**  | 
                                                        |
| 43 | - * Returns an array with the favorites  | 
                                                        |
| 44 | - *  | 
                                                        |
| 45 | - * @param string $user  | 
                                                        |
| 46 | - * @return array  | 
                                                        |
| 47 | - * @throws \RuntimeException when too many or no favorites where found  | 
                                                        |
| 48 | - */  | 
                                                        |
| 49 | -	public function getFavoriteFilePaths($user) { | 
                                                        |
| 50 | -		$tags = $this->tagManager->load('files', [], false, $user); | 
                                                        |
| 51 | - $favorites = $tags->getFavorites();  | 
                                                        |
| 42 | + /**  | 
                                                        |
| 43 | + * Returns an array with the favorites  | 
                                                        |
| 44 | + *  | 
                                                        |
| 45 | + * @param string $user  | 
                                                        |
| 46 | + * @return array  | 
                                                        |
| 47 | + * @throws \RuntimeException when too many or no favorites where found  | 
                                                        |
| 48 | + */  | 
                                                        |
| 49 | +    public function getFavoriteFilePaths($user) { | 
                                                        |
| 50 | +        $tags = $this->tagManager->load('files', [], false, $user); | 
                                                        |
| 51 | + $favorites = $tags->getFavorites();  | 
                                                        |
| 52 | 52 | |
| 53 | -		if (empty($favorites)) { | 
                                                        |
| 54 | -			throw new \RuntimeException('No favorites', 1); | 
                                                        |
| 55 | -		} else if (isset($favorites[self::FAVORITE_LIMIT])) { | 
                                                        |
| 56 | -			throw new \RuntimeException('Too many favorites', 2); | 
                                                        |
| 57 | - }  | 
                                                        |
| 53 | +        if (empty($favorites)) { | 
                                                        |
| 54 | +            throw new \RuntimeException('No favorites', 1); | 
                                                        |
| 55 | +        } else if (isset($favorites[self::FAVORITE_LIMIT])) { | 
                                                        |
| 56 | +            throw new \RuntimeException('Too many favorites', 2); | 
                                                        |
| 57 | + }  | 
                                                        |
| 58 | 58 | |
| 59 | - // Can not DI because the user is not known on instantiation  | 
                                                        |
| 60 | - $rootFolder = \OC::$server->getUserFolder($user);  | 
                                                        |
| 61 | - $folders = $items = [];  | 
                                                        |
| 62 | -		foreach ($favorites as $favorite) { | 
                                                        |
| 63 | - $nodes = $rootFolder->getById($favorite);  | 
                                                        |
| 64 | -			if (!empty($nodes)) { | 
                                                        |
| 65 | - /** @var \OCP\Files\Node $node */  | 
                                                        |
| 66 | - $node = array_shift($nodes);  | 
                                                        |
| 67 | - $path = substr($node->getPath(), strlen($user . '/files/'));  | 
                                                        |
| 59 | + // Can not DI because the user is not known on instantiation  | 
                                                        |
| 60 | + $rootFolder = \OC::$server->getUserFolder($user);  | 
                                                        |
| 61 | + $folders = $items = [];  | 
                                                        |
| 62 | +        foreach ($favorites as $favorite) { | 
                                                        |
| 63 | + $nodes = $rootFolder->getById($favorite);  | 
                                                        |
| 64 | +            if (!empty($nodes)) { | 
                                                        |
| 65 | + /** @var \OCP\Files\Node $node */  | 
                                                        |
| 66 | + $node = array_shift($nodes);  | 
                                                        |
| 67 | + $path = substr($node->getPath(), strlen($user . '/files/'));  | 
                                                        |
| 68 | 68 | |
| 69 | - $items[] = $path;  | 
                                                        |
| 70 | -				if ($node instanceof Folder) { | 
                                                        |
| 71 | - $folders[] = $path;  | 
                                                        |
| 72 | - }  | 
                                                        |
| 73 | - }  | 
                                                        |
| 74 | - }  | 
                                                        |
| 69 | + $items[] = $path;  | 
                                                        |
| 70 | +                if ($node instanceof Folder) { | 
                                                        |
| 71 | + $folders[] = $path;  | 
                                                        |
| 72 | + }  | 
                                                        |
| 73 | + }  | 
                                                        |
| 74 | + }  | 
                                                        |
| 75 | 75 | |
| 76 | -		if (empty($items)) { | 
                                                        |
| 77 | -			throw new \RuntimeException('No favorites', 1); | 
                                                        |
| 78 | - }  | 
                                                        |
| 76 | +        if (empty($items)) { | 
                                                        |
| 77 | +            throw new \RuntimeException('No favorites', 1); | 
                                                        |
| 78 | + }  | 
                                                        |
| 79 | 79 | |
| 80 | - return [  | 
                                                        |
| 81 | - 'items' => $items,  | 
                                                        |
| 82 | - 'folders' => $folders,  | 
                                                        |
| 83 | - ];  | 
                                                        |
| 84 | - }  | 
                                                        |
| 80 | + return [  | 
                                                        |
| 81 | + 'items' => $items,  | 
                                                        |
| 82 | + 'folders' => $folders,  | 
                                                        |
| 83 | + ];  | 
                                                        |
| 84 | + }  | 
                                                        |
| 85 | 85 | }  | 
                                                        
@@ -64,7 +64,7 @@  | 
                                                    ||
| 64 | 64 |  			if (!empty($nodes)) { | 
                                                        
| 65 | 65 | /** @var \OCP\Files\Node $node */  | 
                                                        
| 66 | 66 | $node = array_shift($nodes);  | 
                                                        
| 67 | - $path = substr($node->getPath(), strlen($user . '/files/'));  | 
                                                        |
| 67 | + $path = substr($node->getPath(), strlen($user.'/files/'));  | 
                                                        |
| 68 | 68 | |
| 69 | 69 | $items[] = $path;  | 
                                                        
| 70 | 70 |  				if ($node instanceof Folder) { | 
                                                        
@@ -27,72 +27,72 @@  | 
                                                    ||
| 27 | 27 | |
| 28 | 28 |  class FileChanged implements ISetting { | 
                                                        
| 29 | 29 | |
| 30 | - /** @var IL10N */  | 
                                                        |
| 31 | - protected $l;  | 
                                                        |
| 30 | + /** @var IL10N */  | 
                                                        |
| 31 | + protected $l;  | 
                                                        |
| 32 | 32 | |
| 33 | - /**  | 
                                                        |
| 34 | - * @param IL10N $l  | 
                                                        |
| 35 | - */  | 
                                                        |
| 36 | -	public function __construct(IL10N $l) { | 
                                                        |
| 37 | - $this->l = $l;  | 
                                                        |
| 38 | - }  | 
                                                        |
| 33 | + /**  | 
                                                        |
| 34 | + * @param IL10N $l  | 
                                                        |
| 35 | + */  | 
                                                        |
| 36 | +    public function __construct(IL10N $l) { | 
                                                        |
| 37 | + $this->l = $l;  | 
                                                        |
| 38 | + }  | 
                                                        |
| 39 | 39 | |
| 40 | - /**  | 
                                                        |
| 41 | - * @return string Lowercase a-z and underscore only identifier  | 
                                                        |
| 42 | - * @since 11.0.0  | 
                                                        |
| 43 | - */  | 
                                                        |
| 44 | -	public function getIdentifier() { | 
                                                        |
| 45 | - return 'file_changed';  | 
                                                        |
| 46 | - }  | 
                                                        |
| 40 | + /**  | 
                                                        |
| 41 | + * @return string Lowercase a-z and underscore only identifier  | 
                                                        |
| 42 | + * @since 11.0.0  | 
                                                        |
| 43 | + */  | 
                                                        |
| 44 | +    public function getIdentifier() { | 
                                                        |
| 45 | + return 'file_changed';  | 
                                                        |
| 46 | + }  | 
                                                        |
| 47 | 47 | |
| 48 | - /**  | 
                                                        |
| 49 | - * @return string A translated string  | 
                                                        |
| 50 | - * @since 11.0.0  | 
                                                        |
| 51 | - */  | 
                                                        |
| 52 | -	public function getName() { | 
                                                        |
| 53 | -		return $this->l->t('A file or folder has been <strong>changed</strong> or <strong>renamed</strong>'); | 
                                                        |
| 54 | - }  | 
                                                        |
| 48 | + /**  | 
                                                        |
| 49 | + * @return string A translated string  | 
                                                        |
| 50 | + * @since 11.0.0  | 
                                                        |
| 51 | + */  | 
                                                        |
| 52 | +    public function getName() { | 
                                                        |
| 53 | +        return $this->l->t('A file or folder has been <strong>changed</strong> or <strong>renamed</strong>'); | 
                                                        |
| 54 | + }  | 
                                                        |
| 55 | 55 | |
| 56 | - /**  | 
                                                        |
| 57 | - * @return int whether the filter should be rather on the top or bottom of  | 
                                                        |
| 58 | - * the admin section. The filters are arranged in ascending order of the  | 
                                                        |
| 59 | - * priority values. It is required to return a value between 0 and 100.  | 
                                                        |
| 60 | - * @since 11.0.0  | 
                                                        |
| 61 | - */  | 
                                                        |
| 62 | -	public function getPriority() { | 
                                                        |
| 63 | - return 1;  | 
                                                        |
| 64 | - }  | 
                                                        |
| 56 | + /**  | 
                                                        |
| 57 | + * @return int whether the filter should be rather on the top or bottom of  | 
                                                        |
| 58 | + * the admin section. The filters are arranged in ascending order of the  | 
                                                        |
| 59 | + * priority values. It is required to return a value between 0 and 100.  | 
                                                        |
| 60 | + * @since 11.0.0  | 
                                                        |
| 61 | + */  | 
                                                        |
| 62 | +    public function getPriority() { | 
                                                        |
| 63 | + return 1;  | 
                                                        |
| 64 | + }  | 
                                                        |
| 65 | 65 | |
| 66 | - /**  | 
                                                        |
| 67 | - * @return bool True when the option can be changed for the stream  | 
                                                        |
| 68 | - * @since 11.0.0  | 
                                                        |
| 69 | - */  | 
                                                        |
| 70 | -	public function canChangeStream() { | 
                                                        |
| 71 | - return true;  | 
                                                        |
| 72 | - }  | 
                                                        |
| 66 | + /**  | 
                                                        |
| 67 | + * @return bool True when the option can be changed for the stream  | 
                                                        |
| 68 | + * @since 11.0.0  | 
                                                        |
| 69 | + */  | 
                                                        |
| 70 | +    public function canChangeStream() { | 
                                                        |
| 71 | + return true;  | 
                                                        |
| 72 | + }  | 
                                                        |
| 73 | 73 | |
| 74 | - /**  | 
                                                        |
| 75 | - * @return bool True when the option can be changed for the stream  | 
                                                        |
| 76 | - * @since 11.0.0  | 
                                                        |
| 77 | - */  | 
                                                        |
| 78 | -	public function isDefaultEnabledStream() { | 
                                                        |
| 79 | - return true;  | 
                                                        |
| 80 | - }  | 
                                                        |
| 74 | + /**  | 
                                                        |
| 75 | + * @return bool True when the option can be changed for the stream  | 
                                                        |
| 76 | + * @since 11.0.0  | 
                                                        |
| 77 | + */  | 
                                                        |
| 78 | +    public function isDefaultEnabledStream() { | 
                                                        |
| 79 | + return true;  | 
                                                        |
| 80 | + }  | 
                                                        |
| 81 | 81 | |
| 82 | - /**  | 
                                                        |
| 83 | - * @return bool True when the option can be changed for the mail  | 
                                                        |
| 84 | - * @since 11.0.0  | 
                                                        |
| 85 | - */  | 
                                                        |
| 86 | -	public function canChangeMail() { | 
                                                        |
| 87 | - return true;  | 
                                                        |
| 88 | - }  | 
                                                        |
| 82 | + /**  | 
                                                        |
| 83 | + * @return bool True when the option can be changed for the mail  | 
                                                        |
| 84 | + * @since 11.0.0  | 
                                                        |
| 85 | + */  | 
                                                        |
| 86 | +    public function canChangeMail() { | 
                                                        |
| 87 | + return true;  | 
                                                        |
| 88 | + }  | 
                                                        |
| 89 | 89 | |
| 90 | - /**  | 
                                                        |
| 91 | - * @return bool True when the option can be changed for the stream  | 
                                                        |
| 92 | - * @since 11.0.0  | 
                                                        |
| 93 | - */  | 
                                                        |
| 94 | -	public function isDefaultEnabledMail() { | 
                                                        |
| 95 | - return false;  | 
                                                        |
| 96 | - }  | 
                                                        |
| 90 | + /**  | 
                                                        |
| 91 | + * @return bool True when the option can be changed for the stream  | 
                                                        |
| 92 | + * @since 11.0.0  | 
                                                        |
| 93 | + */  | 
                                                        |
| 94 | +    public function isDefaultEnabledMail() { | 
                                                        |
| 95 | + return false;  | 
                                                        |
| 96 | + }  | 
                                                        |
| 97 | 97 | }  | 
                                                        
| 98 | 98 | |
@@ -27,72 +27,72 @@  | 
                                                    ||
| 27 | 27 | |
| 28 | 28 |  class FileCreated implements ISetting { | 
                                                        
| 29 | 29 | |
| 30 | - /** @var IL10N */  | 
                                                        |
| 31 | - protected $l;  | 
                                                        |
| 30 | + /** @var IL10N */  | 
                                                        |
| 31 | + protected $l;  | 
                                                        |
| 32 | 32 | |
| 33 | - /**  | 
                                                        |
| 34 | - * @param IL10N $l  | 
                                                        |
| 35 | - */  | 
                                                        |
| 36 | -	public function __construct(IL10N $l) { | 
                                                        |
| 37 | - $this->l = $l;  | 
                                                        |
| 38 | - }  | 
                                                        |
| 33 | + /**  | 
                                                        |
| 34 | + * @param IL10N $l  | 
                                                        |
| 35 | + */  | 
                                                        |
| 36 | +    public function __construct(IL10N $l) { | 
                                                        |
| 37 | + $this->l = $l;  | 
                                                        |
| 38 | + }  | 
                                                        |
| 39 | 39 | |
| 40 | - /**  | 
                                                        |
| 41 | - * @return string Lowercase a-z and underscore only identifier  | 
                                                        |
| 42 | - * @since 11.0.0  | 
                                                        |
| 43 | - */  | 
                                                        |
| 44 | -	public function getIdentifier() { | 
                                                        |
| 45 | - return 'file_created';  | 
                                                        |
| 46 | - }  | 
                                                        |
| 40 | + /**  | 
                                                        |
| 41 | + * @return string Lowercase a-z and underscore only identifier  | 
                                                        |
| 42 | + * @since 11.0.0  | 
                                                        |
| 43 | + */  | 
                                                        |
| 44 | +    public function getIdentifier() { | 
                                                        |
| 45 | + return 'file_created';  | 
                                                        |
| 46 | + }  | 
                                                        |
| 47 | 47 | |
| 48 | - /**  | 
                                                        |
| 49 | - * @return string A translated string  | 
                                                        |
| 50 | - * @since 11.0.0  | 
                                                        |
| 51 | - */  | 
                                                        |
| 52 | -	public function getName() { | 
                                                        |
| 53 | -		return $this->l->t('A new file or folder has been <strong>created</strong>'); | 
                                                        |
| 54 | - }  | 
                                                        |
| 48 | + /**  | 
                                                        |
| 49 | + * @return string A translated string  | 
                                                        |
| 50 | + * @since 11.0.0  | 
                                                        |
| 51 | + */  | 
                                                        |
| 52 | +    public function getName() { | 
                                                        |
| 53 | +        return $this->l->t('A new file or folder has been <strong>created</strong>'); | 
                                                        |
| 54 | + }  | 
                                                        |
| 55 | 55 | |
| 56 | - /**  | 
                                                        |
| 57 | - * @return int whether the filter should be rather on the top or bottom of  | 
                                                        |
| 58 | - * the admin section. The filters are arranged in ascending order of the  | 
                                                        |
| 59 | - * priority values. It is required to return a value between 0 and 100.  | 
                                                        |
| 60 | - * @since 11.0.0  | 
                                                        |
| 61 | - */  | 
                                                        |
| 62 | -	public function getPriority() { | 
                                                        |
| 63 | - return 0;  | 
                                                        |
| 64 | - }  | 
                                                        |
| 56 | + /**  | 
                                                        |
| 57 | + * @return int whether the filter should be rather on the top or bottom of  | 
                                                        |
| 58 | + * the admin section. The filters are arranged in ascending order of the  | 
                                                        |
| 59 | + * priority values. It is required to return a value between 0 and 100.  | 
                                                        |
| 60 | + * @since 11.0.0  | 
                                                        |
| 61 | + */  | 
                                                        |
| 62 | +    public function getPriority() { | 
                                                        |
| 63 | + return 0;  | 
                                                        |
| 64 | + }  | 
                                                        |
| 65 | 65 | |
| 66 | - /**  | 
                                                        |
| 67 | - * @return bool True when the option can be changed for the stream  | 
                                                        |
| 68 | - * @since 11.0.0  | 
                                                        |
| 69 | - */  | 
                                                        |
| 70 | -	public function canChangeStream() { | 
                                                        |
| 71 | - return true;  | 
                                                        |
| 72 | - }  | 
                                                        |
| 66 | + /**  | 
                                                        |
| 67 | + * @return bool True when the option can be changed for the stream  | 
                                                        |
| 68 | + * @since 11.0.0  | 
                                                        |
| 69 | + */  | 
                                                        |
| 70 | +    public function canChangeStream() { | 
                                                        |
| 71 | + return true;  | 
                                                        |
| 72 | + }  | 
                                                        |
| 73 | 73 | |
| 74 | - /**  | 
                                                        |
| 75 | - * @return bool True when the option can be changed for the stream  | 
                                                        |
| 76 | - * @since 11.0.0  | 
                                                        |
| 77 | - */  | 
                                                        |
| 78 | -	public function isDefaultEnabledStream() { | 
                                                        |
| 79 | - return true;  | 
                                                        |
| 80 | - }  | 
                                                        |
| 74 | + /**  | 
                                                        |
| 75 | + * @return bool True when the option can be changed for the stream  | 
                                                        |
| 76 | + * @since 11.0.0  | 
                                                        |
| 77 | + */  | 
                                                        |
| 78 | +    public function isDefaultEnabledStream() { | 
                                                        |
| 79 | + return true;  | 
                                                        |
| 80 | + }  | 
                                                        |
| 81 | 81 | |
| 82 | - /**  | 
                                                        |
| 83 | - * @return bool True when the option can be changed for the mail  | 
                                                        |
| 84 | - * @since 11.0.0  | 
                                                        |
| 85 | - */  | 
                                                        |
| 86 | -	public function canChangeMail() { | 
                                                        |
| 87 | - return true;  | 
                                                        |
| 88 | - }  | 
                                                        |
| 82 | + /**  | 
                                                        |
| 83 | + * @return bool True when the option can be changed for the mail  | 
                                                        |
| 84 | + * @since 11.0.0  | 
                                                        |
| 85 | + */  | 
                                                        |
| 86 | +    public function canChangeMail() { | 
                                                        |
| 87 | + return true;  | 
                                                        |
| 88 | + }  | 
                                                        |
| 89 | 89 | |
| 90 | - /**  | 
                                                        |
| 91 | - * @return bool True when the option can be changed for the stream  | 
                                                        |
| 92 | - * @since 11.0.0  | 
                                                        |
| 93 | - */  | 
                                                        |
| 94 | -	public function isDefaultEnabledMail() { | 
                                                        |
| 95 | - return false;  | 
                                                        |
| 96 | - }  | 
                                                        |
| 90 | + /**  | 
                                                        |
| 91 | + * @return bool True when the option can be changed for the stream  | 
                                                        |
| 92 | + * @since 11.0.0  | 
                                                        |
| 93 | + */  | 
                                                        |
| 94 | +    public function isDefaultEnabledMail() { | 
                                                        |
| 95 | + return false;  | 
                                                        |
| 96 | + }  | 
                                                        |
| 97 | 97 | }  | 
                                                        
| 98 | 98 | |
@@ -27,72 +27,72 @@  | 
                                                    ||
| 27 | 27 | |
| 28 | 28 |  class FavoriteAction implements ISetting { | 
                                                        
| 29 | 29 | |
| 30 | - /** @var IL10N */  | 
                                                        |
| 31 | - protected $l;  | 
                                                        |
| 30 | + /** @var IL10N */  | 
                                                        |
| 31 | + protected $l;  | 
                                                        |
| 32 | 32 | |
| 33 | - /**  | 
                                                        |
| 34 | - * @param IL10N $l  | 
                                                        |
| 35 | - */  | 
                                                        |
| 36 | -	public function __construct(IL10N $l) { | 
                                                        |
| 37 | - $this->l = $l;  | 
                                                        |
| 38 | - }  | 
                                                        |
| 33 | + /**  | 
                                                        |
| 34 | + * @param IL10N $l  | 
                                                        |
| 35 | + */  | 
                                                        |
| 36 | +    public function __construct(IL10N $l) { | 
                                                        |
| 37 | + $this->l = $l;  | 
                                                        |
| 38 | + }  | 
                                                        |
| 39 | 39 | |
| 40 | - /**  | 
                                                        |
| 41 | - * @return string Lowercase a-z and underscore only identifier  | 
                                                        |
| 42 | - * @since 11.0.0  | 
                                                        |
| 43 | - */  | 
                                                        |
| 44 | -	public function getIdentifier() { | 
                                                        |
| 45 | - return 'favorite';  | 
                                                        |
| 46 | - }  | 
                                                        |
| 40 | + /**  | 
                                                        |
| 41 | + * @return string Lowercase a-z and underscore only identifier  | 
                                                        |
| 42 | + * @since 11.0.0  | 
                                                        |
| 43 | + */  | 
                                                        |
| 44 | +    public function getIdentifier() { | 
                                                        |
| 45 | + return 'favorite';  | 
                                                        |
| 46 | + }  | 
                                                        |
| 47 | 47 | |
| 48 | - /**  | 
                                                        |
| 49 | - * @return string A translated string  | 
                                                        |
| 50 | - * @since 11.0.0  | 
                                                        |
| 51 | - */  | 
                                                        |
| 52 | -	public function getName() { | 
                                                        |
| 53 | -		return $this->l->t('A file has been added to or removed from your <strong>favorites</strong>'); | 
                                                        |
| 54 | - }  | 
                                                        |
| 48 | + /**  | 
                                                        |
| 49 | + * @return string A translated string  | 
                                                        |
| 50 | + * @since 11.0.0  | 
                                                        |
| 51 | + */  | 
                                                        |
| 52 | +    public function getName() { | 
                                                        |
| 53 | +        return $this->l->t('A file has been added to or removed from your <strong>favorites</strong>'); | 
                                                        |
| 54 | + }  | 
                                                        |
| 55 | 55 | |
| 56 | - /**  | 
                                                        |
| 57 | - * @return int whether the filter should be rather on the top or bottom of  | 
                                                        |
| 58 | - * the admin section. The filters are arranged in ascending order of the  | 
                                                        |
| 59 | - * priority values. It is required to return a value between 0 and 100.  | 
                                                        |
| 60 | - * @since 11.0.0  | 
                                                        |
| 61 | - */  | 
                                                        |
| 62 | -	public function getPriority() { | 
                                                        |
| 63 | - return 5;  | 
                                                        |
| 64 | - }  | 
                                                        |
| 56 | + /**  | 
                                                        |
| 57 | + * @return int whether the filter should be rather on the top or bottom of  | 
                                                        |
| 58 | + * the admin section. The filters are arranged in ascending order of the  | 
                                                        |
| 59 | + * priority values. It is required to return a value between 0 and 100.  | 
                                                        |
| 60 | + * @since 11.0.0  | 
                                                        |
| 61 | + */  | 
                                                        |
| 62 | +    public function getPriority() { | 
                                                        |
| 63 | + return 5;  | 
                                                        |
| 64 | + }  | 
                                                        |
| 65 | 65 | |
| 66 | - /**  | 
                                                        |
| 67 | - * @return bool True when the option can be changed for the stream  | 
                                                        |
| 68 | - * @since 11.0.0  | 
                                                        |
| 69 | - */  | 
                                                        |
| 70 | -	public function canChangeStream() { | 
                                                        |
| 71 | - return true;  | 
                                                        |
| 72 | - }  | 
                                                        |
| 66 | + /**  | 
                                                        |
| 67 | + * @return bool True when the option can be changed for the stream  | 
                                                        |
| 68 | + * @since 11.0.0  | 
                                                        |
| 69 | + */  | 
                                                        |
| 70 | +    public function canChangeStream() { | 
                                                        |
| 71 | + return true;  | 
                                                        |
| 72 | + }  | 
                                                        |
| 73 | 73 | |
| 74 | - /**  | 
                                                        |
| 75 | - * @return bool True when the option can be changed for the stream  | 
                                                        |
| 76 | - * @since 11.0.0  | 
                                                        |
| 77 | - */  | 
                                                        |
| 78 | -	public function isDefaultEnabledStream() { | 
                                                        |
| 79 | - return true;  | 
                                                        |
| 80 | - }  | 
                                                        |
| 74 | + /**  | 
                                                        |
| 75 | + * @return bool True when the option can be changed for the stream  | 
                                                        |
| 76 | + * @since 11.0.0  | 
                                                        |
| 77 | + */  | 
                                                        |
| 78 | +    public function isDefaultEnabledStream() { | 
                                                        |
| 79 | + return true;  | 
                                                        |
| 80 | + }  | 
                                                        |
| 81 | 81 | |
| 82 | - /**  | 
                                                        |
| 83 | - * @return bool True when the option can be changed for the mail  | 
                                                        |
| 84 | - * @since 11.0.0  | 
                                                        |
| 85 | - */  | 
                                                        |
| 86 | -	public function canChangeMail() { | 
                                                        |
| 87 | - return true;  | 
                                                        |
| 88 | - }  | 
                                                        |
| 82 | + /**  | 
                                                        |
| 83 | + * @return bool True when the option can be changed for the mail  | 
                                                        |
| 84 | + * @since 11.0.0  | 
                                                        |
| 85 | + */  | 
                                                        |
| 86 | +    public function canChangeMail() { | 
                                                        |
| 87 | + return true;  | 
                                                        |
| 88 | + }  | 
                                                        |
| 89 | 89 | |
| 90 | - /**  | 
                                                        |
| 91 | - * @return bool True when the option can be changed for the stream  | 
                                                        |
| 92 | - * @since 11.0.0  | 
                                                        |
| 93 | - */  | 
                                                        |
| 94 | -	public function isDefaultEnabledMail() { | 
                                                        |
| 95 | - return false;  | 
                                                        |
| 96 | - }  | 
                                                        |
| 90 | + /**  | 
                                                        |
| 91 | + * @return bool True when the option can be changed for the stream  | 
                                                        |
| 92 | + * @since 11.0.0  | 
                                                        |
| 93 | + */  | 
                                                        |
| 94 | +    public function isDefaultEnabledMail() { | 
                                                        |
| 95 | + return false;  | 
                                                        |
| 96 | + }  | 
                                                        |
| 97 | 97 | }  | 
                                                        
| 98 | 98 | |
@@ -27,72 +27,72 @@  | 
                                                    ||
| 27 | 27 | |
| 28 | 28 |  class FileFavorite implements ISetting { | 
                                                        
| 29 | 29 | |
| 30 | - /** @var IL10N */  | 
                                                        |
| 31 | - protected $l;  | 
                                                        |
| 30 | + /** @var IL10N */  | 
                                                        |
| 31 | + protected $l;  | 
                                                        |
| 32 | 32 | |
| 33 | - /**  | 
                                                        |
| 34 | - * @param IL10N $l  | 
                                                        |
| 35 | - */  | 
                                                        |
| 36 | -	public function __construct(IL10N $l) { | 
                                                        |
| 37 | - $this->l = $l;  | 
                                                        |
| 38 | - }  | 
                                                        |
| 33 | + /**  | 
                                                        |
| 34 | + * @param IL10N $l  | 
                                                        |
| 35 | + */  | 
                                                        |
| 36 | +    public function __construct(IL10N $l) { | 
                                                        |
| 37 | + $this->l = $l;  | 
                                                        |
| 38 | + }  | 
                                                        |
| 39 | 39 | |
| 40 | - /**  | 
                                                        |
| 41 | - * @return string Lowercase a-z and underscore only identifier  | 
                                                        |
| 42 | - * @since 11.0.0  | 
                                                        |
| 43 | - */  | 
                                                        |
| 44 | -	public function getIdentifier() { | 
                                                        |
| 45 | - return 'file_favorite';  | 
                                                        |
| 46 | - }  | 
                                                        |
| 40 | + /**  | 
                                                        |
| 41 | + * @return string Lowercase a-z and underscore only identifier  | 
                                                        |
| 42 | + * @since 11.0.0  | 
                                                        |
| 43 | + */  | 
                                                        |
| 44 | +    public function getIdentifier() { | 
                                                        |
| 45 | + return 'file_favorite';  | 
                                                        |
| 46 | + }  | 
                                                        |
| 47 | 47 | |
| 48 | - /**  | 
                                                        |
| 49 | - * @return string A translated string  | 
                                                        |
| 50 | - * @since 11.0.0  | 
                                                        |
| 51 | - */  | 
                                                        |
| 52 | -	public function getName() { | 
                                                        |
| 53 | -		return $this->l->t('Limit notifications about creation and changes to your <strong>favorite files</strong> <em>(Stream only)</em>'); | 
                                                        |
| 54 | - }  | 
                                                        |
| 48 | + /**  | 
                                                        |
| 49 | + * @return string A translated string  | 
                                                        |
| 50 | + * @since 11.0.0  | 
                                                        |
| 51 | + */  | 
                                                        |
| 52 | +    public function getName() { | 
                                                        |
| 53 | +        return $this->l->t('Limit notifications about creation and changes to your <strong>favorite files</strong> <em>(Stream only)</em>'); | 
                                                        |
| 54 | + }  | 
                                                        |
| 55 | 55 | |
| 56 | - /**  | 
                                                        |
| 57 | - * @return int whether the filter should be rather on the top or bottom of  | 
                                                        |
| 58 | - * the admin section. The filters are arranged in ascending order of the  | 
                                                        |
| 59 | - * priority values. It is required to return a value between 0 and 100.  | 
                                                        |
| 60 | - * @since 11.0.0  | 
                                                        |
| 61 | - */  | 
                                                        |
| 62 | -	public function getPriority() { | 
                                                        |
| 63 | - return 2;  | 
                                                        |
| 64 | - }  | 
                                                        |
| 56 | + /**  | 
                                                        |
| 57 | + * @return int whether the filter should be rather on the top or bottom of  | 
                                                        |
| 58 | + * the admin section. The filters are arranged in ascending order of the  | 
                                                        |
| 59 | + * priority values. It is required to return a value between 0 and 100.  | 
                                                        |
| 60 | + * @since 11.0.0  | 
                                                        |
| 61 | + */  | 
                                                        |
| 62 | +    public function getPriority() { | 
                                                        |
| 63 | + return 2;  | 
                                                        |
| 64 | + }  | 
                                                        |
| 65 | 65 | |
| 66 | - /**  | 
                                                        |
| 67 | - * @return bool True when the option can be changed for the stream  | 
                                                        |
| 68 | - * @since 11.0.0  | 
                                                        |
| 69 | - */  | 
                                                        |
| 70 | -	public function canChangeStream() { | 
                                                        |
| 71 | - return true;  | 
                                                        |
| 72 | - }  | 
                                                        |
| 66 | + /**  | 
                                                        |
| 67 | + * @return bool True when the option can be changed for the stream  | 
                                                        |
| 68 | + * @since 11.0.0  | 
                                                        |
| 69 | + */  | 
                                                        |
| 70 | +    public function canChangeStream() { | 
                                                        |
| 71 | + return true;  | 
                                                        |
| 72 | + }  | 
                                                        |
| 73 | 73 | |
| 74 | - /**  | 
                                                        |
| 75 | - * @return bool True when the option can be changed for the stream  | 
                                                        |
| 76 | - * @since 11.0.0  | 
                                                        |
| 77 | - */  | 
                                                        |
| 78 | -	public function isDefaultEnabledStream() { | 
                                                        |
| 79 | - return false;  | 
                                                        |
| 80 | - }  | 
                                                        |
| 74 | + /**  | 
                                                        |
| 75 | + * @return bool True when the option can be changed for the stream  | 
                                                        |
| 76 | + * @since 11.0.0  | 
                                                        |
| 77 | + */  | 
                                                        |
| 78 | +    public function isDefaultEnabledStream() { | 
                                                        |
| 79 | + return false;  | 
                                                        |
| 80 | + }  | 
                                                        |
| 81 | 81 | |
| 82 | - /**  | 
                                                        |
| 83 | - * @return bool True when the option can be changed for the mail  | 
                                                        |
| 84 | - * @since 11.0.0  | 
                                                        |
| 85 | - */  | 
                                                        |
| 86 | -	public function canChangeMail() { | 
                                                        |
| 87 | - return false;  | 
                                                        |
| 88 | - }  | 
                                                        |
| 82 | + /**  | 
                                                        |
| 83 | + * @return bool True when the option can be changed for the mail  | 
                                                        |
| 84 | + * @since 11.0.0  | 
                                                        |
| 85 | + */  | 
                                                        |
| 86 | +    public function canChangeMail() { | 
                                                        |
| 87 | + return false;  | 
                                                        |
| 88 | + }  | 
                                                        |
| 89 | 89 | |
| 90 | - /**  | 
                                                        |
| 91 | - * @return bool True when the option can be changed for the stream  | 
                                                        |
| 92 | - * @since 11.0.0  | 
                                                        |
| 93 | - */  | 
                                                        |
| 94 | -	public function isDefaultEnabledMail() { | 
                                                        |
| 95 | - return false;  | 
                                                        |
| 96 | - }  | 
                                                        |
| 90 | + /**  | 
                                                        |
| 91 | + * @return bool True when the option can be changed for the stream  | 
                                                        |
| 92 | + * @since 11.0.0  | 
                                                        |
| 93 | + */  | 
                                                        |
| 94 | +    public function isDefaultEnabledMail() { | 
                                                        |
| 95 | + return false;  | 
                                                        |
| 96 | + }  | 
                                                        |
| 97 | 97 | }  | 
                                                        
| 98 | 98 | |
@@ -75,7 +75,7 @@  | 
                                                    ||
| 75 | 75 |  			} elseif ($file->isMounted()) { | 
                                                        
| 76 | 76 |  				$icon = \OC::$server->getMimeTypeDetector()->mimeTypeIcon('dir-external'); | 
                                                        
| 77 | 77 | }  | 
                                                        
| 78 | -		}else{ | 
                                                        |
| 78 | +		} else{ | 
                                                        |
| 79 | 79 | $icon = \OC::$server->getMimeTypeDetector()->mimeTypeIcon($file->getMimetype());  | 
                                                        
| 80 | 80 | }  | 
                                                        
| 81 | 81 | |
@@ -58,7 +58,7 @@ discard block  | 
                                                    ||
| 58 | 58 | 'freeSpace' => $storageInfo['free'],  | 
                                                        
| 59 | 59 | 'quota' => $storageInfo['quota'],  | 
                                                        
| 60 | 60 | 'used' => $storageInfo['used'],  | 
                                                        
| 61 | - 'usedSpacePercent' => (int)$storageInfo['relative'],  | 
                                                        |
| 61 | + 'usedSpacePercent' => (int) $storageInfo['relative'],  | 
                                                        |
| 62 | 62 | 'owner' => $storageInfo['owner'],  | 
                                                        
| 63 | 63 | 'ownerDisplayName' => $storageInfo['ownerDisplayName'],  | 
                                                        
| 64 | 64 | ];  | 
                                                        
@@ -71,7 +71,7 @@ discard block  | 
                                                    ||
| 71 | 71 | * @return string icon URL  | 
                                                        
| 72 | 72 | */  | 
                                                        
| 73 | 73 |  	public static function determineIcon($file) { | 
                                                        
| 74 | -		if($file['type'] === 'dir') { | 
                                                        |
| 74 | +		if ($file['type'] === 'dir') { | 
                                                        |
| 75 | 75 |  			$icon = \OC::$server->getMimeTypeDetector()->mimeTypeIcon('dir'); | 
                                                        
| 76 | 76 | // TODO: move this part to the client side, using mountType  | 
                                                        
| 77 | 77 |  			if ($file->isShared()) { | 
                                                        
@@ -79,11 +79,11 @@ discard block  | 
                                                    ||
| 79 | 79 |  			} elseif ($file->isMounted()) { | 
                                                        
| 80 | 80 |  				$icon = \OC::$server->getMimeTypeDetector()->mimeTypeIcon('dir-external'); | 
                                                        
| 81 | 81 | }  | 
                                                        
| 82 | -		}else{ | 
                                                        |
| 82 | +		} else { | 
                                                        |
| 83 | 83 | $icon = \OC::$server->getMimeTypeDetector()->mimeTypeIcon($file->getMimetype());  | 
                                                        
| 84 | 84 | }  | 
                                                        
| 85 | 85 | |
| 86 | - return substr($icon, 0, -3) . 'svg';  | 
                                                        |
| 86 | + return substr($icon, 0, -3).'svg';  | 
                                                        |
| 87 | 87 | }  | 
                                                        
| 88 | 88 | |
| 89 | 89 | /**  | 
                                                        
@@ -40,232 +40,232 @@  | 
                                                    ||
| 40 | 40 | * Helper class for manipulating file information  | 
                                                        
| 41 | 41 | */  | 
                                                        
| 42 | 42 |  class Helper { | 
                                                        
| 43 | - /**  | 
                                                        |
| 44 | - * @param string $dir  | 
                                                        |
| 45 | - * @return array  | 
                                                        |
| 46 | - * @throws \OCP\Files\NotFoundException  | 
                                                        |
| 47 | - */  | 
                                                        |
| 48 | -	public static function buildFileStorageStatistics($dir) { | 
                                                        |
| 49 | - // information about storage capacities  | 
                                                        |
| 50 | - $storageInfo = \OC_Helper::getStorageInfo($dir);  | 
                                                        |
| 51 | -		$l = \OC::$server->getL10N('files'); | 
                                                        |
| 52 | - $maxUploadFileSize = \OCP\Util::maxUploadFilesize($dir, $storageInfo['free']);  | 
                                                        |
| 53 | - $maxHumanFileSize = \OCP\Util::humanFileSize($maxUploadFileSize);  | 
                                                        |
| 54 | -		$maxHumanFileSize = $l->t('Upload (max. %s)', [$maxHumanFileSize]); | 
                                                        |
| 43 | + /**  | 
                                                        |
| 44 | + * @param string $dir  | 
                                                        |
| 45 | + * @return array  | 
                                                        |
| 46 | + * @throws \OCP\Files\NotFoundException  | 
                                                        |
| 47 | + */  | 
                                                        |
| 48 | +    public static function buildFileStorageStatistics($dir) { | 
                                                        |
| 49 | + // information about storage capacities  | 
                                                        |
| 50 | + $storageInfo = \OC_Helper::getStorageInfo($dir);  | 
                                                        |
| 51 | +        $l = \OC::$server->getL10N('files'); | 
                                                        |
| 52 | + $maxUploadFileSize = \OCP\Util::maxUploadFilesize($dir, $storageInfo['free']);  | 
                                                        |
| 53 | + $maxHumanFileSize = \OCP\Util::humanFileSize($maxUploadFileSize);  | 
                                                        |
| 54 | +        $maxHumanFileSize = $l->t('Upload (max. %s)', [$maxHumanFileSize]); | 
                                                        |
| 55 | 55 | |
| 56 | - return [  | 
                                                        |
| 57 | - 'uploadMaxFilesize' => $maxUploadFileSize,  | 
                                                        |
| 58 | - 'maxHumanFilesize' => $maxHumanFileSize,  | 
                                                        |
| 59 | - 'freeSpace' => $storageInfo['free'],  | 
                                                        |
| 60 | - 'quota' => $storageInfo['quota'],  | 
                                                        |
| 61 | - 'used' => $storageInfo['used'],  | 
                                                        |
| 62 | - 'usedSpacePercent' => (int)$storageInfo['relative'],  | 
                                                        |
| 63 | - 'owner' => $storageInfo['owner'],  | 
                                                        |
| 64 | - 'ownerDisplayName' => $storageInfo['ownerDisplayName'],  | 
                                                        |
| 65 | - ];  | 
                                                        |
| 66 | - }  | 
                                                        |
| 56 | + return [  | 
                                                        |
| 57 | + 'uploadMaxFilesize' => $maxUploadFileSize,  | 
                                                        |
| 58 | + 'maxHumanFilesize' => $maxHumanFileSize,  | 
                                                        |
| 59 | + 'freeSpace' => $storageInfo['free'],  | 
                                                        |
| 60 | + 'quota' => $storageInfo['quota'],  | 
                                                        |
| 61 | + 'used' => $storageInfo['used'],  | 
                                                        |
| 62 | + 'usedSpacePercent' => (int)$storageInfo['relative'],  | 
                                                        |
| 63 | + 'owner' => $storageInfo['owner'],  | 
                                                        |
| 64 | + 'ownerDisplayName' => $storageInfo['ownerDisplayName'],  | 
                                                        |
| 65 | + ];  | 
                                                        |
| 66 | + }  | 
                                                        |
| 67 | 67 | |
| 68 | - /**  | 
                                                        |
| 69 | - * Determine icon for a given file  | 
                                                        |
| 70 | - *  | 
                                                        |
| 71 | - * @param \OCP\Files\FileInfo $file file info  | 
                                                        |
| 72 | - * @return string icon URL  | 
                                                        |
| 73 | - */  | 
                                                        |
| 74 | -	public static function determineIcon($file) { | 
                                                        |
| 75 | -		if($file['type'] === 'dir') { | 
                                                        |
| 76 | -			$icon = \OC::$server->getMimeTypeDetector()->mimeTypeIcon('dir'); | 
                                                        |
| 77 | - // TODO: move this part to the client side, using mountType  | 
                                                        |
| 78 | -			if ($file->isShared()) { | 
                                                        |
| 79 | -				$icon = \OC::$server->getMimeTypeDetector()->mimeTypeIcon('dir-shared'); | 
                                                        |
| 80 | -			} elseif ($file->isMounted()) { | 
                                                        |
| 81 | -				$icon = \OC::$server->getMimeTypeDetector()->mimeTypeIcon('dir-external'); | 
                                                        |
| 82 | - }  | 
                                                        |
| 83 | -		}else{ | 
                                                        |
| 84 | - $icon = \OC::$server->getMimeTypeDetector()->mimeTypeIcon($file->getMimetype());  | 
                                                        |
| 85 | - }  | 
                                                        |
| 68 | + /**  | 
                                                        |
| 69 | + * Determine icon for a given file  | 
                                                        |
| 70 | + *  | 
                                                        |
| 71 | + * @param \OCP\Files\FileInfo $file file info  | 
                                                        |
| 72 | + * @return string icon URL  | 
                                                        |
| 73 | + */  | 
                                                        |
| 74 | +    public static function determineIcon($file) { | 
                                                        |
| 75 | +        if($file['type'] === 'dir') { | 
                                                        |
| 76 | +            $icon = \OC::$server->getMimeTypeDetector()->mimeTypeIcon('dir'); | 
                                                        |
| 77 | + // TODO: move this part to the client side, using mountType  | 
                                                        |
| 78 | +            if ($file->isShared()) { | 
                                                        |
| 79 | +                $icon = \OC::$server->getMimeTypeDetector()->mimeTypeIcon('dir-shared'); | 
                                                        |
| 80 | +            } elseif ($file->isMounted()) { | 
                                                        |
| 81 | +                $icon = \OC::$server->getMimeTypeDetector()->mimeTypeIcon('dir-external'); | 
                                                        |
| 82 | + }  | 
                                                        |
| 83 | +        }else{ | 
                                                        |
| 84 | + $icon = \OC::$server->getMimeTypeDetector()->mimeTypeIcon($file->getMimetype());  | 
                                                        |
| 85 | + }  | 
                                                        |
| 86 | 86 | |
| 87 | - return substr($icon, 0, -3) . 'svg';  | 
                                                        |
| 88 | - }  | 
                                                        |
| 87 | + return substr($icon, 0, -3) . 'svg';  | 
                                                        |
| 88 | + }  | 
                                                        |
| 89 | 89 | |
| 90 | - /**  | 
                                                        |
| 91 | - * Comparator function to sort files alphabetically and have  | 
                                                        |
| 92 | - * the directories appear first  | 
                                                        |
| 93 | - *  | 
                                                        |
| 94 | - * @param \OCP\Files\FileInfo $a file  | 
                                                        |
| 95 | - * @param \OCP\Files\FileInfo $b file  | 
                                                        |
| 96 | - * @return int -1 if $a must come before $b, 1 otherwise  | 
                                                        |
| 97 | - */  | 
                                                        |
| 98 | -	public static function compareFileNames(FileInfo $a, FileInfo $b) { | 
                                                        |
| 99 | - $aType = $a->getType();  | 
                                                        |
| 100 | - $bType = $b->getType();  | 
                                                        |
| 101 | -		if ($aType === 'dir' and $bType !== 'dir') { | 
                                                        |
| 102 | - return -1;  | 
                                                        |
| 103 | -		} elseif ($aType !== 'dir' and $bType === 'dir') { | 
                                                        |
| 104 | - return 1;  | 
                                                        |
| 105 | -		} else { | 
                                                        |
| 106 | - return \OCP\Util::naturalSortCompare($a->getName(), $b->getName());  | 
                                                        |
| 107 | - }  | 
                                                        |
| 108 | - }  | 
                                                        |
| 90 | + /**  | 
                                                        |
| 91 | + * Comparator function to sort files alphabetically and have  | 
                                                        |
| 92 | + * the directories appear first  | 
                                                        |
| 93 | + *  | 
                                                        |
| 94 | + * @param \OCP\Files\FileInfo $a file  | 
                                                        |
| 95 | + * @param \OCP\Files\FileInfo $b file  | 
                                                        |
| 96 | + * @return int -1 if $a must come before $b, 1 otherwise  | 
                                                        |
| 97 | + */  | 
                                                        |
| 98 | +    public static function compareFileNames(FileInfo $a, FileInfo $b) { | 
                                                        |
| 99 | + $aType = $a->getType();  | 
                                                        |
| 100 | + $bType = $b->getType();  | 
                                                        |
| 101 | +        if ($aType === 'dir' and $bType !== 'dir') { | 
                                                        |
| 102 | + return -1;  | 
                                                        |
| 103 | +        } elseif ($aType !== 'dir' and $bType === 'dir') { | 
                                                        |
| 104 | + return 1;  | 
                                                        |
| 105 | +        } else { | 
                                                        |
| 106 | + return \OCP\Util::naturalSortCompare($a->getName(), $b->getName());  | 
                                                        |
| 107 | + }  | 
                                                        |
| 108 | + }  | 
                                                        |
| 109 | 109 | |
| 110 | - /**  | 
                                                        |
| 111 | - * Comparator function to sort files by date  | 
                                                        |
| 112 | - *  | 
                                                        |
| 113 | - * @param \OCP\Files\FileInfo $a file  | 
                                                        |
| 114 | - * @param \OCP\Files\FileInfo $b file  | 
                                                        |
| 115 | - * @return int -1 if $a must come before $b, 1 otherwise  | 
                                                        |
| 116 | - */  | 
                                                        |
| 117 | -	public static function compareTimestamp(FileInfo $a, FileInfo $b) { | 
                                                        |
| 118 | - $aTime = $a->getMTime();  | 
                                                        |
| 119 | - $bTime = $b->getMTime();  | 
                                                        |
| 120 | - return ($aTime < $bTime) ? -1 : 1;  | 
                                                        |
| 121 | - }  | 
                                                        |
| 110 | + /**  | 
                                                        |
| 111 | + * Comparator function to sort files by date  | 
                                                        |
| 112 | + *  | 
                                                        |
| 113 | + * @param \OCP\Files\FileInfo $a file  | 
                                                        |
| 114 | + * @param \OCP\Files\FileInfo $b file  | 
                                                        |
| 115 | + * @return int -1 if $a must come before $b, 1 otherwise  | 
                                                        |
| 116 | + */  | 
                                                        |
| 117 | +    public static function compareTimestamp(FileInfo $a, FileInfo $b) { | 
                                                        |
| 118 | + $aTime = $a->getMTime();  | 
                                                        |
| 119 | + $bTime = $b->getMTime();  | 
                                                        |
| 120 | + return ($aTime < $bTime) ? -1 : 1;  | 
                                                        |
| 121 | + }  | 
                                                        |
| 122 | 122 | |
| 123 | - /**  | 
                                                        |
| 124 | - * Comparator function to sort files by size  | 
                                                        |
| 125 | - *  | 
                                                        |
| 126 | - * @param \OCP\Files\FileInfo $a file  | 
                                                        |
| 127 | - * @param \OCP\Files\FileInfo $b file  | 
                                                        |
| 128 | - * @return int -1 if $a must come before $b, 1 otherwise  | 
                                                        |
| 129 | - */  | 
                                                        |
| 130 | -	public static function compareSize(FileInfo $a, FileInfo $b) { | 
                                                        |
| 131 | - $aSize = $a->getSize();  | 
                                                        |
| 132 | - $bSize = $b->getSize();  | 
                                                        |
| 133 | - return ($aSize < $bSize) ? -1 : 1;  | 
                                                        |
| 134 | - }  | 
                                                        |
| 123 | + /**  | 
                                                        |
| 124 | + * Comparator function to sort files by size  | 
                                                        |
| 125 | + *  | 
                                                        |
| 126 | + * @param \OCP\Files\FileInfo $a file  | 
                                                        |
| 127 | + * @param \OCP\Files\FileInfo $b file  | 
                                                        |
| 128 | + * @return int -1 if $a must come before $b, 1 otherwise  | 
                                                        |
| 129 | + */  | 
                                                        |
| 130 | +    public static function compareSize(FileInfo $a, FileInfo $b) { | 
                                                        |
| 131 | + $aSize = $a->getSize();  | 
                                                        |
| 132 | + $bSize = $b->getSize();  | 
                                                        |
| 133 | + return ($aSize < $bSize) ? -1 : 1;  | 
                                                        |
| 134 | + }  | 
                                                        |
| 135 | 135 | |
| 136 | - /**  | 
                                                        |
| 137 | - * Formats the file info to be returned as JSON to the client.  | 
                                                        |
| 138 | - *  | 
                                                        |
| 139 | - * @param \OCP\Files\FileInfo $i  | 
                                                        |
| 140 | - * @return array formatted file info  | 
                                                        |
| 141 | - */  | 
                                                        |
| 142 | -	public static function formatFileInfo(FileInfo $i) { | 
                                                        |
| 143 | - $entry = [];  | 
                                                        |
| 136 | + /**  | 
                                                        |
| 137 | + * Formats the file info to be returned as JSON to the client.  | 
                                                        |
| 138 | + *  | 
                                                        |
| 139 | + * @param \OCP\Files\FileInfo $i  | 
                                                        |
| 140 | + * @return array formatted file info  | 
                                                        |
| 141 | + */  | 
                                                        |
| 142 | +    public static function formatFileInfo(FileInfo $i) { | 
                                                        |
| 143 | + $entry = [];  | 
                                                        |
| 144 | 144 | |
| 145 | - $entry['id'] = $i['fileid'];  | 
                                                        |
| 146 | - $entry['parentId'] = $i['parent'];  | 
                                                        |
| 147 | - $entry['mtime'] = $i['mtime'] * 1000;  | 
                                                        |
| 148 | - // only pick out the needed attributes  | 
                                                        |
| 149 | - $entry['name'] = $i->getName();  | 
                                                        |
| 150 | - $entry['permissions'] = $i['permissions'];  | 
                                                        |
| 151 | - $entry['mimetype'] = $i['mimetype'];  | 
                                                        |
| 152 | - $entry['size'] = $i['size'];  | 
                                                        |
| 153 | - $entry['type'] = $i['type'];  | 
                                                        |
| 154 | - $entry['etag'] = $i['etag'];  | 
                                                        |
| 155 | -		if (isset($i['tags'])) { | 
                                                        |
| 156 | - $entry['tags'] = $i['tags'];  | 
                                                        |
| 157 | - }  | 
                                                        |
| 158 | -		if (isset($i['displayname_owner'])) { | 
                                                        |
| 159 | - $entry['shareOwner'] = $i['displayname_owner'];  | 
                                                        |
| 160 | - }  | 
                                                        |
| 161 | -		if (isset($i['is_share_mount_point'])) { | 
                                                        |
| 162 | - $entry['isShareMountPoint'] = $i['is_share_mount_point'];  | 
                                                        |
| 163 | - }  | 
                                                        |
| 164 | - $mountType = null;  | 
                                                        |
| 165 | - $mount = $i->getMountPoint();  | 
                                                        |
| 166 | - $mountType = $mount->getMountType();  | 
                                                        |
| 167 | -		if ($mountType !== '') { | 
                                                        |
| 168 | -			if ($i->getInternalPath() === '') { | 
                                                        |
| 169 | - $mountType .= '-root';  | 
                                                        |
| 170 | - }  | 
                                                        |
| 171 | - $entry['mountType'] = $mountType;  | 
                                                        |
| 172 | - }  | 
                                                        |
| 173 | -		if (isset($i['extraData'])) { | 
                                                        |
| 174 | - $entry['extraData'] = $i['extraData'];  | 
                                                        |
| 175 | - }  | 
                                                        |
| 176 | - return $entry;  | 
                                                        |
| 177 | - }  | 
                                                        |
| 145 | + $entry['id'] = $i['fileid'];  | 
                                                        |
| 146 | + $entry['parentId'] = $i['parent'];  | 
                                                        |
| 147 | + $entry['mtime'] = $i['mtime'] * 1000;  | 
                                                        |
| 148 | + // only pick out the needed attributes  | 
                                                        |
| 149 | + $entry['name'] = $i->getName();  | 
                                                        |
| 150 | + $entry['permissions'] = $i['permissions'];  | 
                                                        |
| 151 | + $entry['mimetype'] = $i['mimetype'];  | 
                                                        |
| 152 | + $entry['size'] = $i['size'];  | 
                                                        |
| 153 | + $entry['type'] = $i['type'];  | 
                                                        |
| 154 | + $entry['etag'] = $i['etag'];  | 
                                                        |
| 155 | +        if (isset($i['tags'])) { | 
                                                        |
| 156 | + $entry['tags'] = $i['tags'];  | 
                                                        |
| 157 | + }  | 
                                                        |
| 158 | +        if (isset($i['displayname_owner'])) { | 
                                                        |
| 159 | + $entry['shareOwner'] = $i['displayname_owner'];  | 
                                                        |
| 160 | + }  | 
                                                        |
| 161 | +        if (isset($i['is_share_mount_point'])) { | 
                                                        |
| 162 | + $entry['isShareMountPoint'] = $i['is_share_mount_point'];  | 
                                                        |
| 163 | + }  | 
                                                        |
| 164 | + $mountType = null;  | 
                                                        |
| 165 | + $mount = $i->getMountPoint();  | 
                                                        |
| 166 | + $mountType = $mount->getMountType();  | 
                                                        |
| 167 | +        if ($mountType !== '') { | 
                                                        |
| 168 | +            if ($i->getInternalPath() === '') { | 
                                                        |
| 169 | + $mountType .= '-root';  | 
                                                        |
| 170 | + }  | 
                                                        |
| 171 | + $entry['mountType'] = $mountType;  | 
                                                        |
| 172 | + }  | 
                                                        |
| 173 | +        if (isset($i['extraData'])) { | 
                                                        |
| 174 | + $entry['extraData'] = $i['extraData'];  | 
                                                        |
| 175 | + }  | 
                                                        |
| 176 | + return $entry;  | 
                                                        |
| 177 | + }  | 
                                                        |
| 178 | 178 | |
| 179 | - /**  | 
                                                        |
| 180 | - * Format file info for JSON  | 
                                                        |
| 181 | - * @param \OCP\Files\FileInfo[] $fileInfos file infos  | 
                                                        |
| 182 | - * @return array  | 
                                                        |
| 183 | - */  | 
                                                        |
| 184 | -	public static function formatFileInfos($fileInfos) { | 
                                                        |
| 185 | - $files = [];  | 
                                                        |
| 186 | -		foreach ($fileInfos as $i) { | 
                                                        |
| 187 | - $files[] = self::formatFileInfo($i);  | 
                                                        |
| 188 | - }  | 
                                                        |
| 179 | + /**  | 
                                                        |
| 180 | + * Format file info for JSON  | 
                                                        |
| 181 | + * @param \OCP\Files\FileInfo[] $fileInfos file infos  | 
                                                        |
| 182 | + * @return array  | 
                                                        |
| 183 | + */  | 
                                                        |
| 184 | +    public static function formatFileInfos($fileInfos) { | 
                                                        |
| 185 | + $files = [];  | 
                                                        |
| 186 | +        foreach ($fileInfos as $i) { | 
                                                        |
| 187 | + $files[] = self::formatFileInfo($i);  | 
                                                        |
| 188 | + }  | 
                                                        |
| 189 | 189 | |
| 190 | - return $files;  | 
                                                        |
| 191 | - }  | 
                                                        |
| 190 | + return $files;  | 
                                                        |
| 191 | + }  | 
                                                        |
| 192 | 192 | |
| 193 | - /**  | 
                                                        |
| 194 | - * Retrieves the contents of the given directory and  | 
                                                        |
| 195 | - * returns it as a sorted array of FileInfo.  | 
                                                        |
| 196 | - *  | 
                                                        |
| 197 | - * @param string $dir path to the directory  | 
                                                        |
| 198 | - * @param string $sortAttribute attribute to sort on  | 
                                                        |
| 199 | - * @param bool $sortDescending true for descending sort, false otherwise  | 
                                                        |
| 200 | - * @param string $mimetypeFilter limit returned content to this mimetype or mimepart  | 
                                                        |
| 201 | - * @return \OCP\Files\FileInfo[] files  | 
                                                        |
| 202 | - */  | 
                                                        |
| 203 | -	public static function getFiles($dir, $sortAttribute = 'name', $sortDescending = false, $mimetypeFilter = '') { | 
                                                        |
| 204 | - $content = \OC\Files\Filesystem::getDirectoryContent($dir, $mimetypeFilter);  | 
                                                        |
| 193 | + /**  | 
                                                        |
| 194 | + * Retrieves the contents of the given directory and  | 
                                                        |
| 195 | + * returns it as a sorted array of FileInfo.  | 
                                                        |
| 196 | + *  | 
                                                        |
| 197 | + * @param string $dir path to the directory  | 
                                                        |
| 198 | + * @param string $sortAttribute attribute to sort on  | 
                                                        |
| 199 | + * @param bool $sortDescending true for descending sort, false otherwise  | 
                                                        |
| 200 | + * @param string $mimetypeFilter limit returned content to this mimetype or mimepart  | 
                                                        |
| 201 | + * @return \OCP\Files\FileInfo[] files  | 
                                                        |
| 202 | + */  | 
                                                        |
| 203 | +    public static function getFiles($dir, $sortAttribute = 'name', $sortDescending = false, $mimetypeFilter = '') { | 
                                                        |
| 204 | + $content = \OC\Files\Filesystem::getDirectoryContent($dir, $mimetypeFilter);  | 
                                                        |
| 205 | 205 | |
| 206 | - return self::sortFiles($content, $sortAttribute, $sortDescending);  | 
                                                        |
| 207 | - }  | 
                                                        |
| 206 | + return self::sortFiles($content, $sortAttribute, $sortDescending);  | 
                                                        |
| 207 | + }  | 
                                                        |
| 208 | 208 | |
| 209 | - /**  | 
                                                        |
| 210 | - * Populate the result set with file tags  | 
                                                        |
| 211 | - *  | 
                                                        |
| 212 | - * @param array $fileList  | 
                                                        |
| 213 | - * @param string $fileIdentifier identifier attribute name for values in $fileList  | 
                                                        |
| 214 | - * @param ITagManager $tagManager  | 
                                                        |
| 215 | - * @return array file list populated with tags  | 
                                                        |
| 216 | - */  | 
                                                        |
| 217 | -	public static function populateTags(array $fileList, $fileIdentifier = 'fileid', ITagManager $tagManager) { | 
                                                        |
| 218 | - $ids = [];  | 
                                                        |
| 219 | -		foreach ($fileList as $fileData) { | 
                                                        |
| 220 | - $ids[] = $fileData[$fileIdentifier];  | 
                                                        |
| 221 | - }  | 
                                                        |
| 222 | -		$tagger = $tagManager->load('files'); | 
                                                        |
| 223 | - $tags = $tagger->getTagsForObjects($ids);  | 
                                                        |
| 209 | + /**  | 
                                                        |
| 210 | + * Populate the result set with file tags  | 
                                                        |
| 211 | + *  | 
                                                        |
| 212 | + * @param array $fileList  | 
                                                        |
| 213 | + * @param string $fileIdentifier identifier attribute name for values in $fileList  | 
                                                        |
| 214 | + * @param ITagManager $tagManager  | 
                                                        |
| 215 | + * @return array file list populated with tags  | 
                                                        |
| 216 | + */  | 
                                                        |
| 217 | +    public static function populateTags(array $fileList, $fileIdentifier = 'fileid', ITagManager $tagManager) { | 
                                                        |
| 218 | + $ids = [];  | 
                                                        |
| 219 | +        foreach ($fileList as $fileData) { | 
                                                        |
| 220 | + $ids[] = $fileData[$fileIdentifier];  | 
                                                        |
| 221 | + }  | 
                                                        |
| 222 | +        $tagger = $tagManager->load('files'); | 
                                                        |
| 223 | + $tags = $tagger->getTagsForObjects($ids);  | 
                                                        |
| 224 | 224 | |
| 225 | -		if (!is_array($tags)) { | 
                                                        |
| 226 | -			throw new \UnexpectedValueException('$tags must be an array'); | 
                                                        |
| 227 | - }  | 
                                                        |
| 225 | +        if (!is_array($tags)) { | 
                                                        |
| 226 | +            throw new \UnexpectedValueException('$tags must be an array'); | 
                                                        |
| 227 | + }  | 
                                                        |
| 228 | 228 | |
| 229 | - // Set empty tag array  | 
                                                        |
| 230 | -		foreach ($fileList as $key => $fileData) { | 
                                                        |
| 231 | - $fileList[$key]['tags'] = [];  | 
                                                        |
| 232 | - }  | 
                                                        |
| 229 | + // Set empty tag array  | 
                                                        |
| 230 | +        foreach ($fileList as $key => $fileData) { | 
                                                        |
| 231 | + $fileList[$key]['tags'] = [];  | 
                                                        |
| 232 | + }  | 
                                                        |
| 233 | 233 | |
| 234 | -		if (!empty($tags)) { | 
                                                        |
| 235 | -			foreach ($tags as $fileId => $fileTags) { | 
                                                        |
| 234 | +        if (!empty($tags)) { | 
                                                        |
| 235 | +            foreach ($tags as $fileId => $fileTags) { | 
                                                        |
| 236 | 236 | |
| 237 | -				foreach ($fileList as $key => $fileData) { | 
                                                        |
| 238 | -					if ($fileId !== $fileData[$fileIdentifier]) { | 
                                                        |
| 239 | - continue;  | 
                                                        |
| 240 | - }  | 
                                                        |
| 237 | +                foreach ($fileList as $key => $fileData) { | 
                                                        |
| 238 | +                    if ($fileId !== $fileData[$fileIdentifier]) { | 
                                                        |
| 239 | + continue;  | 
                                                        |
| 240 | + }  | 
                                                        |
| 241 | 241 | |
| 242 | - $fileList[$key]['tags'] = $fileTags;  | 
                                                        |
| 243 | - }  | 
                                                        |
| 244 | - }  | 
                                                        |
| 245 | - }  | 
                                                        |
| 242 | + $fileList[$key]['tags'] = $fileTags;  | 
                                                        |
| 243 | + }  | 
                                                        |
| 244 | + }  | 
                                                        |
| 245 | + }  | 
                                                        |
| 246 | 246 | |
| 247 | - return $fileList;  | 
                                                        |
| 248 | - }  | 
                                                        |
| 247 | + return $fileList;  | 
                                                        |
| 248 | + }  | 
                                                        |
| 249 | 249 | |
| 250 | - /**  | 
                                                        |
| 251 | - * Sort the given file info array  | 
                                                        |
| 252 | - *  | 
                                                        |
| 253 | - * @param \OCP\Files\FileInfo[] $files files to sort  | 
                                                        |
| 254 | - * @param string $sortAttribute attribute to sort on  | 
                                                        |
| 255 | - * @param bool $sortDescending true for descending sort, false otherwise  | 
                                                        |
| 256 | - * @return \OCP\Files\FileInfo[] sorted files  | 
                                                        |
| 257 | - */  | 
                                                        |
| 258 | -	public static function sortFiles($files, $sortAttribute = 'name', $sortDescending = false) { | 
                                                        |
| 259 | - $sortFunc = 'compareFileNames';  | 
                                                        |
| 260 | -		if ($sortAttribute === 'mtime') { | 
                                                        |
| 261 | - $sortFunc = 'compareTimestamp';  | 
                                                        |
| 262 | -		} else if ($sortAttribute === 'size') { | 
                                                        |
| 263 | - $sortFunc = 'compareSize';  | 
                                                        |
| 264 | - }  | 
                                                        |
| 265 | - usort($files, [Helper::class, $sortFunc]);  | 
                                                        |
| 266 | -		if ($sortDescending) { | 
                                                        |
| 267 | - $files = array_reverse($files);  | 
                                                        |
| 268 | - }  | 
                                                        |
| 269 | - return $files;  | 
                                                        |
| 270 | - }  | 
                                                        |
| 250 | + /**  | 
                                                        |
| 251 | + * Sort the given file info array  | 
                                                        |
| 252 | + *  | 
                                                        |
| 253 | + * @param \OCP\Files\FileInfo[] $files files to sort  | 
                                                        |
| 254 | + * @param string $sortAttribute attribute to sort on  | 
                                                        |
| 255 | + * @param bool $sortDescending true for descending sort, false otherwise  | 
                                                        |
| 256 | + * @return \OCP\Files\FileInfo[] sorted files  | 
                                                        |
| 257 | + */  | 
                                                        |
| 258 | +    public static function sortFiles($files, $sortAttribute = 'name', $sortDescending = false) { | 
                                                        |
| 259 | + $sortFunc = 'compareFileNames';  | 
                                                        |
| 260 | +        if ($sortAttribute === 'mtime') { | 
                                                        |
| 261 | + $sortFunc = 'compareTimestamp';  | 
                                                        |
| 262 | +        } else if ($sortAttribute === 'size') { | 
                                                        |
| 263 | + $sortFunc = 'compareSize';  | 
                                                        |
| 264 | + }  | 
                                                        |
| 265 | + usort($files, [Helper::class, $sortFunc]);  | 
                                                        |
| 266 | +        if ($sortDescending) { | 
                                                        |
| 267 | + $files = array_reverse($files);  | 
                                                        |
| 268 | + }  | 
                                                        |
| 269 | + return $files;  | 
                                                        |
| 270 | + }  | 
                                                        |
| 271 | 271 | }  | 
                                                        
@@ -35,51 +35,51 @@  | 
                                                    ||
| 35 | 35 | */  | 
                                                        
| 36 | 36 |  class DeleteOrphanedFiles extends Command { | 
                                                        
| 37 | 37 | |
| 38 | - const CHUNK_SIZE = 200;  | 
                                                        |
| 38 | + const CHUNK_SIZE = 200;  | 
                                                        |
| 39 | 39 | |
| 40 | - /**  | 
                                                        |
| 41 | - * @var IDBConnection  | 
                                                        |
| 42 | - */  | 
                                                        |
| 43 | - protected $connection;  | 
                                                        |
| 40 | + /**  | 
                                                        |
| 41 | + * @var IDBConnection  | 
                                                        |
| 42 | + */  | 
                                                        |
| 43 | + protected $connection;  | 
                                                        |
| 44 | 44 | |
| 45 | -	public function __construct(IDBConnection $connection) { | 
                                                        |
| 46 | - $this->connection = $connection;  | 
                                                        |
| 47 | - parent::__construct();  | 
                                                        |
| 48 | - }  | 
                                                        |
| 45 | +    public function __construct(IDBConnection $connection) { | 
                                                        |
| 46 | + $this->connection = $connection;  | 
                                                        |
| 47 | + parent::__construct();  | 
                                                        |
| 48 | + }  | 
                                                        |
| 49 | 49 | |
| 50 | -	protected function configure() { | 
                                                        |
| 51 | - $this  | 
                                                        |
| 52 | -			->setName('files:cleanup') | 
                                                        |
| 53 | -			->setDescription('cleanup filecache'); | 
                                                        |
| 54 | - }  | 
                                                        |
| 50 | +    protected function configure() { | 
                                                        |
| 51 | + $this  | 
                                                        |
| 52 | +            ->setName('files:cleanup') | 
                                                        |
| 53 | +            ->setDescription('cleanup filecache'); | 
                                                        |
| 54 | + }  | 
                                                        |
| 55 | 55 | |
| 56 | -	public function execute(InputInterface $input, OutputInterface $output) { | 
                                                        |
| 57 | - $deletedEntries = 0;  | 
                                                        |
| 56 | +    public function execute(InputInterface $input, OutputInterface $output) { | 
                                                        |
| 57 | + $deletedEntries = 0;  | 
                                                        |
| 58 | 58 | |
| 59 | - $query = $this->connection->getQueryBuilder();  | 
                                                        |
| 60 | -		$query->select('fc.fileid') | 
                                                        |
| 61 | -			->from('filecache', 'fc') | 
                                                        |
| 62 | -			->where($query->expr()->isNull('s.numeric_id')) | 
                                                        |
| 63 | -			->leftJoin('fc', 'storages', 's', $query->expr()->eq('fc.storage', 's.numeric_id')) | 
                                                        |
| 64 | - ->setMaxResults(self::CHUNK_SIZE);  | 
                                                        |
| 59 | + $query = $this->connection->getQueryBuilder();  | 
                                                        |
| 60 | +        $query->select('fc.fileid') | 
                                                        |
| 61 | +            ->from('filecache', 'fc') | 
                                                        |
| 62 | +            ->where($query->expr()->isNull('s.numeric_id')) | 
                                                        |
| 63 | +            ->leftJoin('fc', 'storages', 's', $query->expr()->eq('fc.storage', 's.numeric_id')) | 
                                                        |
| 64 | + ->setMaxResults(self::CHUNK_SIZE);  | 
                                                        |
| 65 | 65 | |
| 66 | - $deleteQuery = $this->connection->getQueryBuilder();  | 
                                                        |
| 67 | -		$deleteQuery->delete('filecache') | 
                                                        |
| 68 | -			->where($deleteQuery->expr()->eq('fileid', $deleteQuery->createParameter('objectid'))); | 
                                                        |
| 66 | + $deleteQuery = $this->connection->getQueryBuilder();  | 
                                                        |
| 67 | +        $deleteQuery->delete('filecache') | 
                                                        |
| 68 | +            ->where($deleteQuery->expr()->eq('fileid', $deleteQuery->createParameter('objectid'))); | 
                                                        |
| 69 | 69 | |
| 70 | - $deletedInLastChunk = self::CHUNK_SIZE;  | 
                                                        |
| 71 | -		while ($deletedInLastChunk === self::CHUNK_SIZE) { | 
                                                        |
| 72 | - $deletedInLastChunk = 0;  | 
                                                        |
| 73 | - $result = $query->execute();  | 
                                                        |
| 74 | -			while ($row = $result->fetch()) { | 
                                                        |
| 75 | - $deletedInLastChunk++;  | 
                                                        |
| 76 | -				$deletedEntries += $deleteQuery->setParameter('objectid', (int) $row['fileid']) | 
                                                        |
| 77 | - ->execute();  | 
                                                        |
| 78 | - }  | 
                                                        |
| 79 | - $result->closeCursor();  | 
                                                        |
| 80 | - }  | 
                                                        |
| 70 | + $deletedInLastChunk = self::CHUNK_SIZE;  | 
                                                        |
| 71 | +        while ($deletedInLastChunk === self::CHUNK_SIZE) { | 
                                                        |
| 72 | + $deletedInLastChunk = 0;  | 
                                                        |
| 73 | + $result = $query->execute();  | 
                                                        |
| 74 | +            while ($row = $result->fetch()) { | 
                                                        |
| 75 | + $deletedInLastChunk++;  | 
                                                        |
| 76 | +                $deletedEntries += $deleteQuery->setParameter('objectid', (int) $row['fileid']) | 
                                                        |
| 77 | + ->execute();  | 
                                                        |
| 78 | + }  | 
                                                        |
| 79 | + $result->closeCursor();  | 
                                                        |
| 80 | + }  | 
                                                        |
| 81 | 81 | |
| 82 | -		$output->writeln("$deletedEntries orphaned file cache entries deleted"); | 
                                                        |
| 83 | - }  | 
                                                        |
| 82 | +        $output->writeln("$deletedEntries orphaned file cache entries deleted"); | 
                                                        |
| 83 | + }  | 
                                                        |
| 84 | 84 | |
| 85 | 85 | }  | 
                                                        
@@ -51,7 +51,7 @@  | 
                                                    ||
| 51 | 51 | */  | 
                                                        
| 52 | 52 |  	public function run($argument) { | 
                                                        
| 53 | 53 | $lockingProvider = \OC::$server->getLockingProvider();  | 
                                                        
| 54 | -		if($lockingProvider instanceof DBLockingProvider) { | 
                                                        |
| 54 | +		if ($lockingProvider instanceof DBLockingProvider) { | 
                                                        |
| 55 | 55 | $lockingProvider->cleanExpiredLocks();  | 
                                                        
| 56 | 56 | }  | 
                                                        
| 57 | 57 | }  | 
                                                        
@@ -30,30 +30,30 @@  | 
                                                    ||
| 30 | 30 | */  | 
                                                        
| 31 | 31 |  class CleanupFileLocks extends TimedJob { | 
                                                        
| 32 | 32 | |
| 33 | - /**  | 
                                                        |
| 34 | - * Default interval in minutes  | 
                                                        |
| 35 | - *  | 
                                                        |
| 36 | - * @var int $defaultIntervalMin  | 
                                                        |
| 37 | - **/  | 
                                                        |
| 38 | - protected $defaultIntervalMin = 5;  | 
                                                        |
| 33 | + /**  | 
                                                        |
| 34 | + * Default interval in minutes  | 
                                                        |
| 35 | + *  | 
                                                        |
| 36 | + * @var int $defaultIntervalMin  | 
                                                        |
| 37 | + **/  | 
                                                        |
| 38 | + protected $defaultIntervalMin = 5;  | 
                                                        |
| 39 | 39 | |
| 40 | - /**  | 
                                                        |
| 41 | - * sets the correct interval for this timed job  | 
                                                        |
| 42 | - */  | 
                                                        |
| 43 | -	public function __construct() { | 
                                                        |
| 44 | - $this->interval = $this->defaultIntervalMin * 60;  | 
                                                        |
| 45 | - }  | 
                                                        |
| 40 | + /**  | 
                                                        |
| 41 | + * sets the correct interval for this timed job  | 
                                                        |
| 42 | + */  | 
                                                        |
| 43 | +    public function __construct() { | 
                                                        |
| 44 | + $this->interval = $this->defaultIntervalMin * 60;  | 
                                                        |
| 45 | + }  | 
                                                        |
| 46 | 46 | |
| 47 | - /**  | 
                                                        |
| 48 | - * Makes the background job do its work  | 
                                                        |
| 49 | - *  | 
                                                        |
| 50 | - * @param array $argument unused argument  | 
                                                        |
| 51 | - * @throws \Exception  | 
                                                        |
| 52 | - */  | 
                                                        |
| 53 | -	public function run($argument) { | 
                                                        |
| 54 | - $lockingProvider = \OC::$server->getLockingProvider();  | 
                                                        |
| 55 | -		if($lockingProvider instanceof DBLockingProvider) { | 
                                                        |
| 56 | - $lockingProvider->cleanExpiredLocks();  | 
                                                        |
| 57 | - }  | 
                                                        |
| 58 | - }  | 
                                                        |
| 47 | + /**  | 
                                                        |
| 48 | + * Makes the background job do its work  | 
                                                        |
| 49 | + *  | 
                                                        |
| 50 | + * @param array $argument unused argument  | 
                                                        |
| 51 | + * @throws \Exception  | 
                                                        |
| 52 | + */  | 
                                                        |
| 53 | +    public function run($argument) { | 
                                                        |
| 54 | + $lockingProvider = \OC::$server->getLockingProvider();  | 
                                                        |
| 55 | +        if($lockingProvider instanceof DBLockingProvider) { | 
                                                        |
| 56 | + $lockingProvider->cleanExpiredLocks();  | 
                                                        |
| 57 | + }  | 
                                                        |
| 58 | + }  | 
                                                        |
| 59 | 59 | }  |