-
Notifications
You must be signed in to change notification settings - Fork 4
Send output of maintenance/update.php to stdout #348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
e6f09cc
393d4f3
f775a01
7561d6b
a6dbae1
895ba21
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,9 +16,38 @@ public function execute() { | |
| @ini_set( 'memory_limit', '-1' ); // also try to disable the memory limit? Is this even a good idea? | ||
|
|
||
| // Run update.php | ||
| $domain = $GLOBALS[WBSTACK_INFO_GLOBAL]->requestDomain; | ||
| $mwPath = realpath( __DIR__ . '/../../../' ); | ||
| $cmd = 'WBS_DOMAIN=' . $GLOBALS[WBSTACK_INFO_GLOBAL]->requestDomain . ' php ' . $mwPath . '/maintenance/update.php --quick'; | ||
| exec($cmd, $out, $return); | ||
| $cmd = 'WBS_DOMAIN=' . $domain . ' php ' . $mwPath . '/maintenance/update.php --quick 2>&1'; | ||
|
|
||
| $stdout = fopen( 'php://stdout', 'w' ); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is opened, but never closed. I suggest adding |
||
|
|
||
| fwrite( $stdout, "DOMAIN: " . $domain . "\n" ); | ||
|
|
||
| $spec = [ [ 'pipe', 'r' ], [ 'pipe', 'w' ],[ 'pipe', 'w' ] ]; | ||
| $proc = proc_open( $cmd, $spec, $pipes ); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nitpicking: Should we check if |
||
|
|
||
| $stdinProc = $pipes[0]; | ||
| $stdoutProc = $pipes[1]; | ||
| $stderrProc = $pipes[2]; | ||
|
|
||
| $out = []; | ||
|
|
||
| $pid = ( proc_get_status( $proc ) )[ 'pid' ]; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same here, if |
||
| fwrite( $stdout, "PID: " . $pid . "\n" ); | ||
|
|
||
| while( $line = fgets( $stdoutProc ) ) { | ||
| $line = rtrim( $line ); | ||
| fwrite( $stdout, $line . PHP_EOL ); | ||
| array_push( $out, $line ); | ||
| } | ||
|
|
||
| fclose( $stdinProc ); | ||
| fclose( $stdoutProc ); | ||
| fclose( $stderrProc ); | ||
|
|
||
| $return = ( proc_get_status( $proc ) )[ 'exitcode' ]; | ||
| proc_close( $proc ); | ||
|
|
||
| // Return appropriate result | ||
| $res = [ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
using
@to suppress errors might hide important diagnostic errors. Can we try something like this: