- 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 App\Exceptions\OaiModelException;
use Illuminate\Support\Facades\View; use Illuminate\Support\Facades\View;
use App\Exceptions\GeneralException; use App\Exceptions\GeneralException;
use App\Library\Search\SolariumAdapter;
use \Exception;
class DoiController extends Controller class DoiController extends Controller
{ {
@ -233,6 +235,12 @@ class DoiController extends Controller
// $doi['status'] = "findable"; // $doi['status'] = "findable";
// $doi->save(); // $doi->save();
$doi->touch(); $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() return redirect()
->route('publish.workflow.doi.index') ->route('publish.workflow.doi.index')
->with('flash_message', 'You have successfully updated a DOI for the dataset!'); ->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\Models\Oai\OaiModelError;
use App\Exceptions\OaiModelException; use App\Exceptions\OaiModelException;
use App\Interfaces\DoiInterface; use App\Interfaces\DoiInterface;
use App\Library\Search\SolariumAdapter;
class EditorController extends Controller class EditorController extends Controller
{ {
@ -714,13 +715,16 @@ class EditorController extends Controller
$doi['type'] = "doi"; $doi['type'] = "doi";
$doi['status'] = "findable"; $doi['status'] = "findable";
if ($doi->save()) { if ($doi->save()) {
// touch doi (and dataset) for solr // touch unnecessary, save() also updates datasat modified date
$doi->touch(); // $doi->touch();
// update server_date_modified for triggering nex xml cache (doi interface) $dataset = Dataset::where('publish_id', '=', $dataId)->firstOrFail();
// $time = new \Illuminate\Support\Carbon(); // add to solr
// $dataset->server_date_modified = $time; try {
// $dataset->save(); $service = new SolariumAdapter("solr", config('solarium'));
// dataset gets automatically updated because of touches array $service->addDatasetsToIndex($dataset);
} catch (Exception $e) {
$this->error(__METHOD__ . ': ' . 'Indexing document ' . $dataset->id . ' failed: ' . $e->getMessage());
}
return redirect() return redirect()
->route('publish.workflow.editor.index') ->route('publish.workflow.editor.index')
->with('flash_message', 'You have successfully created a DOI for the dataset!'); ->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", "name": "nesbot/carbon",
"version": "2.48.1", "version": "2.49.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/briannesbitt/Carbon.git", "url": "https://github.com/briannesbitt/Carbon.git",
"reference": "8d1f50f1436fb4b05e7127360483dd9c6e73da16" "reference": "93d9db91c0235c486875d22f1e08b50bdf3e6eee"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/8d1f50f1436fb4b05e7127360483dd9c6e73da16", "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/93d9db91c0235c486875d22f1e08b50bdf3e6eee",
"reference": "8d1f50f1436fb4b05e7127360483dd9c6e73da16", "reference": "93d9db91c0235c486875d22f1e08b50bdf3e6eee",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -2289,7 +2289,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2021-05-26T22:08:38+00:00" "time": "2021-06-02T07:31:40+00:00"
}, },
{ {
"name": "nikic/php-parser", "name": "nikic/php-parser",