properly stop output buffering

While setting up itself, the Maintenance class attempt flush and end the
output buffering mecanism. It was done using a call to ob_end_flush()
which has two culprit:
- it throws an E_NOTICE whenever output buffering is already disabled
- does not flush all buffers

By querying ob_get_level() we can find out whether output buffering has
been enabled and can thus stop using the '@' operator.

Test plan:

 $ php -a
 # Output buffering nested level
 php > print ob_get_level();
 0
 # Start buffering
 php > ob_start();
 # Check nesting level (nothing shown since we buffer output)
 php > print ob_get_level();
 # Actually show buffer content
 php > ob_flush();
 1
 # Flush / end, no notice since we were buffering:
 php > ob_end_flush();
 # Second attempt will throw a notice
 php > ob_end_flush();

 Notice: ob_end_flush(): failed to delete and flush buffer. No buffer to
delete or flush in php shell code on line 1

 Call Stack:
   162.3024     643656   1. {main}() php shell code:0
   162.3025     643736   2. ob_end_flush() php shell code:1

 php >

The while( ob_get_level() > 0) solves it nicely (IMO).

Change-Id: I1490cced5c17fc537ef9e6e1304a492deec3a6a9
Merge "properly stop output buffering"