コード例 #1
0
ファイル: upgrade_0_12_0.inc.php プロジェクト: Ibrahim1/aec
    // All Subscriptions are primary
    $query = 'UPDATE #__acctexp_subscr' . ' SET `primary` = \'1\'';
    $db->setQuery($query);
    $db->query();
    // copy expiration date
    $query = 'UPDATE #__acctexp_subscr as a' . ' INNER JOIN #__acctexp as b ON a.userid = b.userid' . ' SET a.expiration = b.expiration';
    $db->setQuery($query);
    $db->query();
    // Get plans
    $query = 'SELECT `id`' . ' FROM #__acctexp_plans';
    $db->setQuery($query);
    $pplans = xJ::getDBArray($db);
    // Assign new make_primary flag to all old plans
    foreach ($pplans as $planid) {
        $subscription_plan = new SubscriptionPlan();
        $subscription_plan->addParams(array('make_primary' => 1));
    }
    // delete old expiration table
    $eucaInstalldb->dropTableifExists('acctexp', false);
}
// fix for 0.12.4.15f mistake
$eucaInstalldb->addColifNotExists('primary', "int(1) NOT NULL default '0'", 'subscr');
$eucaInstalldb->addColifNotExists('subscr_id', "int(11) NULL", 'invoices');
$eucaInstalldb->addColifNotExists('conditions', "text NULL", 'invoices');
$eucaInstalldb->addColifNotExists('subscr_id', "int(11) NULL", 'invoices');
$eucaInstalldb->addColifNotExists('conditions', "text NULL", 'invoices');
$eucaInstalldb->addColifNotExists('invoice_number_format', "varchar(64)", 'invoices');
// update remository and docman MI tables for unlimited downloads if they exist
if (in_array($app->getCfg('dbprefix') . "acctexp_mi_remository", $tables)) {
    $eucaInstalldb->addColifNotExists('unlimited_downloads', "int(3) NULL", 'mi_remository');
}