예제 #1
0
function miau_test($options)
{
    echo common::colorOutput('These are the options given to function miau_test()', 'Cyan');
    echo PHP_EOL;
    // Print the arguments
    print_r($options);
    // echo a string with a newline
    echo common::echoMessage('Draw a cat!');
    // echo a colored string. You will need to add newlines
    echo common::colorOutput('Miau', 'y') . PHP_EOL;
    // Read a line from the user
    $str = common::readSingleline('What does a cat say? (Enter input) ');
    // Echo a formatted status
    echo common::echoStatus('OK', 'y', $str);
    // confirm with a yes or a no
    $res = common::readlineConfirm('Please confirm that you are sure ' . $str);
    // readlineConfirm return 1 on 'y' and 0 on 'n'
    if (!$res) {
        echo common::colorOutput('Ok - you made a mistake!', 'r') . PHP_EOL;
    } else {
        echo common::colorOutput('OK. You are sure. ', 'b') . PHP_EOL;
    }
}
예제 #2
0
function cos_upgrade($options)
{
    moduleloader::includeModule('system');
    $p = new profile();
    if (git::isMaster()) {
        common::abort('Can not make upgrade from master branch');
    }
    $repo = conf::getModuleIni('system_repo');
    $remote = git::getTagsRemoteLatest($repo);
    if ($p->upgradePossible()) {
        common::echoMessage("Latest version/tag: {$remote}", 'y');
        $continue = common::readlineConfirm('Continue the upgrade');
        if ($continue) {
            cos_upgrade_to($remote);
        }
    } else {
        $locale = git::getTagsInstallLatest();
        common::echoMessage("Latest version/tag: {$locale}", 'y');
        $continue = common::readlineConfirm('Continue. Maybe your upgrade was interrupted. ');
        if ($continue) {
            cos_upgrade_to($remote);
        }
    }
}
예제 #3
0
function cos_git_no_questions()
{
    common::readlineConfirm(null, 1);
}
예제 #4
0
/**
 * function for forcing confirm_readline to automagically answer 'Y' to all
 * questions raised by scripts
 */
function force_confirm_readline()
{
    common::readlineConfirm(null, 1);
}