コード例 #1
0
<?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();
}
コード例 #2
0
ファイル: module_manager.php プロジェクト: cretzu89/EPESI
 /**
  * Installs module given as first parameter.
  * Additionally, this function calls upgrade to version given as second parameter.
  *
  * @param string $module module name or module class name - both / and _ separated.
  * @param integer $version module version
  * @return bool true if installation success, false otherwise
  */
 public static final function install($module, $version = null, $check = null, $include_common = true)
 {
     if ($check === null) {
         if (defined('UPDATING_EPESI')) {
             $check = false;
         } else {
             $check = true;
         }
     }
     $module_class_name = self::get_module_class_name($module);
     self::include_install($module_class_name);
     if (!isset(self::$modules_install[$module_class_name])) {
         return false;
     }
     $func_version = array(self::$modules_install[$module_class_name], 'version');
     if (is_callable($func_version)) {
         $inst_ver = call_user_func($func_version);
     } else {
         $inst_ver = 0;
     }
     if (is_array($inst_ver)) {
         $inst_ver = count($inst_ver);
     } else {
         $inst_ver = intval($inst_ver);
     }
     if (!isset($version)) {
         $version = $inst_ver - 1;
     } else {
         if ($inst_ver < $version) {
             print 'Module ' . '<b>' . $module_class_name . '</b>' . ' is too old. Please download newer version<br>';
             return false;
         }
     }
     if (self::is_installed($module_class_name) >= $version) {
         return true;
     }
     if (!self::exists($module_class_name, $version)) {
         return false;
     }
     //check dependecies
     if (!self::satisfy_dependencies($module_class_name, $version, $check)) {
         print '<b>' . $module_class_name . '</b>' . ': dependencies not satisfied.<br>';
         return false;
     }
     if (DB::is_mysql()) {
         DB::Execute('SET FOREIGN_KEY_CHECKS = 0');
     }
     //call install script and fill database
     if (!call_user_func(array(self::$modules_install[$module_class_name], 'install'))) {
         call_user_func(array(self::$modules_install[$module_class_name], 'uninstall'));
         self::remove_data_dir($module_class_name);
         print '<b>' . $module_class_name . '</b>' . ': uninstalled<br>';
         if (DB::is_mysql()) {
             DB::Execute('SET FOREIGN_KEY_CHECKS = 1');
         }
         return false;
     }
     if (DB::is_mysql()) {
         DB::Execute('SET FOREIGN_KEY_CHECKS = 1');
     }
     $ret = DB::Execute('insert into modules(name, version) values(%s,0)', $module_class_name);
     if (!$ret) {
         print '<b>' . $module_class_name . '</b>' . ' module installation failed: database<br>';
         return false;
     }
     self::register($module_class_name, $version, self::$modules);
     PatchUtil::mark_applied($module_class_name);
     if ($check) {
         self::create_load_priority_array();
     }
     print '<b>' . $module_class_name . '</b>' . ' module installed!<br>';
     if ($version != 0) {
         $up = self::upgrade($module_class_name, $version);
         if (!$up) {
             return false;
         }
     }
     if ($include_common) {
         self::include_common($module_class_name, $version);
         //    		self::create_common_cache();
     }
     if (file_exists(DATA_DIR . '/cache/common.php')) {
         unlink(DATA_DIR . '/cache/common.php');
     }
     Cache::clear();
     self::$processed_modules['install'][$module_class_name] = $version;
     return true;
 }
コード例 #3
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
PatchUtil::db_add_column('cron', 'description', 'C(255)');
コード例 #4
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');
コード例 #5
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
ModuleManager::install('Utils/FileStorage');
@PatchUtil::db_add_column('utils_attachment_file', 'filestorage_id', 'I8 NOTNULL');
Patch::set_message('Processing files');
$files_checkpoint = Patch::checkpoint('files');
if (!$files_checkpoint->is_done()) {
    if ($files_checkpoint->has('files')) {
        $files = $files_checkpoint->get('files');
    } else {
        $files = 0;
    }
    if ($files_checkpoint->has('files_qty')) {
        $files_qty = $files_checkpoint->get('files_qty');
    } else {
        $files_qty = DB::GetOne('SELECT count(*) FROM utils_attachment_file');
        $files_checkpoint->set('files_qty', $files_qty);
    }
    while ($ret = DB::SelectLimit('SELECT f.id,f.attach_id as aid,f.original FROM utils_attachment_file f ORDER BY f.id', 1, $files++)) {
        $row = $ret->FetchRow();
        if (!$row) {
            break;
        }
        if (file_exists(DATA_DIR . '/Utils_Attachment/' . $row['aid'] . '/' . $row['id'])) {
            Patch::set_message('Processing file: ' . $files . '/' . $files_qty);
            $files_checkpoint->require_time(2);
            $fsid = Utils_FileStorageCommon::write_file($row['original'], DATA_DIR . '/Utils_Attachment/' . $row['aid'] . '/' . $row['id'], 'attachment_file/' . $row['id']);
            unlink(DATA_DIR . '/Utils_Attachment/' . $row['aid'] . '/' . $row['id']);
            DB::Execute('UPDATE utils_attachment_file SET filestorage_id=%d WHERE id=%d', array($fsid, $row['id']));
        }
コード例 #6
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
@PatchUtil::db_add_column('utils_currency', 'default_currency', 'I1');
$first = DB::GetCol('SELECT id FROM utils_currency WHERE active=1 AND default_currency=1 ORDER BY id');
if (!$first) {
    $first = DB::GetCol('SELECT id FROM utils_currency WHERE active=1 ORDER BY id');
}
DB::Execute('UPDATE utils_currency SET default_currency=0');
if ($first) {
    DB::Execute('UPDATE utils_currency SET default_currency=1 WHERE id=%d', array($first[0]));
}
コード例 #7
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
PatchUtil::db_add_column('base_lang_trans_contrib', 'credits', 'I1');
PatchUtil::db_add_column('base_lang_trans_contrib', 'credits_website', 'C(128)');
PatchUtil::db_add_column('base_lang_trans_contrib', 'contact_email', 'C(128)');
コード例 #8
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
if (ModuleManager::is_installed('Utils_Attachment') == -1) {
    return;
}
PatchUtil::db_add_column('utils_attachment_download', 'expires_on', 'T');
$ret = DB::Execute('SELECT * FROM utils_attachment_download');
while ($row = $ret->FetchRow()) {
    if (!is_numeric($row['created_on'])) {
        $row['created_on'] = strtotime($row['created_on']);
    }
    DB::Execute('UPDATE utils_attachment_download SET expires_on=%T WHERE id=%s', array($row['created_on'] + 3600 * 24 * 7, $row['id']));
}
コード例 #9
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
PatchUtil::db_alter_column('user_password', 'password', 'C(256) NOTNULL');
コード例 #10
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
$checkpoint = Patch::checkpoint('tables');
if (!$checkpoint->is_done()) {
    DB::CreateTable('recordbrowser_words_index', 'id I AUTO KEY,word C(3)', array('constraints' => ', UNIQUE(word)'));
    DB::CreateTable('recordbrowser_words_map', 'word_id I, tab C(64), record_id I, field_name C(32), position I', array('constraints' => ', FOREIGN KEY (word_id) REFERENCES recordbrowser_words_index(id)'));
    DB::CreateIndex('recordbrowser_words_map__idx', 'recordbrowser_words_map', 'word_id,tab,record_id,field_name');
    DB::CreateIndex('recordbrowser_words_map__idx2', 'recordbrowser_words_map', 'tab,record_id');
    $checkpoint->done();
}
$checkpoint2 = Patch::checkpoint('tabs');
if ($checkpoint2->has('tabs')) {
    $tabs = $checkpoint2->get('tabs');
} else {
    $tabs = DB::GetCol('SELECT tab FROM recordbrowser_table_properties');
}
foreach ($tabs as $i => $tab) {
    $checkpoint2->require_time(1);
    @PatchUtil::db_add_column($tab . '_data_1', 'indexed', 'I1 NOT NULL DEFAULT 0');
    @DB::CreateIndex($tab . '_idxed', $tab . '_data_1', 'indexed,active');
    unset($tabs[$i]);
    $checkpoint2->set('tabs', $tabs);
}
コード例 #11
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
PatchUtil::db_add_column('utils_commondata_tree', 'position', 'I4');
reset_sub_arrays('/');
function reset_sub_arrays($name)
{
    Utils_CommonDataCommon::reset_array_positions($name);
    $arr = Utils_CommonDataCommon::get_array($name, false, false, true);
    foreach ($arr as $k => $v) {
        if (empty($k)) {
            continue;
        }
        reset_sub_arrays($name . '/' . $k);
    }
}
コード例 #12
0
ファイル: Patches.php プロジェクト: cretzu89/EPESI
 private function _print_patches_list()
 {
     $counter = 0;
     $counterpatched = 0;
     $patches = PatchUtil::list_patches(false);
     print '<table id="patches">';
     foreach ($patches as $patch) {
         if ($patch->was_applied()) {
             $this->print_row_old_patch($patch);
             $counterpatched++;
         } else {
             $this->print_row_new_patch($patch);
             $counter++;
         }
     }
     print '<tr><td>&nbsp;</td></tr>';
     if ($counter) {
         print '<tr><td><div class="left">&nbsp;</div><div class="center strong">New patches found: </div><div class="right red strong">' . $counter . '</div></td></tr>';
     }
     if ($counterpatched) {
         print '<tr><td><div class="left">&nbsp;</div><div class="center strong">Patches already installed: </div><div class="right green">' . $counterpatched . '</div></td></tr>';
     }
     if ($counter == 0) {
         print '<tr><td><div class="content infotext">No new patches were found. Press NEXT to rebuild common cache and theme files. This operation can take a minute...</div></td></tr>';
         $this->set_next_step(2);
     } else {
         print '<tr><td><div class="content infotext">New patches were found. Press NEXT to apply them. This operation can take a minute...</div></td></tr>';
         $this->set_next_step(1);
     }
     print '</table>';
 }
コード例 #13
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 . "_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);
}
コード例 #14
0
<?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']);
}
コード例 #15
0
<?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)');
}
コード例 #16
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
PatchUtil::db_add_column('recordbrowser_table_properties', 'jump_to_id', 'I1 DEFAULT 1');
コード例 #17
0
ファイル: 20140127_crypt.php プロジェクト: cretzu89/EPESI
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
PatchUtil::db_add_column('utils_attachment_link', 'title', 'C(255)');
PatchUtil::db_add_column('utils_attachment_link', 'crypted', 'I1 DEFAULT 0');
コード例 #18
0
        JOIN information_schema.constraint_column_usage AS ccu
          ON ccu.constraint_name = tc.constraint_name
        WHERE constraint_type = 'FOREIGN KEY' AND tc.table_name='recordbrowser_words_map' AND kcu.column_name='word_id';");
        if($a) {
            DB::Execute('alter table recordbrowser_words_map drop CONSTRAINT "'.$a.'"');
        }
    }
    DB::CreateIndex('recordbrowser_words_map__idx','recordbrowser_words_map','word_id,tab,record_id,field_name',array('DROP'=>1));
    DB::CreateIndex('recordbrowser_words_map__idx2','recordbrowser_words_map','tab,record_id',array('DROP'=>1));
    
    DB::Execute('TRUNCATE TABLE recordbrowser_words_index');
    
    $remove_idx_checkpoint->done();
}

$finalize_checkpoint = Patch::checkpoint('finalize');
if(!$finalize_checkpoint->is_done()) {
    Patch::require_time(20);

    PatchUtil::db_drop_column('recordbrowser_words_map', 'tab');
    PatchUtil::db_drop_column('recordbrowser_words_map', 'field_name');

    if(DB::is_postgresql()) {
        DB::Execute('ALTER TABLE recordbrowser_words_map ADD CONSTRAINT word_id_fk FOREIGN KEY (word_id) REFERENCES recordbrowser_words_index');
    } else {
        DB::Execute('ALTER TABLE recordbrowser_words_map ADD FOREIGN KEY (word_id) REFERENCES recordbrowser_words_index(id)');
    }
    DB::CreateIndex('recordbrowser_words_map__idx','recordbrowser_words_map','word_id,tab_id');
    $finalize_checkpoint->done();
}
コード例 #19
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
if (!array_key_exists(strtoupper('deleted'), DB::MetaColumnNames('utils_attachment_file'))) {
    PatchUtil::db_add_column('utils_attachment_file', 'deleted', 'I1 DEFAULT 0');
    $ret = DB::Execute('SELECT uaf.id as id, uaf.original as original, uaf.attach_id as attach_id, uaf.revision as revision, ual.local as local FROM utils_attachment_file uaf LEFT JOIN utils_attachment_link ual ON ual.id=uaf.attach_id ORDER BY revision DESC');
    $max_rev = array();
    $ids = array();
    while ($row = $ret->FetchRow()) {
        if (!isset($max_rev[$row['attach_id']])) {
            $max_rev[$row['attach_id']] = $row['revision'];
        } else {
            $ids[] = $row['id'];
        }
        if (!$row['original']) {
            $ids[] = $row['id'];
        }
        $old_filename = DATA_DIR . '/Utils_Attachment/' . $row['local'] . '/' . $row['attach_id'] . '_' . $row['revision'];
        $new_filename = DATA_DIR . '/Utils_Attachment/' . $row['local'] . '/' . $row['id'];
        @rename($old_filename, $new_filename);
    }
    if (!empty($ids)) {
        DB::Execute('UPDATE utils_attachment_file SET deleted=1 WHERE id IN (' . implode(',', $ids) . ')');
    }
}
コード例 #20
0
<?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)');
}
コード例 #21
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
// this patch has been renamed to make update process right
// 4bb2048388cd0807ac707edeaa67dfa2 is:
// modules/Utils/RecordBrowser/patches/20140814_add_processing_order.php
$db = new PatchesDB();
if ($db->was_applied('4bb2048388cd0807ac707edeaa67dfa2')) {
    return;
}
$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(3);
    $tab = $tab . "_field";
    $columns = DB::MetaColumnNames($tab);
    if (!isset($columns['PROCESSING_ORDER'])) {
        PatchUtil::db_add_column($tab, 'processing_order', 'I2');
        DB::Execute("UPDATE {$tab} SET processing_order=position");
    }
    $checkpoint->set('processed', $processed);
}
コード例 #22
0
ファイル: RB_permissions2.php プロジェクト: cretzu89/EPESI
    $allow |= is_user_in_group($aid, 'Employee Administrator');
    $allow |= is_user_in_group($aid, 'Administrator');
    $allow |= is_user_in_group($aid, 'Super administrator');
    if ($allow) {
        $r2 = DB::Execute('SELECT * FROM contact_data_1 WHERE f_login=%d', array($row['id']));
        while ($r = $r2->FetchRow()) {
            if (!$r['f_access']) {
                $gr = '__manager__';
            } else {
                $gr = $r['f_access'] . 'manager__';
            }
            DB::Execute('UPDATE contact_data_1 SET f_access=%s WHERE id=%d', array($gr, $r['id']));
        }
    }
}
PatchUtil::db_drop_column('recordbrowser_table_properties', 'access_callback');
Utils_RecordBrowserCommon::add_default_access('crm_assets');
Utils_RecordBrowserCommon::add_access('company', 'view', 'ACCESS:employee', array('(!permission' => 2, '|:Created_by' => 'USER_ID'));
Utils_RecordBrowserCommon::add_access('company', 'view', 'ALL', array('id' => 'USER_COMPANY'));
Utils_RecordBrowserCommon::add_access('company', 'add', 'ACCESS:employee');
Utils_RecordBrowserCommon::add_access('company', 'edit', 'ACCESS:employee', array('(permission' => 0, '|:Created_by' => 'USER_ID'));
Utils_RecordBrowserCommon::add_access('company', 'edit', array('ALL', 'ACCESS:manager'), array('id' => 'USER_COMPANY'));
Utils_RecordBrowserCommon::add_access('company', 'edit', array('ACCESS:employee', 'ACCESS:manager'), array());
Utils_RecordBrowserCommon::add_access('company', 'delete', 'ACCESS:employee', array(':Created_by' => 'USER_ID'));
Utils_RecordBrowserCommon::add_access('company', 'delete', array('ACCESS:employee', 'ACCESS:manager'));
Utils_RecordBrowserCommon::add_access('contact', 'view', 'ACCESS:employee', array('(!permission' => 2, '|:Created_by' => 'USER_ID'));
Utils_RecordBrowserCommon::add_access('contact', 'view', 'ALL', array('login' => 'USER_ID'));
Utils_RecordBrowserCommon::add_access('contact', 'add', 'ACCESS:employee');
Utils_RecordBrowserCommon::add_access('contact', 'edit', 'ACCESS:employee', array('(permission' => 0, '|:Created_by' => 'USER_ID'), array('access', 'login'));
Utils_RecordBrowserCommon::add_access('contact', 'edit', 'ALL', array('login' => 'USER_ID'), array('company_name', 'related_companies', 'access', 'login'));
Utils_RecordBrowserCommon::add_access('contact', 'edit', array('ALL', 'ACCESS:manager'), array('company_name' => 'USER_COMPANY'), array('login', 'company_name', 'related_companies'));
コード例 #23
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
PatchUtil::db_rename_column('epesi_store_modules', 'order_id', 'module_license_id', 'I4 NOTNULL');
コード例 #24
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
if (array_key_exists(strtoupper('revision'), DB::MetaColumnNames('utils_attachment_file'))) {
    @DB::Execute('ALTER TABLE utils_attachment_file DROP INDEX utils_attachment_file__revision__idx');
    @DB::Execute('alter table utils_attachment_file drop foreign key utils_attachment_file_ibfk_2');
    @DB::Execute('alter table utils_attachment_file drop index attach_id');
    PatchUtil::db_drop_column('utils_attachment_file', 'revision');
}
コード例 #25
0
ファイル: export.php プロジェクト: cretzu89/EPESI
<?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";
    PatchUtil::db_add_column($tab, 'export', 'I1 DEFAULT 1');
    $checkpoint->set('processed', $processed);
}
コード例 #26
0
ファイル: search_include.php プロジェクト: cretzu89/EPESI
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
$pdb = new PatchesDB();
if ($pdb->was_applied(md5('modules/Utils/RecordBrowser/patches/20140827_search_include.php'))) {
    return;
}
PatchUtil::db_add_column('recordbrowser_table_properties', 'search_include', 'I1 DEFAULT 0');
PatchUtil::db_add_column('recordbrowser_table_properties', 'search_priority', 'I1 DEFAULT 0');
Utils_RecordBrowserCommon::set_search('company', 1, 2);
Utils_RecordBrowserCommon::set_search('contact', 1, 2);
Utils_RecordBrowserCommon::set_search('crm_meeting', 2, 0);
Utils_RecordBrowserCommon::set_search('phonecall', 2, 0);
Utils_RecordBrowserCommon::set_search('task', 2, 0);
Utils_RecordBrowserCommon::set_search('crm_assets', 2, 0);
Utils_RecordBrowserCommon::set_search('rc_mail_threads', 2, -1);
Utils_RecordBrowserCommon::set_search('rc_mails', 2, -1);
Utils_RecordBrowserCommon::set_search('rc_multiple_emails', 2, 0);
Utils_RecordBrowserCommon::set_search('custom_projects', 1, 1);
Utils_RecordBrowserCommon::set_search('custom_personalequipment', 2, -2);
Utils_RecordBrowserCommon::set_search('custom_jobsearch', 2, 0);
Utils_RecordBrowserCommon::set_search('custom_jobsearch_history', 2, -1);
Utils_RecordBrowserCommon::set_search('custom_ccn_sales', 2, 0);
Utils_RecordBrowserCommon::set_search('custom_monthlycost', 2, 0);
Utils_RecordBrowserCommon::set_search('custom_merlin_licence', 2, 0);
Utils_RecordBrowserCommon::set_search('custom_merlin_sent', 2, -2);
Utils_RecordBrowserCommon::set_search('utils_attachment', 1, 0);
Utils_RecordBrowserCommon::set_search('premium_listmanager', 2, 0);
Utils_RecordBrowserCommon::set_search('premium_listmanager_element', 2, -1);
Utils_RecordBrowserCommon::set_search('premium_warehouse', 2, 0);
Utils_RecordBrowserCommon::set_search('premium_projects', 2, 0);
コード例 #27
0
ファイル: update.php プロジェクト: 62BRAINS/EPESI
    protected function perform_update_patches($browser = true)
    {
        $this->turn_on_maintenance_mode();

        $patches = PatchUtil::apply_new(true);

        if ($browser) {
            $success = PatchUtil::all_successful($patches);
            if (!$success) {
                $msg = self::format_patches_msg($patches);
                $this->body($msg);
            }
            return $success;
        }
    }
コード例 #28
0
<?php

defined("_VALID_ACCESS") || die('Direct access forbidden');
$tabs = DB::GetCol('SELECT tab FROM recordbrowser_table_properties');
foreach ($tabs as $tab) {
    PatchUtil::db_drop_column($tab . '_data_1', 'private');
}
コード例 #29
0
ファイル: patches.php プロジェクト: cretzu89/EPESI
 /**
  * Require specific amount of time, but adjust it dynamically to the longest
  * run between calls to the function.
  *
  * First call - use argument value to require_time. Next - use calculated.
  *
  * @param float $time Default required time - only for the first run.
  *                    Every consecutive call to this function will use
  *                    stored time - calculated during runtime
  */
 public function require_time($time = 0.0)
 {
     $now = microtime(true);
     $last_measured = null;
     if (isset($this->timer_last_run)) {
         $last_measured = $now - $this->timer_last_run;
         if ($last_measured > $this->timer_max_time) {
             $this->timer_max_time = $last_measured;
         }
     }
     $this->timer_last_run = $now;
     if (isset($this->timer_max_time)) {
         $time = $this->timer_max_time;
     }
     $this->save_data();
     PatchUtil::require_time($time);
 }
コード例 #30
0
ファイル: caption_field.php プロジェクト: cretzu89/EPESI
<?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";
    PatchUtil::db_add_column($tab, 'caption', 'C(255)');
    $checkpoint->set('processed', $processed);
}