Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit c2a303e

Browse files
committed
Adding setup:hash-salt command.
1 parent 9ea258c commit c2a303e

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

src/Robo/Commands/Drupal/DrupalCommand.php

-20
Original file line numberDiff line numberDiff line change
@@ -41,24 +41,4 @@ public function install() {
4141
return $status_code;
4242
}
4343

44-
/**
45-
* Writes a hash salt to ${repo.root}/salt.txt if one does not exist.
46-
*
47-
* @return int
48-
* A CLI exit code.
49-
*/
50-
protected function hashSalt() {
51-
$hash_salt_file = $this->getConfigValue('repo.root') . '/salt.txt';
52-
if (!file_exists($hash_salt_file)) {
53-
$this->say("Writing hash salt to $hash_salt_file");
54-
$status_code = $this->taskWriteToFile($hash_salt_file)
55-
->line(RandomString::string(55))
56-
->run();
57-
58-
return $status_code;
59-
}
60-
61-
return 0;
62-
}
63-
6444
}

src/Robo/Commands/Setup/SettingsCommand.php

+22
Original file line numberDiff line numberDiff line change
@@ -133,4 +133,26 @@ protected function installGitHook($hook) {
133133
}
134134
}
135135

136+
/**
137+
* Writes a hash salt to ${repo.root}/salt.txt if one does not exist.
138+
*
139+
* @command setup:hash-salt
140+
*
141+
* @return int
142+
* A CLI exit code.
143+
*/
144+
public function hashSalt() {
145+
$hash_salt_file = $this->getConfigValue('repo.root') . '/salt.txt';
146+
if (!file_exists($hash_salt_file)) {
147+
$this->say("Writing hash salt to $hash_salt_file");
148+
$result = $this->taskWriteToFile($hash_salt_file)
149+
->line(RandomString::string(55))
150+
->run();
151+
152+
return $result->wasSuccessful();
153+
}
154+
155+
return TRUE;
156+
}
157+
136158
}

0 commit comments

Comments
 (0)