PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.16.9
GiveWP – Donation Plugin and Fundraising Platform v4.16.9
4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 All 255 releases
give / src / Donations / Migrations / UnserializeTitlePrefix.php

UnserializeTitlePrefix.php in GiveWP – Donation Plugin and Fundraising Platform 4.16.9, at src/Donations/Migrations/UnserializeTitlePrefix.php

60 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Give\Donations\Migrations;
4
5 use Give\Framework\Database\DB;
6 use Give\Framework\Migrations\Contracts\Migration;
7 use Give\Helpers\Utils;
8
9 /**
10 * @since 3.17.2
11 */
12 class UnserializeTitlePrefix extends Migration
13 {
14 /**
15 * @since 3.17.2
16 */
17 public function run()
18 {
19 $items = DB::table('give_donationmeta')->where('meta_key', '_give_donor_billing_title_prefix')->getAll();
20
21 foreach ($items as $item) {
22 if (Utils::isSerialized($item->meta_value)) {
23 $unserializedTitlePrefix = Utils::safeUnserialize($item->meta_value);
24
25 DB::table('give_donationmeta')
26 ->where('donation_id', $item->donation_id)
27 ->where('meta_key', '_give_donor_billing_title_prefix')
28 ->update([
29 'meta_value' => $unserializedTitlePrefix,
30 ]);
31 }
32 }
33 }
34
35
36 /**
37 * @since 3.17.2
38 */
39 public static function id()
40 {
41 return 'donation-meta-unserialize-title-prefix';
42 }
43
44 /**
45 * @since 3.17.2
46 */
47 public static function title()
48 {
49 return 'Unserialize data in the _give_donor_billing_title_prefix meta value';
50 }
51
52 /**
53 * @since 3.17.2
54 */
55 public static function timestamp()
56 {
57 return strtotime('2024-10-23');
58 }
59 }
60