Completed
Pull Request — stable10 (#78)
by Joas
03:05
created
lib/DatabaseStatistics.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -73,7 +73,7 @@  discard block
 block discarded – undo
73 73
 		$row = $result->fetch();
74 74
 		$result->closeCursor();
75 75
 		if ($row) {
76
-			return $this->cleanVersion($row['version']);
76
+			return $this->cleanVersion($row[ 'version' ]);
77 77
 		}
78 78
 		return 'N/A';
79 79
 	}
@@ -93,12 +93,12 @@  discard block
 block discarded – undo
93 93
 		switch ($this->config->getSystemValue('dbtype')) {
94 94
 			case 'mysql':
95 95
 				$db_name = $this->config->getSystemValue('dbname');
96
-				$sql = 'SHOW TABLE STATUS FROM `' . $db_name . '`';
96
+				$sql = 'SHOW TABLE STATUS FROM `'.$db_name.'`';
97 97
 				$result = $this->connection->executeQuery($sql);
98 98
 				$database_size = 0;
99 99
 				while ($row = $result->fetch()) {
100
-					if ((isset($row['Type']) && $row['Type'] !== 'MRG_MyISAM') || (isset($row['Engine']) && ($row['Engine'] == 'MyISAM' || $row['Engine'] == 'InnoDB'))) {
101
-						$database_size += $row['Data_length'] + $row['Index_length'];
100
+					if ((isset($row[ 'Type' ]) && $row[ 'Type' ] !== 'MRG_MyISAM') || (isset($row[ 'Engine' ]) && ($row[ 'Engine' ] == 'MyISAM' || $row[ 'Engine' ] == 'InnoDB'))) {
101
+						$database_size += $row[ 'Data_length' ] + $row[ 'Index_length' ];
102 102
 					}
103 103
 				}
104 104
 				$result->closeCursor();
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
 					$database_size = filesize($this->config->getSystemValue('dbhost'));
110 110
 				} else {
111 111
 					$params = $this->connection->getParams();
112
-					if (file_exists($params['path'])) {
113
-						$database_size = filesize($params['path']);
112
+					if (file_exists($params[ 'path' ])) {
113
+						$database_size = filesize($params[ 'path' ]);
114 114
 					}
115 115
 				}
116 116
 				break;
@@ -121,11 +121,11 @@  discard block
 block discarded – undo
121 121
 				$result = $this->connection->executeQuery($sql);
122 122
 				$row = $result->fetch();
123 123
 				$result->closeCursor();
124
-				if ($row['proname'] == 'pg_database_size') {
124
+				if ($row[ 'proname' ] == 'pg_database_size') {
125 125
 					$database = $this->config->getSystemValue('dbname');
126 126
 					if (strpos($database, '.') !== false)
127 127
 					{
128
-						list($database, ) = explode('.', $database);
128
+						list($database,) = explode('.', $database);
129 129
 					}
130 130
 					$sql = "SELECT oid
131 131
 						FROM pg_database
@@ -133,19 +133,19 @@  discard block
 block discarded – undo
133 133
 					$result = $this->connection->executeQuery($sql);
134 134
 					$row = $result->fetch();
135 135
 					$result->closeCursor();
136
-					$oid = $row['oid'];
137
-					$sql = 'SELECT pg_database_size(' . $oid . ') as size';
136
+					$oid = $row[ 'oid' ];
137
+					$sql = 'SELECT pg_database_size('.$oid.') as size';
138 138
 					$result = $this->connection->executeQuery($sql);
139 139
 					$row = $result->fetch();
140 140
 					$result->closeCursor();
141
-					$database_size = $row['size'];
141
+					$database_size = $row[ 'size' ];
142 142
 				}
143 143
 				break;
144 144
 			case 'oci':
145 145
 				$sql = 'SELECT SUM(bytes) as dbsize
146 146
 					FROM user_segments';
147 147
 				$result = $this->connection->executeQuery($sql);
148
-				$database_size = ($row = $result->fetch()) ? $row['dbsize'] : false;
148
+				$database_size = ($row = $result->fetch()) ? $row[ 'dbsize' ] : false;
149 149
 				$result->closeCursor();
150 150
 				break;
151 151
 		}
@@ -159,10 +159,10 @@  discard block
 block discarded – undo
159 159
 	 * @return string `5.6.27`
160 160
 	 */
161 161
 	protected function cleanVersion($version) {
162
-		$matches = [];
162
+		$matches = [ ];
163 163
 		preg_match('/^(\d+)(\.\d+)(\.\d+)/', $version, $matches);
164
-		if (isset($matches[0])) {
165
-			return $matches[0];
164
+		if (isset($matches[ 0 ])) {
165
+			return $matches[ 0 ];
166 166
 		}
167 167
 		return $version;
168 168
 	}
Please login to merge, or discard this patch.