Whippet::get_options PHP Method

get_options() public method

Eventually it would be nice to be able to start a development version of wordpress using sqlite (with minimal setup) and just a wp-content folder, with the core being loaded from /usr/share (or similar)
public get_options ( ) : Array
return Array An array of options (probably)
    public function get_options()
    {
        //
        // Sort out options.
        // Because a routing script can't read command arguments, we need to read
        // this from stdin (on the first request) or from the temporary settings
        // file (on subsequent requests)
        //
        if (file_exists(sys_get_temp_dir() . "/.whippet-arguments")) {
            $options = file_get_contents(sys_get_temp_dir() . "/.whippet-arguments");
        } else {
            $read = array(fopen('php://stdin', 'r'));
            $write = null;
            $except = null;
            $options = '';
            if (stream_select($read, $write, $except, 0) > 0) {
                $options = stream_get_contents($read[0]);
                fclose($read[0]);
            }
            if (file_put_contents(sys_get_temp_dir() . "/.whippet-arguments", $options) === false) {
                $this->message(Colours::fg('bold_red') . "Error: " . Colours::off() . "Unable to write options file. This is a serious error. You should probably give up and report a bug.");
            }
        }
        if (!$options) {
            $this->message(Colours::fg('bold_red') . "Error: " . Colours::off() . "Unable to locate options on stdin or on the disk. This is a serious error. You should probably give up and report a bug.");
        }
        // There's no need to validate here because the bootstrap script has done that.
        return unserialize($options);
    }