Hi @asmecher,
I did the trace and the setIds comes right from the construction of the DAO class. It’s taking from the Request the journal and getting the id from there. This is the trace. So far as I see the logic of the code it’s Ok and is working.
classes/oai/ojs/JournalOAI.inc.php
39 function __construct($config) {
40 parent::__construct($config);
41
42 $this->site = Request::getSite();
43 $this->journal = Request::getJournal();
44 $this->journalId = isset($this->journal) ? $this->journal->getId() : null;
45 $this->dao = DAORegistry::getDAO('OAIDAO');
46 $this->dao->setOAI($this);
47 }
[43] $this->journalId = NULL
[44] $this->journalId = string(1) “5”
classes/oai/ojs/JournalOAI.inc.php
108 function repositoryInfo() {
109 $info = new OAIRepository();
110
111 if (isset($this->journal)) {
112 $info->repositoryName = $this->journal->getLocalizedName();
113 $info->adminEmail = $this->journal->getSetting('contactEmail');
114
115 } else {
116 $info->repositoryName = $this->site->getLocalizedTitle();
117 $info->adminEmail = $this->site->getLocalizedContactEmail();
118 }
119
120 $info->sampleIdentifier = $this->articleIdToIdentifier(1);
121 $info->earliestDatestamp = $this->dao->getEarliestDatestamp(array($this->journalId));
122
123 $info->toolkitTitle = 'Open Journal Systems';
124 $versionDao = DAORegistry::getDAO('VersionDAO');
125 $currentVersion = $versionDao->getCurrentVersion();
126 $info->toolkitVersion = $currentVersion->getVersionString();
127 $info->toolkitURL = 'http://pkp.sfu.ca/ojs/';
128
129 return $info;
130 }
[121] array($this->journalId) = array(1) { [0]=> string(1) “5” }
classes/oai/ojs/OAIDAO.inc.php
52 /**
53 * @see lib/pkp/classes/oai/PKPOAIDAO::getEarliestDatestamp()
54 */
55 function getEarliestDatestamp($setIds = array()) {
56 return parent::getEarliestDatestamp('SELECT CASE WHEN COALESCE(dot.date_deleted, a.last_modified) > i.last_modified THEN i.last_modified ELSE COALESCE(dot.date_deleted, a.last_modified) END', $setIds);
57 }
[56] $setIds = array(1) { [0]=> string(1) “5” }
/lib/pkp/classes/oai/PKPOAIDAO.inc.php
051 function getEarliestDatestamp($selectStatement, $setIds = array()) {
052 $params = $this->getOrderedRecordParams(null, $setIds);
264 function getOrderedRecordParams($dataObjectId = null, $setIds = array(), $set = null) {
265 $params = array();
266
267 if (isset($dataObjectId)) {
268 $params[] = $dataObjectId;
269 }
270
271 $notNullSetIds = array();
272 if (is_array($setIds) && !empty($setIds)) {
273 foreach($setIds as $id) {
274 // Avoid null values.
275 if (is_null($id)) continue;
276 $notNullSetIds[] = (int) $id;
277 $params[] = (int) $id;
278 }
279 }
280
281 // Add the data object id again.
282 if (isset($dataObjectId)) {
283 $params[] = $dataObjectId;
284 }
285
286 // Add the set specification, if any.
287 if (isset($set)) {
288 $params[] = $set;
289 }
290
291 // Add the set ids again, so they can be used in the tombstone JOIN part of the sql too.
292 $params = array_merge($params, $notNullSetIds);
293
294 return $params;
295 }
[264] $dataObjectId: NULL
$setIds: array(1) { [0]=> string(1) “4” }
$set: NULL
[265] $params: array(0) { }
[269] $dataObjectId: NULL
$params: array(0) { }
[271] $setIds: array(1) { [0]=> string(1) “4” }
[277] $id:4
[279] $params: array(1) { [0]=> int(4) }
$notNullSetIds: array(1) { [0]=> int(4) }
[289] $params: array(1) { [0]=> int(4) }
[294] $params: array(2) { [0]=> int(4) [1]=> int(4) }