forked from asmecher/pln
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#102 Reset status for deposits completed before 2025-01-23
- Loading branch information
1 parent
feb6491
commit 38e4db7
Showing
2 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
classes/migration/upgrade/I102_ResetCompletedDeposits.inc.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
/** | ||
* @file classes/migration/upgrade/I102_ResetCompletedDeposits.inc.php | ||
* | ||
* Copyright (c) 2025 Simon Fraser University | ||
* Copyright (c) 2025 John Willinsky | ||
* Distributed under the GNU GPL v3. For full terms see the file LICENSE. | ||
* | ||
* @class I102_ResetCompletedDeposits | ||
* @brief Due to an issue in the Preservation Network server, deposits completed before 2025-01-23 should have their status refreshed. | ||
*/ | ||
|
||
use Illuminate\Database\Migrations\Migration; | ||
use Illuminate\Database\Capsule\Manager as Capsule; | ||
use PKP\install\DowngradeNotSupportedException; | ||
|
||
class I102_ResetCompletedDeposits extends Migration { | ||
/** | ||
* Run the migrations. | ||
* @return void | ||
*/ | ||
public function up() { | ||
// Reset status | ||
Capsule::table('pln_deposits') | ||
// PLN_PLUGIN_DEPOSIT_STATUS_LOCKSS_AGREEMENT (128) is set | ||
->whereRaw('(status & 128) <> 0') | ||
// The preserved date is set by the plugin, and not taken from the server, so this is enough to make the query safe to be re-executed | ||
->whereDate('date_preserved', '<', new DateTimeImmutable('2025-01-23')) | ||
->update(['status' => null]); | ||
} | ||
|
||
/** | ||
* Rollback the migrations. | ||
* @return void | ||
*/ | ||
public function down() { | ||
throw new DowngradeNotSupportedException(); | ||
} | ||
} |