Jake B.
Well-known member
When trying to upgrade a legacy add-on to an XF2 version of that add-on I get the following message:
"The site is currently being upgraded. Please check back later."
Which no longer shows up if I navigate to any other page, but attempting to resume my upgrade shows that message again. Nothing too crazy going on in my upgrade script, the only slightly different thing that could possibly cause the issue that I can think of is:
"The site is currently being upgraded. Please check back later."
Which no longer shows up if I navigate to any other page, but attempting to resume my upgrade shows that message again. Nothing too crazy going on in my upgrade script, the only slightly different thing that could possibly cause the issue that I can think of is:
Code:
public function upgrade2000000Step5(array $stepParams)
{
$stepParams = array_replace([
'position' => 0,
], $stepParams);
$perPage = 1;
$db = $this->db();
$startTime = microtime(true);
$maxRunTime = $this->app->config('jobMaxRunTime');
$donationIds = $db->fetchAllColumn($db->limit('
SELECT donation_id FROM addm_donation
WHERE donation_id > ?
ORDER BY donation_id
', $perPage), $stepParams['position']);
if (!$donationIds) {
return true;
}
foreach ($donationIds as $donationId) {
$stepParams['position'] = $donationId;
if ($maxRunTime && microtime(true) - $startTime > $maxRunTime) {
break;
}
$legacyDonation = $db->fetchRow('
SELECT *
FROM addm_donation
WHERE donation_id = ?
', $donationId);
if (!$legacyDonation) {
continue;
}
$donation = \XF::em()->create('ThemeHouse\Donate:Donation');
$donation->forceSet('donation_id', $legacyDonation['donation_id']);
$donation->bulkSet([
'user_id' => $legacyDonation['user_id'],
'donation_date' => $legacyDonation['dateline'],
'amount' => $legacyDonation['amount'],
'message' => $legacyDonation['note'],
]);
$donation->save();
}
return $stepParams;
}