<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
//ModuleManager::uninstall($module_to_uninstall);
if (ModuleManager::is_installed('Base_EpesiStore') === -1) {
    ModuleManager::install('Base_EpesiStore');
    ModuleManager::create_load_priority_array();
} else {
    PatchUtil::db_alter_column('epesi_store_modules', 'version', 'C(10)');
}
Esempio n. 2
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
$deadline_field_is_not_timestamp = !DB::GetOne('SELECT 1 FROM task_field WHERE field=%s AND type=%s', array('Deadline', 'timestamp'));
if ($deadline_field_is_not_timestamp) {
    PatchUtil::db_alter_column('task_data_1', 'f_deadline', 'T');
    DB::Execute('UPDATE task_field SET type=%s WHERE field=%s', array('timestamp', 'Deadline'));
}
$tab = 'task';
$field = array('name' => _M('Timeless'), 'type' => 'checkbox', 'required' => false, 'extra' => false, 'position' => 'Deadline', 'QFfield_callback' => 'CRM_TasksCommon::QFfield_timeless');
Utils_RecordBrowserCommon::new_record_field($tab, $field);
$deadline_time_field_exists = DB::GetOne('SELECT 1 FROM task_field WHERE field=%s', array('Deadline Time'));
$sql = false;
if ($deadline_time_field_exists) {
    if (DB::is_mysql()) {
        $sql = 'UPDATE task_data_1 SET f_deadline = TIMESTAMP(f_deadline, TIME(f_deadline_time)), f_timeless = (f_deadline_time IS NULL)';
    } else {
        $sql = 'UPDATE task_data_1 SET f_deadline = f_deadline + CAST(f_deadline_time as time), f_timeless = (f_deadline_time IS NULL)::int';
    }
} elseif ($deadline_field_is_not_timestamp) {
    if (DB::is_mysql()) {
        $sql = 'UPDATE task_data_1 SET f_deadline = TIMESTAMP(f_deadline, \'12:00:00\'), f_timeless = 1';
    } else {
        $sql = 'UPDATE task_data_1 SET f_deadline = f_deadline + CAST(\'12:00:00\' as time), f_timeless = 1';
    }
}
if ($sql) {
    DB::Execute($sql);
}
if ($deadline_time_field_exists) {
    Utils_RecordBrowserCommon::delete_record_field('task', 'Deadline Time');
Esempio n. 3
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
PatchUtil::db_alter_column('user_password', 'password', 'C(256) NOTNULL');
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
$mysql = DB::is_mysql();
if ($mysql) {
    // remove foregin keys
    foreach (array('history', 'session_client') as $tab) {
        $a = DB::GetRow("SHOW CREATE TABLE {$tab}");
        if (preg_match('/CONSTRAINT (.+) FOREIGN KEY .*session_name/', $a[1], $m)) {
            DB::Execute("ALTER TABLE {$tab} DROP FOREIGN KEY " . $m[1]);
        }
    }
}
PatchUtil::db_alter_column('session', 'name', 'C(128) NOTNULL');
PatchUtil::db_alter_column('session_client', 'session_name', 'C(128) NOTNULL');
PatchUtil::db_alter_column('history', 'session_name', 'C(128) NOTNULL');
if ($mysql) {
    DB::Execute('ALTER TABLE history ADD FOREIGN KEY (session_name) REFERENCES session(name)');
    DB::Execute('ALTER TABLE session_client ADD FOREIGN KEY (session_name) REFERENCES session(name)');
}
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
$recordsets = Utils_RecordBrowserCommon::list_installed_recordsets();
$checkpoint = Patch::checkpoint('recordset');
$processed = $checkpoint->get('processed', array());
foreach ($recordsets as $tab => $caption) {
    if (isset($processed[$tab])) {
        continue;
    }
    $processed[$tab] = true;
    Patch::require_time(5);
    $tab = $tab . "_field";
    DB::Execute("UPDATE {$tab} SET processing_order=position WHERE processing_order IS NULL");
    PatchUtil::db_alter_column($tab, 'processing_order', 'I2 NOTNULL');
    $checkpoint->set('processed', $processed);
}
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
PatchUtil::db_alter_column('rc_mails_data_1', 'f_references', 'C(16384)');
PatchUtil::db_alter_column('rc_mails_data_1', 'f_to', 'C(4096)');
DB::Execute('UPDATE rc_mails_data_1 SET f_thread=null');
DB::Execute('DELETE FROM rc_mail_threads_edit_history_data');
DB::Execute('DELETE FROM rc_mail_threads_edit_history');
DB::Execute('DELETE FROM rc_mail_threads_data_1');
DB::Execute("UPDATE rc_mails_data_1 SET f_message_id=REPLACE (f_message_id, '&lt;','')");
DB::Execute("UPDATE rc_mails_data_1 SET f_message_id=REPLACE (f_message_id, '&gt;','')");
// create index to optimize counting completed field
@DB::CreateIndex('rc_mails_thread_idx', 'rc_mails_data_1', 'f_thread');
@DB::CreateIndex('rc_mails_msgid_idx', 'rc_mails_data_1', 'f_message_id');
$mails = Utils_RecordBrowserCommon::get_records('rc_mails');
foreach ($mails as $m) {
    if (preg_match('/\\nreferences:(.*)\\n/i', $m['headers_data'], $match)) {
        $ref = trim($match[1]);
        Utils_RecordBrowserCommon::update_record('rc_mails', $m['id'], array('references' => $ref));
    }
    if (!$m['message_id'] && preg_match('/\\nmessageid:(.*)\\n/i', $m['headers_data'], $match)) {
        $mid = str_replace(array('<', '>'), '', trim($match[1]));
        Utils_RecordBrowserCommon::update_record('rc_mails', $m['id'], array('message_id' => $mid));
    }
}
foreach ($mails as $m) {
    CRM_RoundcubeCommon::create_thread($m['id']);
}
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
$checkpoint = Patch::checkpoint('mark_to_index');
if (!$checkpoint->is_done()) {
    $done = $checkpoint->get('recordsets', array());
    $recordsets = Utils_RecordBrowserCommon::list_installed_recordsets();
    foreach ($recordsets as $tab => $caption) {
        Patch::require_time(1);
        if (!isset($done[$tab])) {
            PatchUtil::db_alter_column($tab . '_access', 'crits', 'X');
            $done[$tab] = true;
            $checkpoint->set('recordsets', $done);
        }
    }
    $checkpoint->done();
}
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
PatchUtil::db_alter_column('tools_whoisonline_users', 'session_name', 'C(128) KEY NOTNULL');
Esempio n. 9
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
$recordsets = Utils_RecordBrowserCommon::list_installed_recordsets();
$checkpoint = Patch::checkpoint('recordset');
$processed = $checkpoint->get('processed', array());
foreach ($recordsets as $tab => $caption) {
    if (isset($processed[$tab])) {
        continue;
    }
    $processed[$tab] = true;
    Patch::require_time(5);
    $tab = $tab . "_callback";
    PatchUtil::db_alter_column($tab, 'callback', 'X');
    $checkpoint->set('processed', $processed);
}