Whippet::message PHP Method

message() public static method

Note: if the first character of the string is a newline, that newline will be emitted before the time. Note: this method appends a newline to the string.
public static message ( $string )
    public static function message($string)
    {
        global $whippet;
        if (isset($whippet->options['q'])) {
            return;
        }
        if ($string[0] == "\n") {
            $string = substr($string, 1);
            file_put_contents("php://stdout", "\n");
        }
        file_put_contents("php://stdout", Colours::fg('dark_grey') . "[" . date("Y-m-d H:i:s") . "]" . Colours::off() . " {$string}" . Colours::off() . "\n");
    }

Usage Example

Ejemplo n.º 1
0
function signal_handler($signal)
{
    global $options;
    // Delete the settings file
    if (file_exists(sys_get_temp_dir() . "/.whippet-arguments")) {
        unlink(sys_get_temp_dir() . "/.whippet-arguments");
    }
    // Delete the output buffer
    if (file_exists(sys_get_temp_dir() . "/.whippet-output")) {
        unlink(sys_get_temp_dir() . "/.whippet-output");
    }
    // Delete the callback cache
    if (file_exists($options['cb-cache'])) {
        unlink($options['cb-cache']);
    }
    // Restore original wp-config
    if (WPS_LOCATION == 'root') {
        if (file_exists(dirname($options['wp-config']) . "/wp-config-original.whippet.bak")) {
            file_put_contents($options['wp-config'], file_get_contents(dirname($options['wp-config']) . "/wp-config-original.whippet.bak"));
            unlink(dirname($options['wp-config']) . "/wp-config-original.whippet.bak");
        } else {
            if (WPS_LOCATION == 'root') {
                Whippet::message(Colours::fg('red') . "Error: " . Colours::fg('white') . "Unable to find wp-config backup file; could not restore original configuration", "Your wp-config file should have been backed up at " . dirname($options['wp-config']) . "/wp-config-original.whippet.bak, but\n" . "it is missing or unreadable. You should edit your wp-config.php by hand to remove the\n" . "Whippet sections.\n");
            }
        }
    } else {
        if (WPS_LOCATION == 'wp-content') {
            unlink("{$options['wp-root']}/wp-config.php");
        }
    }
    echo "\nQuitting.\n";
    exit(0);
}
All Usage Examples Of Whippet::message