$this->initArgv();
$this->initPHPLine();
- $this->initAuth(self::getArgvParser()->sessionID);
+ $this->initAuth();
$this->checkForUpdates();
$this->initCommands();
}
* @inheritDoc
*/
public static function destruct() {
- // Giving a sessionID disables saving of the command history.
- if (!self::getArgvParser()->sessionID) {
+ // Giving WCF_SESSION_ID disables saving of the command history.
+ if (empty($_ENV['WCF_SESSION_ID'])) {
if (self::getReader() !== null && self::getReader()->getHistory() instanceof DatabaseCLICommandHistory) {
/** @var DatabaseCLICommandHistory $history */
$history = self::getReader()->getHistory();
}
}
- if (!self::getArgvParser()->sessionID) {
+ if (empty($_ENV['WCF_SESSION_ID'])) {
self::getSession()->delete();
}
}
'disableUpdateCheck' => WCF::getLanguage()->get('wcf.cli.help.disableUpdateCheck'),
'exitOnFail' => WCF::getLanguage()->get('wcf.cli.help.exitOnFail'),
'packageID=i' => WCF::getLanguage()->get('wcf.cli.help.packageID'),
- 'sessionID=s' => WCF::getLanguage()->get('wcf.cli.help.sessionID'),
]);
self::getArgvParser()->setOptions([
ArgvParser::CONFIG_CUMULATIVE_FLAGS => true,
/**
* Does the user authentification.
*/
- protected function initAuth($sessionID = null) {
- if ($sessionID !== null) {
+ protected function initAuth() {
+ if (!empty($_ENV['WCF_SESSION_ID'])) {
self::getSession()->delete();
- self::getSession()->load(SessionEditor::class, $sessionID);
+ self::getSession()->load(SessionEditor::class, $_ENV['WCF_SESSION_ID']);
if (!self::getUser()->userID) {
self::getReader()->println('Invalid sessionID');
exit(1);
// Invoke the worker processes with the same command line ...
$arguments = $_SERVER['argv'];
- // ... with the quiet argument ...
+ // ... with the quiet argument.
$arguments[] = '-qqqqq';
- // ... reusing the current session.
- $arguments[] = '--sessionID='.CLIWCF::getSession()->sessionID;
$commandLine = PHP_BINARY.' '.implode(' ', array_map('escapeshellarg', $arguments));
Log::debug('Using "'.$commandLine.'" as the worker command line.');
// Reuse the environment.
// - Specify TERM=dumb to prevent the worker from messing around with our terminal.
// - Specify WORKER_STATUS_FD to prevent the administrator from manually giving a threadId,
- // causing the worker to write into an arbitrary file descriptor (most likely the DB connectio.).
+ // causing the worker to write into an arbitrary file descriptor (most likely the DB connection).
+ // - Specify WCF_SESSION_ID to perform the login.
$env = array_merge($_ENV, [
'TERM' => 'dumb',
'WORKER_STATUS_FD' => 3,
+ 'WCF_SESSION_ID' => CLIWCF::getSession()->sessionID,
]);
// 1) Spawn the processes.
- Befehle, welche ihre Aktion nicht erfolgreich ausführen konnten
- Systemfehler]]></item>
<item name="wcf.cli.help.packageID"><![CDATA[Die App mit der angegebenen Paket-ID wird als Standard für diese Sitzung verwendet.]]></item>
- <item name="wcf.cli.help.sessionID"><![CDATA[Verwendet die Sitzung mit der angegebenen Session-ID, anstatt einen separaten Login durchzuführen. Dieser Parameter wird intern zur Parallelisierung von Aufgaben genutzt.]]></item>
<item name="wcf.cli.worker.setParameter"><![CDATA[Übergibt einen Parameter an den Worker. Bsp.: --setParameter param=wert]]></item>
<item name="wcf.cli.worker.list"><![CDATA[Listet alle Worker auf.]]></item>
<item name="wcf.cli.worker.threads"><![CDATA[Gewünschte Anzahl von parallelen Prozessen.]]></item>
- Failing commands
- Core errors]]></item>
<item name="wcf.cli.help.packageID"><![CDATA[The given package id will be used as a default for this session.]]></item>
- <item name="wcf.cli.help.sessionID"><![CDATA[Uses the session with the given session id instead of performing a login. This parameter is used internally for parallel processing of jobs.]]></item>
<item name="wcf.cli.worker.setParameter"><![CDATA[Sets a worker parameter e.g.: --setParameter param=value]]></item>
<item name="wcf.cli.worker.list"><![CDATA[Lists all workers.]]></item>
<item name="wcf.cli.worker.threads"><![CDATA[Requested number of parallel processes.]]></item>