generated from silverstripe/silverstripe-module
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add dev task to truncate OAI Records table (#9)
* Add dev task to truncate OAI Records table * Linting
- Loading branch information
1 parent
7e3c056
commit 3cef367
Showing
2 changed files
with
32 additions
and
3 deletions.
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
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'; | ||
} | ||
|
||
} |
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