$62 GRAYBYTE WORDPRESS FILE MANAGER $29

SERVER : premium201.web-hosting.com #1 SMP Wed Mar 26 12:08:09 UTC 2025
SERVER IP : 172.67.162.162 | ADMIN IP 216.73.216.51
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/home/bravetechrwanda/itiministry.org/plugins/give/src/FormMigration/Actions/

HOME
Current File : /home/bravetechrwanda/itiministry.org/plugins/give/src/FormMigration/Actions//TransferDonations.php
<?php

namespace Give\FormMigration\Actions;

use Give\DonationForms\ValueObjects\DonationFormStatus;
use Give\Framework\Database\DB;

class TransferDonations
{
    protected $sourceId;

    public function __construct($sourceId)
    {
        $this->sourceId = $sourceId;
    }

    public static function from($sourceId): self
    {
        return new TransferDonations($sourceId);
    }

    public function to($destinationId): void
    {
        $this->__invoke($destinationId);
    }

    public function __invoke($destinationId)
    {
        DB::transaction(function() use ($destinationId) {

            // Mark the v2 form as "upgraded".
            DB::table('posts')
                ->where('ID', $this->sourceId)
                ->update(['post_status' => DonationFormStatus::UPGRADED]);

            DB::table('give_donationmeta')
                ->where('meta_key', '_give_payment_form_id')
                ->where('meta_value', $this->sourceId)
                ->update(['meta_value' => $destinationId]);

            DB::table('give_revenue')
                ->where('form_id', $this->sourceId)
                ->update(['form_id' => $destinationId]);

            // Update subscriptions to use v3 form ID
            DB::table('give_subscriptions')
                ->where('product_id', $this->sourceId)
                ->update(['product_id' => $destinationId]);

            give_update_meta(
                $destinationId,
                '_give_form_sales',
                (int)give_get_meta($this->sourceId, '_give_form_sales', true)
            );
            give_update_meta($this->sourceId, '_give_form_sales', 0);

            give_update_meta(
                $destinationId,
                '_give_form_earnings',
                (float)give_get_meta($this->sourceId, '_give_form_earnings', true)
            );
            give_update_meta($this->sourceId, '_give_form_earnings', 0);

        });
    }
}

Current_dir [ WRITEABLE ] Document_root [ NOT WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
25 May 2026 4.20 PM
bravetechrwanda / bravetechrwanda
0755
GetMigratedFormId.php
0.671 KB
16 Oct 2023 9.55 PM
bravetechrwanda / bravetechrwanda
0644
MapSettingsToDesignHeader.php
0.971 KB
16 Oct 2023 9.55 PM
bravetechrwanda / bravetechrwanda
0644
MapSettingsToDonationSummary.php
1.068 KB
16 Oct 2023 9.55 PM
bravetechrwanda / bravetechrwanda
0644
TransferDonations.php
1.893 KB
30 Oct 2025 12.17 AM
bravetechrwanda / bravetechrwanda
0644
TransferFormUrl.php
0.659 KB
16 Oct 2023 9.55 PM
bravetechrwanda / bravetechrwanda
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF Static GIF