Example #1
0
 private static function checkTables()
 {
     $slices_table = rex_sql_table::get(rex::getTable('article_slice'));
     $history_table = rex_sql_table::get(self::getTable());
     foreach ($slices_table->getColumns() as $column) {
         if (strtolower($column->getName()) != 'id') {
             $history_table->ensureColumn($column)->alter();
         }
     }
 }
Example #2
0
<?php

/**
 * YREWRITE Addon.
 *
 * @author jan.kristinus@yakamara.de
 *
 * @package redaxo\yrewrite
 *
 * @var rex_addon $this
 */
rex_sql_table::get('rex_article')->ensureColumn(new rex_sql_column('yrewrite_url', 'varchar(255)'))->ensureColumn(new rex_sql_column('yrewrite_priority', 'varchar(5)'))->ensureColumn(new rex_sql_column('yrewrite_changefreq', 'varchar(10)'))->ensureColumn(new rex_sql_column('yrewrite_title', 'varchar(255)'))->ensureColumn(new rex_sql_column('yrewrite_description', 'text'))->ensureColumn(new rex_sql_column('yrewrite_index', 'tinyint(1)'))->alter();
$sql = rex_sql::factory();
$sql->setQuery('CREATE TABLE IF NOT EXISTS `rex_yrewrite_domain` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `domain` varchar(255) NOT NULL,
    `mount_id` int(11) NOT NULL,
    `start_id` int(11) NOT NULL,
    `notfound_id` int(11) NOT NULL,
    `alias_domain` varchar(255) NOT NULL,
    `clangs` varchar(255) NOT NULL,
    `clang_start` int(11) NOT NULL,
    `robots` TEXT NOT NULL,
    `title_scheme` varchar(255) NOT NULL,
    `description` varchar(255) NOT NULL,
    PRIMARY KEY (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;');
$sql->setQuery('CREATE TABLE IF NOT EXISTS `rex_yrewrite_forward` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `domain` varchar(255) NOT NULL,
    `status` int(11) NOT NULL,
Example #3
0
<?php

if (rex_string::versionCompare(rex::getVersion(), '5.1.0-beta1', '<')) {
    rex_sql_table::get(rex::getTable('user'))->ensureColumn(new rex_sql_column('email', 'varchar(255)', true))->ensureColumn(new rex_sql_column('lastlogin', 'datetime', true))->alter();
    rex_sql_table::get(rex::getTable('clang'))->ensureColumn(new rex_sql_column('status', 'tinyint(1)'))->alter();
    rex_sql::factory()->setQuery('UPDATE ' . rex::getTable('clang') . ' SET `status` = 1');
}
if (PHP_VERSION_ID < 50509) {
    throw new rex_functional_exception(rex_i18n::msg('setup_301', PHP_VERSION, '5.5.9'));
}
Example #4
0
<?php

/**
 * YREWRITE Addon.
 *
 * @author jan.kristinus@yakamara.de
 *
 * @package redaxo\yrewrite
 *
 * @var rex_addon $this
 */
rex_sql_table::get(rex::getTable('article'))->removeColumn('yrewrite_url')->removeColumn('yrewrite_priority')->removeColumn('yrewrite_changefreq')->removeColumn('yrewrite_title')->removeColumn('yrewrite_description')->removeColumn('yrewrite_index')->alter();
$sql = rex_sql::factory();
$sql->setQuery(sprintf('DROP TABLE IF EXISTS `%s`;', rex::getTable('yrewrite_domain')));
$sql->setQuery(sprintf('DROP TABLE IF EXISTS `%s`;', rex::getTable('yrewrite_forward')));
rex_delete_cache();
Example #5
0
<?php

rex_sql_table::get("rex_aufgaben")->ensureColumn(new rex_sql_column('title', 'varchar(255)'))->ensureColumn(new rex_sql_column('description', 'longtext'))->ensureColumn(new rex_sql_column('category', 'int(10)'))->ensureColumn(new rex_sql_column('responsible', 'int(10)'))->ensureColumn(new rex_sql_column('prio', 'int(10)'))->ensureColumn(new rex_sql_column('status', 'int(10)'))->ensureColumn(new rex_sql_column('createdate', 'DATETIME'))->ensureColumn(new rex_sql_column('updatedate', 'DATETIME'))->ensureColumn(new rex_sql_column('createuser', 'varchar(255)'))->ensureColumn(new rex_sql_column('updateuser', 'varchar(255)'))->ensureColumn(new rex_sql_column('observer', 'varchar(255)'))->ensureColumn(new rex_sql_column('finaldate', 'varchar(255)'))->alter();
rex_sql_table::get("rex_aufgaben_categories")->ensureColumn(new rex_sql_column('category', 'varchar(255)'))->ensureColumn(new rex_sql_column('color', 'varchar(255)'))->alter();
rex_sql_table::get("rex_aufgaben_status")->ensureColumn(new rex_sql_column('status', 'varchar(255)'))->ensureColumn(new rex_sql_column('icon', 'varchar(255)'))->alter();
rex_sql_table::get("rex_aufgaben_filter")->ensureColumn(new rex_sql_column('user', 'varchar(255)'))->ensureColumn(new rex_sql_column('category', 'varchar(255)'))->ensureColumn(new rex_sql_column('responsible', 'varchar(255)'))->ensureColumn(new rex_sql_column('prio', 'varchar(255)'))->ensureColumn(new rex_sql_column('status', 'varchar(255)'))->ensureColumn(new rex_sql_column('done', 'varchar(255)'))->alter();
rex_sql_table::get("rex_aufgaben_user_settings")->ensureColumn(new rex_sql_column('user', 'int(10)'))->ensureColumn(new rex_sql_column('counter', 'int(10)'))->alter();
rex_sql_table::get("rex_aufgaben_status")->ensureColumn(new rex_sql_column('user', 'int(10)'))->ensureColumn(new rex_sql_column('counter', 'int(10)'))->alter();
Example #6
0
<?php

/** @var rex_addon $this */
if (rex_string::versionCompare($this->getVersion(), '2.1-dev', '<')) {
    $table = rex::getTable('cronjob');
    rex_sql_table::get($table)->ensureColumn(new rex_sql_column('interval', 'text'))->ensureColumn(new rex_sql_column('nexttime', 'datetime', true))->alter();
    $sql = rex_sql::factory();
    $sql->setQuery('UPDATE ' . $table . ' SET environment = REPLACE(REPLACE(environment, "|0|", "|frontend|"), "|1|", "|backend|")');
    $jobs = $sql->getArray('SELECT id, `interval` FROM ' . $table);
    foreach ($jobs as $job) {
        $old = explode('|', trim($job['interval'], '|'));
        $count = $old[0];
        $interval = ['minutes' => [0], 'hours' => [0], 'days' => 'all', 'weekdays' => 'all', 'months' => 'all'];
        switch ($old[1]) {
            case 'i':
                if ($count < 8) {
                    $interval['minutes'] = 'all';
                } elseif ($count < 33) {
                    $interval['minutes'] = range(0, 55, round($count / 5) * 5);
                }
                $interval['hours'] = 'all';
                break;
            case 'h':
                if ($count == 1) {
                    $interval['hours'] = 'all';
                } elseif ($count < 13) {
                    $interval['hours'] = range(0, 23, $count);
                }
                break;
            case 'd':
                if ($count > 15) {