コード例 #1
0
function cos_upgrade_to($version)
{
    common::echoMessage("Will now pull source, and checkout latest tag", 'y');
    $command = "git fetch --tags && git checkout master && git pull && git checkout {$version}";
    $ret = common::execCommand($command);
    if ($ret) {
        common::abort('Aborting upgrade');
    }
    common::echoMessage("Will upgrade vendor with composer according to version", 'y');
    $command = "composer update";
    $ret = common::systemCommand($command);
    if ($ret) {
        common::abort('Composer update failed.');
    }
    common::echoMessage("Will upgrade all modules and templates the versions in the profile", 'y');
    // Upgrade all modules and templates
    $profile = conf::getModuleIni('system_profile');
    if (!$profile) {
        $profile = 'default';
    }
    upgrade_from_profile(array('clone_only' => 1, 'profile' => $profile));
    // reload any changes
    common::echoMessage("Reloading all configuration files", 'y');
    $p = new profile();
    $p->reloadProfile($profile);
    common::echoMessage("Load modules changes into database", 'y');
    cos_config_reload();
}
コード例 #2
0
ファイル: doc.php プロジェクト: gpawlik/suited-php-classes
/**
 * wrapper function for creating documention with phpdoc
 * hi! I'am created with this function :)
 *
 * @return int  value from cos_system command
 */
function create_docs()
{
    // check if command exists
    $command = "whereis phpdoc";
    $ret = common::execCommand($command);
    if ($ret) {
        common::echoMessage("Could not find command phpdoc on your system");
        common::echoMessage("If the command phpdoc is not on your system we will not be able to create documentation.");
        common::echoMessage("One way to do this is to: pear install PhpDocumentor");
        exit(127);
    }
    $command = "phpdoc run ";
    $command .= "-d coslib ";
    $command .= "--template abstract -t " . conf::pathBase() . "/htdocs/phpdocs ";
    common::systemCommand($command);
}
コード例 #3
0
ファイル: sqlite.php プロジェクト: gpawlik/suited-php-classes
function db_to_sqlite($options = array())
{
    $check = "which sequel";
    if (common::execCommand($check)) {
        common::echoMessage('You need sequel. Install it like this, e.g.:');
        common::echoMessage('sudo aptitude install ruby-sequel libsqlite3-ruby libmysql-ruby');
        common::abort();
    } else {
        common::echoStatus('OK', 'g', 'Sequel is installed');
    }
    $ok = false;
    $info = admin::getDbInfo();
    if (!$info) {
        return db_no_url();
    }
    if ($info['scheme'] == 'mysql') {
        $ok = true;
    }
    if ($info['scheme'] == 'mysqli') {
        $ok = true;
    }
    if (!$ok) {
        common::echoStatus('ERROR', 'r', 'Driver needs to be mysql or mysqli');
    }
    $fs = new Filesystem();
    $fs->remove('sqlite/database.sql');
    $username = conf::getMainIni('username');
    $password = conf::getMainIni('password');
    $command = "sequel ";
    $command .= "{$info['scheme']}://{$username}:{$password}@{$info['host']}/{$info['dbname']} ";
    $command .= "-C ";
    $command .= "sqlite://sqlite/database.sql";
    $ret = common::systemCommand($command);
    $base = conf::pathBase();
    if (!$ret) {
        $fs->chmod('sqlite/database.sql', 0777, 00, true);
        common::echoMessage('Sqlite database created. Edit config.ini and add:');
        common::echoMessage("sqlite:/{$base}/sqlite/database.sql");
    }
}