IT-Wissen/atom/atom-tools-scripts.md
2024-10-14 17:45:42 +02:00

42 lines
1.1 KiB
Markdown
Executable File

---
gitea: none
include_toc: true
---
# AtoM Tools and Scripts
## Corrupt DB
Database Integrity Tool. If AtoM DB is corrputed, use this php tool, provided by Artefactual (worked well for BIS)
- https://groups.google.com/g/ica-atom-users/c/mWPG763-seQ/m/ecTLNBT7AwAJ
- https://gist.githubusercontent.com/jraddaoui/1dd64ce1e2fa23d2be121522bac4c096/raw/6c6f427c9a0927b7432c9ce98dfa2ffe091cc491/01_wip_atom_integrity_tool.php
## Powershell Script Refcode to ID,ParentID
```
$counter = 0
$refcode_delimiter = '.'
$list = [Ordered]@{}
Import-Csv -Path .\997-ordnungssystem.csv -Delimiter "," | sort n | ForEach-Object {
$arr_id_parentid = @()
$counter++
$arr_id_parentid += $counter
$list.add($_.n, $arr_id_parentid)
}
foreach ($h in $list.GetEnumerator() ) {
$key = $h.Name
#Write-Host "key: "$key
if ($key -like '*.*') {
$s = $key.Substring(0, $key.lastIndexOf('.'))
$h.Value += $list[$s][0]
} else {
$h.Value += 'fribourg-archives-numeriques' # slug of existing place in AtoM for the top level descriptions.
}
$a = $h.Value
Write-Host ($a -join ",")
}
```