The Gitlab instance will be restarted on Monday April 28th at 2AM. There will be a short interruption of service.

Skip to content
Snippets Groups Projects
Commit 6cfb9419 authored by Demian Katz's avatar Demian Katz
Browse files

Added optional switch to dump suppressed IDs to file.

parent b9b02475
No related merge requests found
......@@ -59,7 +59,7 @@ $routes = [
'util/index_reserves' => 'util index_reserves [--help|-h] [-d=s] [-t=s] [-f=s]',
'util/optimize' => 'util optimize [<core>]',
'util/sitemap' => 'util sitemap',
'util/suppressed' => 'util suppressed [--help|-h] [--authorities]',
'util/suppressed' => 'util suppressed [--help|-h] [--authorities] [--outfile=s]',
'util/switch_db_hash' => 'util switch_db_hash [<newhash>] [<newkey>]',
];
......
......@@ -539,6 +539,10 @@ class UtilController extends AbstractBase
. ' Delete authority records instead of bibliographic records'
);
Console::writeLine('--help or -h => Show this message');
Console::writeLine(
'--outfile=[/path/to/file] => Write the ID list to the specified'
. ' file instead of updating Solr (optional)'
);
return $this->getFailureResponse();
}
......@@ -565,11 +569,19 @@ class UtilController extends AbstractBase
return $this->getSuccessResponse();
}
// Get Suppressed Records and Delete from index
$solr = $this->serviceLocator->get('VuFind\Solr\Writer');
$solr->deleteRecords($backend, $result);
$solr->commit($backend);
$solr->optimize($backend);
// If 'outfile' set, write the list
if ($file = $request->getParam('outfile')) {
if (!file_put_contents($file, implode("\n", $result))) {
Console::writeLine("Problem writing to $file");
return $this->getFailureResponse();
}
} else {
// Default behavior: Get Suppressed Records and Delete from index
$solr = $this->serviceLocator->get('VuFind\Solr\Writer');
$solr->deleteRecords($backend, $result);
$solr->commit($backend);
$solr->optimize($backend);
}
return $this->getSuccessResponse();
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment