Completed
Pull Request — master (#6331)
by Björn
24:45
created
lib/private/Repair/NC12/RepairIdentityProofKeyFolders.php 2 patches
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -32,79 +32,79 @@
 block discarded – undo
32 32
 
33 33
 class RepairIdentityProofKeyFolders implements IRepairStep {
34 34
 
35
-	/** @var IConfig */
36
-	private $config;
35
+    /** @var IConfig */
36
+    private $config;
37 37
 
38
-	/** @var \OC\Files\AppData\AppData */
39
-	private $appDataIdentityProof;
38
+    /** @var \OC\Files\AppData\AppData */
39
+    private $appDataIdentityProof;
40 40
 
41
-	/** @var IRootFolder */
42
-	private $rootFolder;
41
+    /** @var IRootFolder */
42
+    private $rootFolder;
43 43
 
44
-	/** @var string */
45
-	private $identityProofDir;
44
+    /** @var string */
45
+    private $identityProofDir;
46 46
 
47
-	/**
48
-	 * RepairIdentityProofKeyFolders constructor.
49
-	 *
50
-	 * @param IConfig $config
51
-	 * @param Factory $appDataFactory
52
-	 * @param IRootFolder $rootFolder
53
-	 */
54
-	public function __construct(IConfig $config, Factory $appDataFactory, IRootFolder $rootFolder) {
55
-		$this->config = $config;
56
-		$this->appDataIdentityProof = $appDataFactory->get('identityproof');
57
-		$this->rootFolder = $rootFolder;
47
+    /**
48
+     * RepairIdentityProofKeyFolders constructor.
49
+     *
50
+     * @param IConfig $config
51
+     * @param Factory $appDataFactory
52
+     * @param IRootFolder $rootFolder
53
+     */
54
+    public function __construct(IConfig $config, Factory $appDataFactory, IRootFolder $rootFolder) {
55
+        $this->config = $config;
56
+        $this->appDataIdentityProof = $appDataFactory->get('identityproof');
57
+        $this->rootFolder = $rootFolder;
58 58
 
59
-		$instanceId = $this->config->getSystemValue('instanceid', null);
60
-		if ($instanceId === null) {
61
-			throw new \RuntimeException('no instance id!');
62
-		}
63
-		$this->identityProofDir = 'appdata_' . $instanceId . '/identityproof/';
64
-	}
59
+        $instanceId = $this->config->getSystemValue('instanceid', null);
60
+        if ($instanceId === null) {
61
+            throw new \RuntimeException('no instance id!');
62
+        }
63
+        $this->identityProofDir = 'appdata_' . $instanceId . '/identityproof/';
64
+    }
65 65
 
66
-	/**
67
-	 * Returns the step's name
68
-	 *
69
-	 * @return string
70
-	 * @since 9.1.0
71
-	 */
72
-	public function getName() {
73
-		return "Rename folder with user specific keys";
74
-	}
66
+    /**
67
+     * Returns the step's name
68
+     *
69
+     * @return string
70
+     * @since 9.1.0
71
+     */
72
+    public function getName() {
73
+        return "Rename folder with user specific keys";
74
+    }
75 75
 
76
-	/**
77
-	 * Run repair step.
78
-	 * Must throw exception on error.
79
-	 *
80
-	 * @param IOutput $output
81
-	 * @throws \Exception in case of failure
82
-	 * @since 9.1.0
83
-	 */
84
-	public function run(IOutput $output) {
85
-		$versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0');
86
-		if (version_compare($versionFromBeforeUpdate, '12.0.1.5', '<=')) {
87
-			$count = $this->repair();
88
-			$output->info('Repaired ' . $count . ' folders');
89
-		}
90
-	}
76
+    /**
77
+     * Run repair step.
78
+     * Must throw exception on error.
79
+     *
80
+     * @param IOutput $output
81
+     * @throws \Exception in case of failure
82
+     * @since 9.1.0
83
+     */
84
+    public function run(IOutput $output) {
85
+        $versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0');
86
+        if (version_compare($versionFromBeforeUpdate, '12.0.1.5', '<=')) {
87
+            $count = $this->repair();
88
+            $output->info('Repaired ' . $count . ' folders');
89
+        }
90
+    }
91 91
 
92
-	/**
93
-	 * rename all dirs with user specific keys to 'user-uid'
94
-	 *
95
-	 * @return int
96
-	 */
97
-	private function repair() {
98
-		$count = 0;
99
-		$dirListing = $this->appDataIdentityProof->getDirectoryListing();
100
-		/** @var ISimpleFolder $folder */
101
-		foreach ($dirListing as $folder) {
102
-			$name = $folder->getName();
103
-			$node = $this->rootFolder->get($this->identityProofDir . $name);
104
-			$node->move($this->identityProofDir . 'user-' . $name);
105
-			$count++;
106
-		}
92
+    /**
93
+     * rename all dirs with user specific keys to 'user-uid'
94
+     *
95
+     * @return int
96
+     */
97
+    private function repair() {
98
+        $count = 0;
99
+        $dirListing = $this->appDataIdentityProof->getDirectoryListing();
100
+        /** @var ISimpleFolder $folder */
101
+        foreach ($dirListing as $folder) {
102
+            $name = $folder->getName();
103
+            $node = $this->rootFolder->get($this->identityProofDir . $name);
104
+            $node->move($this->identityProofDir . 'user-' . $name);
105
+            $count++;
106
+        }
107 107
 
108
-		return $count;
109
-	}
108
+        return $count;
109
+    }
110 110
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 		if ($instanceId === null) {
61 61
 			throw new \RuntimeException('no instance id!');
62 62
 		}
63
-		$this->identityProofDir = 'appdata_' . $instanceId . '/identityproof/';
63
+		$this->identityProofDir = 'appdata_'.$instanceId.'/identityproof/';
64 64
 	}
65 65
 
66 66
 	/**
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 		$versionFromBeforeUpdate = $this->config->getSystemValue('version', '0.0.0');
86 86
 		if (version_compare($versionFromBeforeUpdate, '12.0.1.5', '<=')) {
87 87
 			$count = $this->repair();
88
-			$output->info('Repaired ' . $count . ' folders');
88
+			$output->info('Repaired '.$count.' folders');
89 89
 		}
90 90
 	}
91 91
 
@@ -100,8 +100,8 @@  discard block
 block discarded – undo
100 100
 		/** @var ISimpleFolder $folder */
101 101
 		foreach ($dirListing as $folder) {
102 102
 			$name = $folder->getName();
103
-			$node = $this->rootFolder->get($this->identityProofDir . $name);
104
-			$node->move($this->identityProofDir . 'user-' . $name);
103
+			$node = $this->rootFolder->get($this->identityProofDir.$name);
104
+			$node->move($this->identityProofDir.'user-'.$name);
105 105
 			$count++;
106 106
 		}
107 107
 
Please login to merge, or discard this patch.