--
For more information about using this group, please read our Listserv Guidelines: http://islandora.ca/content/welcome-islandora-listserv
---
You received this message because you are subscribed to the Google Groups "islandora" group.
To unsubscribe from this group and stop receiving emails from it, send an email to islandora+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/islandora.
To view this discussion on the web visit https://groups.google.com/d/msgid/islandora/9c99cc08-188a-4863-be6f-069dfb38ef60%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
If you look in the includes directory of this repo you will see some code examples of how to access and manipulate fedora objects. You will also need to become familiar with the tuque API. This assumes you are comfortable working in php and have access to the repo server.
https://github.com/jyobb/islandora_management_utilities
https://wiki.duraspace.org/display/ISLANDORA712/Build,+Access,+Modify+and+Delete+Fedora+objects+with+the+Tuque+interface
On Thu, Mar 16, 2017 at 10:15 AM, antoine.y <yeeee...@gmail.com> wrote:
Hello,I need some help to find out how to update values in Islandora with a script, as I'd like to keep my data up to date (we have something like 8.000 scholars that come from an external source).Is there a way to perform a "sql like" query to update islandora objects ?For example, updating a title with the PID of an object, in sql it would be something like :UPDATE Collection1 SET mods_titleInfo_title_s = 'My New Title' WHERE PID = 'islandora:16552;'So I can have a list of input PIDs that I can process in a foreach.I have tested the module "Islandora Search and Replace", but it only allows to search a strict string and replace it with another, not to perform requests.Thanks a lot for your help.Regards
--
For more information about using this group, please read our Listserv Guidelines: http://islandora.ca/content/welcome-islandora-listserv
---
You received this message because you are subscribed to the Google Groups "islandora" group.
To unsubscribe from this group and stop receiving emails from it, send an email to islandora+...@googlegroups.com.
<?php
//Includes files and loading Drupal's functions
chdir("/var/www/drupal");
define('DRUPAL_ROOT', getcwd());
require_once './includes/bootstrap.inc';
include(DRUPAL_ROOT . '/sites/all/libraries/constants.php');
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
$statusCode = '206055';
updatePersonWithStatusCode($statusCode);
function updatePersonWithStatusCode($statusCodeInput)
{
//Solr request to get the PID of the author with "MADS_status"
$personToUpdate = FEDORA_REQUEST_URL . '/select?q=MADS_status_ms:"' . $statusCodeInput . '"' .
'&fl=PID' .
'&rows=1&wt=json';
//Curl call
$curl = curl_init($personToUpdate);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$curl_response = curl_exec($curl);
curl_close($curl);
$decodedRequest = json_decode($curl_response, true);
//Get the author's PID
$pidAuthorToUpdate = $decodedRequest['response']['docs'][0]['PID'];
//Loading islandora object
$object = islandora_object_load($pidAuthorToUpdate);
//Init repository connection
if($object)
{
$repository = $object->repository;
}
//Loading MADS from the object
$mads = simplexml_load_string($object['MADS']->content);
//Changing the email of current object
$mads->affiliation->address->email = 'new_...@example.com';
//Writing xml file
$mads->asXML('test.mads');
//Setting MADS modification in Islandora
$object['MADS']->setContentFromFile('test.mads');
}
?>