Skip to content

Commit

Permalink
Add dev task to truncate OAI Records table (#9)
Browse files Browse the repository at this point in the history
* Add dev task to truncate OAI Records table

* Linting
  • Loading branch information
chrispenny authored Mar 29, 2022
1 parent 7e3c056 commit 3cef367
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
29 changes: 29 additions & 0 deletions src/Tasks/OaiRecordsDeleteAll.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

namespace Terraformers\OpenArchive\Tasks;

use SilverStripe\Control\HTTPRequest;
use SilverStripe\Dev\BuildTask;
use SilverStripe\ORM\DB;
use Terraformers\OpenArchive\Models\OaiRecord;

class OaiRecordsDeleteAll extends BuildTask
{

private static $segment = 'oai-records-delete-all'; // phpcs:ignore

protected $title = 'OAI Records - Delete All'; // phpcs:ignore

protected $description = 'Truncate the OaiRecord table'; // phpcs:ignore

/**
* @param HTTPRequest $request
*/
public function run($request) // phpcs:ignore
{
DB::query(sprintf('truncate table %s', OaiRecord::config()->get('table_name')));

echo 'Truncated OAI Records table';
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
use Terraformers\OpenArchive\Jobs\OaiRecordUpdateJob;
use Terraformers\OpenArchive\Models\OaiRecord;

class UpdateOaiRecords extends BuildTask
class OaiRecordsUpdateExisting extends BuildTask
{

private static $segment = 'update-oai-records'; // phpcs:ignore
private static $segment = 'oai-records-update-existing'; // phpcs:ignore

protected $title = 'Update OAI Records'; // phpcs:ignore
protected $title = 'OAI Records - Update Existing'; // phpcs:ignore

protected $description = 'Queue update jobs for all existing OAI Records'; // phpcs:ignore

Expand Down

0 comments on commit 3cef367

Please sign in to comment.