- also update solr index in EditorController.php and DoiController.php

- composer updates
This commit is contained in:
Arno Kaimbacher 2021-06-10 11:53:45 +02:00
parent 604e6ba8d7
commit d80a8ab3f4
3 changed files with 24 additions and 12 deletions

View File

@ -11,6 +11,8 @@ use App\Models\Oai\OaiModelError;
use App\Exceptions\OaiModelException;
use Illuminate\Support\Facades\View;
use App\Exceptions\GeneralException;
use App\Library\Search\SolariumAdapter;
use \Exception;
class DoiController extends Controller
{
@ -233,6 +235,12 @@ class DoiController extends Controller
// $doi['status'] = "findable";
// $doi->save();
$doi->touch();
try {
$service = new SolariumAdapter("solr", config('solarium'));
$service->addDatasetsToIndex($dataset);
} catch (Exception $e) {
$this->error(__METHOD__ . ': ' . 'Indexing document ' . $dataset->id . ' failed: ' . $e->getMessage());
}
return redirect()
->route('publish.workflow.doi.index')
->with('flash_message', 'You have successfully updated a DOI for the dataset!');

View File

@ -33,6 +33,7 @@ use App\Models\DatasetIdentifier;
use App\Models\Oai\OaiModelError;
use App\Exceptions\OaiModelException;
use App\Interfaces\DoiInterface;
use App\Library\Search\SolariumAdapter;
class EditorController extends Controller
{
@ -714,13 +715,16 @@ class EditorController extends Controller
$doi['type'] = "doi";
$doi['status'] = "findable";
if ($doi->save()) {
// touch doi (and dataset) for solr
$doi->touch();
// update server_date_modified for triggering nex xml cache (doi interface)
// $time = new \Illuminate\Support\Carbon();
// $dataset->server_date_modified = $time;
// $dataset->save();
// dataset gets automatically updated because of touches array
// touch unnecessary, save() also updates datasat modified date
// $doi->touch();
$dataset = Dataset::where('publish_id', '=', $dataId)->firstOrFail();
// add to solr
try {
$service = new SolariumAdapter("solr", config('solarium'));
$service->addDatasetsToIndex($dataset);
} catch (Exception $e) {
$this->error(__METHOD__ . ': ' . 'Indexing document ' . $dataset->id . ' failed: ' . $e->getMessage());
}
return redirect()
->route('publish.workflow.editor.index')
->with('flash_message', 'You have successfully created a DOI for the dataset!');

10
composer.lock generated
View File

@ -2200,16 +2200,16 @@
},
{
"name": "nesbot/carbon",
"version": "2.48.1",
"version": "2.49.0",
"source": {
"type": "git",
"url": "https://github.com/briannesbitt/Carbon.git",
"reference": "8d1f50f1436fb4b05e7127360483dd9c6e73da16"
"reference": "93d9db91c0235c486875d22f1e08b50bdf3e6eee"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/8d1f50f1436fb4b05e7127360483dd9c6e73da16",
"reference": "8d1f50f1436fb4b05e7127360483dd9c6e73da16",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/93d9db91c0235c486875d22f1e08b50bdf3e6eee",
"reference": "93d9db91c0235c486875d22f1e08b50bdf3e6eee",
"shasum": ""
},
"require": {
@ -2289,7 +2289,7 @@
"type": "tidelift"
}
],
"time": "2021-05-26T22:08:38+00:00"
"time": "2021-06-02T07:31:40+00:00"
},
{
"name": "nikic/php-parser",