コード例 #1
0
ファイル: Bootstrap.php プロジェクト: alexanderTsig/arabic
 function onDbUpgrade(Am_Event $e)
 {
     if (version_compare($e->getVersion(), '4.2.6') < 0) {
         echo "Convert commission rule type...";
         if (ob_get_level()) {
             ob_end_flush();
         }
         $this->getDi()->db->query("UPDATE ?_aff_commission_rule SET type=?, tier=? WHERE type=?", 'global', 0, 'global-1');
         $this->getDi()->db->query("UPDATE ?_aff_commission_rule SET type=?, tier=? WHERE type=?", 'global', 1, 'global-2');
         echo "Done<br>\n";
     }
     if (version_compare($e->getVersion(), '4.2.20') < 0) {
         echo "Normalize sort order for aff banners and links...";
         if (ob_get_level()) {
             ob_end_flush();
         }
         $this->getDi()->db->query("SET @i = 0");
         $this->getDi()->db->query("UPDATE ?_aff_banner SET sort_order=(@i:=@i+1) ORDER BY IF(sort_order = 0, ~0, sort_order)");
         echo "Done<br>\n";
     }
     if (version_compare($e->getVersion(), '4.3.6') < 0) {
         echo "Define relation between commission and void...";
         if (ob_get_level()) {
             ob_end_flush();
         }
         $rows = $this->getDi()->db->select("SELECT c.commission_id AS comm_id, v.commission_id AS void_id FROM ?_aff_commission c LEFT JOIN ?_aff_commission v ON\n v.record_type = 'void'\n AND c.invoice_id = v.invoice_id\n AND (c.invoice_payment_id = v.invoice_payment_id OR (c.invoice_payment_id IS NULL AND v.invoice_payment_id IS NULL))\n AND c.product_id = v.product_id\n AND c.tier=v.tier\n AND c.invoice_item_id = v.invoice_item_id\n WHERE\n c.record_type = 'commission'\n AND c.is_voided = 0\n AND v.commission_id IS NOT NULL");
         foreach ($rows as $row) {
             $comm_id = $row['comm_id'];
             $void_id = $row['void_id'];
             $comm = $this->getDi()->affCommissionTable->load($comm_id);
             $void = $this->getDi()->affCommissionTable->load($void_id);
             $comm->updateQuick('is_voided', 1);
             $void->updateQuick('commission_id_void', $comm->pk());
         }
         echo "Done<br>\n";
     }
     if (version_compare($e->getVersion(), '4.5.4') < 0) {
         echo "Switch empty payout method with NULL...";
         if (ob_get_level()) {
             ob_end_flush();
         }
         $this->getDi()->db->query("UPDATE ?_user SET aff_payout_type=NULL WHERE aff_payout_type=?", '');
         echo "Done<br>\n";
     }
 }
コード例 #2
0
ファイル: Bootstrap.php プロジェクト: grlf/eyedock
 function onDbUpgrade(Am_Event $e)
 {
     if (version_compare($e->getVersion(), '4.2.16') < 0) {
         $nDir = opendir(ROOT_DIR . '/data/');
         $baseDir = ROOT_DIR . '/data/';
         while (false !== ($file = readdir($nDir))) {
             if (preg_match('/^.' . self::UPLOAD_PREFIX . '.*$/', $file, $matches) && !file_exists($baseDir . 'public/' . $matches[0] . ".png")) {
                 if (!@copy($baseDir . $matches[0], $baseDir . 'public/' . $matches[0] . ".png")) {
                     echo sprintf('<span style="color:red">Could not copy file [%s] to [%s]. Please, copy and rename manually.</span><br />', $baseDir . $matches[0], $baseDir . 'public/' . $matches[0] . ".png");
                 }
             }
         }
         closedir($nDir);
         $this->getDi()->db->query("\n                UPDATE ?_product\n                SET img_path = CONCAT(img_path,'.png')\n                WHERE\n                    img IS NOT NULL\n                    AND img_path NOT LIKE '%.png'\n                    AND img_path NOT LIKE '%.jpg'\n                    AND img_path NOT LIKE '%.jpeg'\n                    AND img_path NOT LIKE '%.gif'\n            ");
     }
 }
コード例 #3
0
ファイル: Bootstrap.php プロジェクト: alexanderTsig/arabic
 function onDbUpgrade(Am_Event $e)
 {
     if (version_compare($e->getVersion(), '4.2.20') < 0) {
         echo "Set Up Subuser profile form...";
         $this->setUpSubuserProfileFormIfNotExist($this->getDi()->db);
         echo "Done<br>\n";
     }
 }
コード例 #4
0
ファイル: Bootstrap.php プロジェクト: grlf/eyedock
 function onDbUpgrade(Am_Event $e)
 {
     if (version_compare($e->getVersion(), '4.2.20') < 0) {
         echo "Fix FAQ categories...";
         if (ob_get_level()) {
             ob_end_flush();
         }
         $this->getDi()->db->query("UPDATE ?_helpdesk_faq SET category=? WHERE category=?", null, '');
         echo "Done<br>\n";
         echo "Add default Order to Helpdesk FAQ...";
         $this->getDi()->db->query("SET @i = 0");
         $this->getDi()->db->query("UPDATE ?_helpdesk_faq SET sort_order=(@i:=@i+1)");
         echo "Done<br>\n";
         echo "Add default Order to Helpdesk Categories...";
         $this->getDi()->db->query("SET @i = 0");
         $this->getDi()->db->query("UPDATE ?_helpdesk_category SET sort_order=(@i:=@i+1)");
         echo "Done<br>\n";
     }
 }