nextcloud /
server
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * @copyright Copyright (c) 2016, ownCloud, Inc. |
||
| 4 | * |
||
| 5 | * @author Joas Schilling <[email protected]> |
||
| 6 | * @author Morris Jobke <[email protected]> |
||
| 7 | * @author Robin Appelman <[email protected]> |
||
| 8 | * |
||
| 9 | * @license AGPL-3.0 |
||
| 10 | * |
||
| 11 | * This code is free software: you can redistribute it and/or modify |
||
| 12 | * it under the terms of the GNU Affero General Public License, version 3, |
||
| 13 | * as published by the Free Software Foundation. |
||
| 14 | * |
||
| 15 | * This program is distributed in the hope that it will be useful, |
||
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
| 18 | * GNU Affero General Public License for more details. |
||
| 19 | * |
||
| 20 | * You should have received a copy of the GNU Affero General Public License, version 3, |
||
| 21 | * along with this program. If not, see <http://www.gnu.org/licenses/> |
||
| 22 | * |
||
| 23 | */ |
||
| 24 | |||
| 25 | namespace OCA\Files_Versions\Command; |
||
| 26 | |||
| 27 | use OC\Command\FileAccess; |
||
| 28 | use OCA\Files_Versions\Storage; |
||
| 29 | use OCP\Command\ICommand; |
||
| 30 | |||
| 31 | View Code Duplication | class Expire implements ICommand { |
|
| 32 | use FileAccess; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @var string |
||
| 36 | */ |
||
| 37 | private $fileName; |
||
| 38 | |||
| 39 | /** |
||
| 40 | * @var string |
||
| 41 | */ |
||
| 42 | private $user; |
||
| 43 | |||
| 44 | /** |
||
| 45 | * @param string $user |
||
| 46 | * @param string $fileName |
||
| 47 | */ |
||
| 48 | function __construct($user, $fileName) { |
||
|
0 ignored issues
–
show
|
|||
| 49 | $this->user = $user; |
||
| 50 | $this->fileName = $fileName; |
||
| 51 | } |
||
| 52 | |||
| 53 | |||
| 54 | public function handle() { |
||
| 55 | $userManager = \OC::$server->getUserManager(); |
||
| 56 | if (!$userManager->userExists($this->user)) { |
||
| 57 | // User has been deleted already |
||
| 58 | return; |
||
| 59 | } |
||
| 60 | |||
| 61 | \OC_Util::setupFS($this->user); |
||
| 62 | Storage::expire($this->fileName); |
||
| 63 | \OC_Util::tearDownFS(); |
||
| 64 | } |
||
| 65 | } |
||
| 66 |
Adding explicit visibility (
private,protected, orpublic) is generally recommend to communicate to other developers how, and from where this method is intended to be used.