Code Duplication    Length = 12-12 lines in 4 locations

apps/files_trashbin/lib/backgroundjob/expiretrash.php 1 location

@@ 95-106 (lines=12) @@
92
	 * @param string $user
93
	 * @return boolean
94
	 */
95
	protected function setupFS($user) {
96
		\OC_Util::tearDownFS();
97
		\OC_Util::setupFS($user);
98
99
		// Check if this user has a trashbin directory
100
		$view = new \OC\Files\View('/' . $user);
101
		if (!$view->is_dir('/files_trashbin/files')) {
102
			return false;
103
		}
104
105
		return true;
106
	}
107
108
	/**
109
	 * The callback is executed for each user on each backend.

apps/files_versions/lib/backgroundjob/expireversions.php 1 location

@@ 82-93 (lines=12) @@
79
	 * @param string $user
80
	 * @return boolean
81
	 */
82
	protected function setupFS($user) {
83
		\OC_Util::tearDownFS();
84
		\OC_Util::setupFS($user);
85
86
		// Check if this user has a versions directory
87
		$view = new \OC\Files\View('/' . $user);
88
		if (!$view->is_dir('/files_versions')) {
89
			return false;
90
		}
91
92
		return true;
93
	}
94
95
	/**
96
	 * The callback is executed for each user on each backend.

apps/files_trashbin/command/expiretrash.php 1 location

@@ 115-126 (lines=12) @@
112
	 * @param string $user
113
	 * @return boolean
114
	 */
115
	protected function setupFS($user) {
116
		\OC_Util::tearDownFS();
117
		\OC_Util::setupFS($user);
118
119
		// Check if this user has a trashbin directory
120
		$view = new \OC\Files\View('/' . $user);
121
		if (!$view->is_dir('/files_trashbin/files')) {
122
			return false;
123
		}
124
125
		return true;
126
	}
127
128
	private function callForAllUsers(\Closure $callback, $search = '') {
129
		foreach($this->userManager->getBackends() as $backend) {

apps/files_versions/command/expireversions.php 1 location

@@ 113-124 (lines=12) @@
110
	 * @param string $user
111
	 * @return boolean
112
	 */
113
	protected function setupFS($user) {
114
		\OC_Util::tearDownFS();
115
		\OC_Util::setupFS($user);
116
117
		// Check if this user has a version directory
118
		$view = new \OC\Files\View('/' . $user);
119
		if (!$view->is_dir('/files_versions')) {
120
			return false;
121
		}
122
123
		return true;
124
	}
125
126
	private function callForAllUsers(\Closure $callback, $search = '') {
127
		foreach($this->userManager->getBackends() as $backend) {