|
@@ -42,9 +42,9 @@ discard block |
|
|
block discarded – undo |
|
42
|
42
|
{ |
|
43
|
43
|
$basePath = Yii::getAlias($this->configPath); |
|
44
|
44
|
FileHelper::createDirectory($basePath); |
|
45
|
|
- $this->authItemConfig = $basePath . DIRECTORY_SEPARATOR . $this->authItemConfig; |
|
46
|
|
- $this->authItemChildConfig = $basePath . DIRECTORY_SEPARATOR . $this->authItemChildConfig; |
|
47
|
|
- $this->authRuleConfig = $basePath . DIRECTORY_SEPARATOR . $this->authRuleConfig; |
|
|
45
|
+ $this->authItemConfig = $basePath.DIRECTORY_SEPARATOR.$this->authItemConfig; |
|
|
46
|
+ $this->authItemChildConfig = $basePath.DIRECTORY_SEPARATOR.$this->authItemChildConfig; |
|
|
47
|
+ $this->authRuleConfig = $basePath.DIRECTORY_SEPARATOR.$this->authRuleConfig; |
|
48
|
48
|
} |
|
49
|
49
|
|
|
50
|
50
|
/** |
|
@@ -74,9 +74,9 @@ discard block |
|
|
block discarded – undo |
|
74
|
74
|
$out .= " [\n"; |
|
75
|
75
|
foreach (array_values($item) as $value) { |
|
76
|
76
|
if (is_string($value)) { |
|
77
|
|
- $value = '\'' . str_replace('\'', '\\\'', str_replace('\\', '\\\\', $value)) . '\''; |
|
|
77
|
+ $value = '\''.str_replace('\'', '\\\'', str_replace('\\', '\\\\', $value)).'\''; |
|
78
|
78
|
} elseif (is_int($value) || is_float($value)) { |
|
79
|
|
- $value = (string)$value; |
|
|
79
|
+ $value = (string) $value; |
|
80
|
80
|
} elseif (is_bool($value)) { |
|
81
|
81
|
$value = $value ? 'true' : 'false'; |
|
82
|
82
|
} elseif (is_null($value)) { |
|
@@ -172,7 +172,7 @@ discard block |
|
|
block discarded – undo |
|
172
|
172
|
$assignmentTable = Yii::$app->authManager->assignmentTable; |
|
173
|
173
|
$time = microtime(true); |
|
174
|
174
|
Yii::$app->db->createCommand("DELETE FROM {$assignmentTable} WHERE user_id NOT IN (SELECT id FROM {$userTable})")->execute(); |
|
175
|
|
- echo "Command finished (time: " . sprintf('%.3f', microtime(true) - $time) . "s)\n"; |
|
|
175
|
+ echo "Command finished (time: ".sprintf('%.3f', microtime(true) - $time)."s)\n"; |
|
176
|
176
|
} |
|
177
|
177
|
|
|
178
|
178
|
/** |
|
@@ -186,7 +186,7 @@ discard block |
|
|
block discarded – undo |
|
186
|
186
|
if (!Yii::$app->db->createCommand("SELECT COUNT(*) FROM \"{$assignmentTable}\" WHERE \"item_name\"='admin' AND \"user_id\"=1")->queryScalar()) { |
|
187
|
187
|
Yii::$app->db->createCommand("INSERT INTO \"{$assignmentTable}\" (\"item_name\", \"user_id\") VALUES ('admin', '1');")->execute(); |
|
188
|
188
|
} |
|
189
|
|
- Yii::$app->db->createCommand('DELETE FROM ' . $assignmentTable . ' WHERE item_name IN (SELECT item_name FROM ' . $assignmentTable . ' aa LEFT JOIN ' . $authItemTable . ' ai ON aa.item_name = ai.name WHERE ai.name IS NULL)')->execute(); |
|
|
189
|
+ Yii::$app->db->createCommand('DELETE FROM '.$assignmentTable.' WHERE item_name IN (SELECT item_name FROM '.$assignmentTable.' aa LEFT JOIN '.$authItemTable.' ai ON aa.item_name = ai.name WHERE ai.name IS NULL)')->execute(); |
|
190
|
190
|
} else { |
|
191
|
191
|
Yii::$app->db->createCommand("INSERT IGNORE INTO {$assignmentTable} (`item_name`, `user_id`) VALUES ('admin', '1');")->execute(); |
|
192
|
192
|
Yii::$app->db->createCommand("DELETE aa FROM {$assignmentTable} aa LEFT JOIN {$authItemTable} ai ON(aa.item_name = ai.name) WHERE ai.name IS NULL;")->execute(); |