-
Notifications
You must be signed in to change notification settings - Fork 194
Libraries JSONImport
Library | Extends | Path |
---|---|---|
JSONImport | /application/libraries/JSONImport.php |
This library handles nilai data import from JSON file.
Design goal is ability to process huge data sets regardless of their size. So instead of loading data into memory and parsing using json_decode
, we're processing input file line by line wherever possible. For that the file needs to be properly formatted. For more details about format see JSON Export.
Called automatically validates parameters passed to constructor (requires 'user_id' to be set for the user that imports the data).
Variable | Type | Default | Required | Description |
---|---|---|---|---|
$params | array | N/A | Yes | Parameters to initialize library. Currently 'user_id' is required |
Import selected file to current Nilai install, by adding all missing marks, skipping existing ones. All marks get saved for the user specified by passing 'user_id' setting while initializing the library.
Variable | Type | Default | Required | Description |
---|---|---|---|---|
$filePath | string | N/A | Yes | Path to the localy copy of the file to be imported |
Checks if uploaded file meets all required criteria - is not empty (size > 0 bytes), didn't finish in error and filetype is JSON.
Variable | Type | Default | Required | Description |
---|---|---|---|---|
$uploadedFile | array | N/A | Yes | Uploaded file data from `$_FILES` PHP array |