Session
in package
In-memory Common Cartridge import run: classify, record objects, append log.
Persistence is Store. Tests and the future zip walker drive this session without MySQL. Objects are not owned by one import; import_id is last-run.
Table of Contents
Properties
- $context_id : int
- $import : array<string, mixed>|null
- $logs : array<int, array<string, mixed>>
- $objects : array<int, array<string, mixed>>
- $user_id : int
- $nextImportId : int
- $nextLogId : int
- $nextObjectId : int
Methods
- __construct() : mixed
- begin() : array<string, mixed>
- consider() : Decision
- Classify one incoming resource against objects already in this course.
- error() : array<string, mixed>
- finish() : array<string, mixed>
- forget() : bool
- Local delete: drop the origin row so the original can import as new.
- markDiverged() : bool
- Local edit: this object no longer blocks re-import of the original.
- markDivergedByLocal() : bool
- record() : array<string, mixed>
- Persist the decision: log it, and create a cc_object for new/copy.
- recount() : array<string, int>
- addObject() : array<string, mixed>
- appendLog() : array<string, mixed>
- defaultStatus() : string
- metaString() : string
- now() : string
- replaceObject() : mixed
- requireRunning() : mixed
Properties
$context_id
public
int
$context_id
$import
public
array<string, mixed>|null
$import
= null
Current cc_import row
$logs
public
array<int, array<string, mixed>>
$logs
= array()
$objects
public
array<int, array<string, mixed>>
$objects
= array()
Course-local cc_object rows
$user_id
public
int
$user_id
$nextImportId
private
int
$nextImportId
= 1
$nextLogId
private
int
$nextLogId
= 1
$nextObjectId
private
int
$nextObjectId
= 1
Methods
__construct()
public
__construct(int $context_id[, int $user_id = 0 ][, array<int, array<string, mixed>> $existingObjects = array() ]) : mixed
Parameters
- $context_id : int
- $user_id : int = 0
- $existingObjects : array<int, array<string, mixed>> = array()
begin()
public
begin([array<string, mixed> $meta = array() ]) : array<string, mixed>
Parameters
- $meta : array<string, mixed> = array()
-
filename, title, manifest_identifier, cc_version, zip_sha256
Return values
array<string, mixed>consider()
Classify one incoming resource against objects already in this course.
public
consider(string $resourceIdentifier, string $resourceType, string $contentHash[, array<string, mixed> $extra = array() ]) : Decision
Parameters
- $resourceIdentifier : string
- $resourceType : string
- $contentHash : string
- $extra : array<string, mixed> = array()
-
title, item_identifier, identifiers
Return values
Decisionerror()
public
error(string $message[, array<string, mixed> $extra = array() ]) : array<string, mixed>
Parameters
- $message : string
- $extra : array<string, mixed> = array()
Return values
array<string, mixed>finish()
public
finish([string|null $status = null ]) : array<string, mixed>
Parameters
- $status : string|null = null
Return values
array<string, mixed>forget()
Local delete: drop the origin row so the original can import as new.
public
forget(int $object_id) : bool
Parameters
- $object_id : int
Return values
boolmarkDiverged()
Local edit: this object no longer blocks re-import of the original.
public
markDiverged(int $object_id) : bool
Parameters
- $object_id : int
Return values
boolmarkDivergedByLocal()
public
markDivergedByLocal(string $localKind, int $localId) : bool
Parameters
- $localKind : string
- $localId : int
Return values
boolrecord()
Persist the decision: log it, and create a cc_object for new/copy.
public
record(Decision $d[, string|null $localKind = null ][, int|null $localId = null ][, string|null $localKey = null ]) : array<string, mixed>
Parameters
- $d : Decision
- $localKind : string|null = null
- $localId : int|null = null
- $localKey : string|null = null
Return values
array<string, mixed> —The log row
recount()
public
recount() : array<string, int>
Return values
array<string, int>addObject()
private
addObject(Decision $d, string|null $localKind, int|null $localId, string|null $localKey) : array<string, mixed>
Parameters
- $d : Decision
- $localKind : string|null
- $localId : int|null
- $localKey : string|null
Return values
array<string, mixed>appendLog()
private
appendLog(string $action, Decision $d, string|null $localKind, int|null $localId, int|null $objectId, string|null $message) : array<string, mixed>
Parameters
- $action : string
- $d : Decision
- $localKind : string|null
- $localId : int|null
- $objectId : int|null
- $message : string|null
Return values
array<string, mixed>defaultStatus()
private
defaultStatus() : string
Return values
stringmetaString()
private
static metaString(array<string, mixed> $meta, string $key) : string
Parameters
- $meta : array<string, mixed>
- $key : string
Return values
stringnow()
private
static now() : string
Return values
stringreplaceObject()
private
replaceObject(array<string, mixed> $object) : mixed
Parameters
- $object : array<string, mixed>
requireRunning()
private
requireRunning() : mixed