Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
IoT Platform
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IoT
IoT Platform
Commits
95d25e18
Commit
95d25e18
authored
9 months ago
by
root
Browse files
Options
Downloads
Patches
Plain Diff
Fix
#14
parent
52e7566b
No related branches found
Branches containing commit
No related tags found
1 merge request
!11
Fix #14
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/get.php
+0
-2
0 additions, 2 deletions
api/get.php
bin/smartdata/SmartAPI.php
+9
-0
9 additions, 0 deletions
bin/smartdata/SmartAPI.php
with
9 additions
and
2 deletions
api/get.php
+
0
−
2
View file @
95d25e18
...
...
@@ -58,7 +58,5 @@ if ( isset( $response['headers'] ) ){
foreach
(
$response
[
'headers'
]
as
$header
)
header
(
$header
);
}
else
{
//TODO Maybe this will not be used due all queries use x-sendfile
error_log
(
"Query not using X-SendFile!"
);
echo
$response
;
}
This diff is collapsed.
Click to expand it.
bin/smartdata/SmartAPI.php
+
9
−
0
View file @
95d25e18
...
...
@@ -80,7 +80,12 @@ namespace SmartData\SmartAPI
}
if
(
$return
!=
NULL
)
{
$pos
=
0
;
$isBigQuery
=
false
;
$bigUnits
=
[
0x02240003
,
0x02230000
,
0x03020000
];
//Image, WAV, LIDAR
foreach
(
$return
[
'series'
]
as
$key
=>
$sd
)
{
//Check if the series are a "big unit"
$isBigQuery
=
in_array
(
$sd
[
'unit'
]
&
0x0FFF0000
,
$bigUnits
);
$ver
=
intval
(
$sd
[
'version'
]
);
$return
[
'series'
][
$pos
][
'version'
]
=
(
$ver
>>
4
)
.
"."
.
(
$ver
&
0x0F
);
if
(
array_key_exists
(
"SmartData"
,
$sd
))
{
...
...
@@ -95,6 +100,7 @@ namespace SmartData\SmartAPI
}
// The following lines dumps the response to a file and uses X-SendFile to notify Apache to send the response.
// this saves a lot of memory.
if
(
$isBigQuery
)
{
$file_path_for_digital_series
=
'/smartdata/tmp/'
.
microtime
(
true
)
.
'.gets'
;
file_put_contents
(
$file_path_for_digital_series
,
'{"series": ['
,
FILE_APPEND
);
foreach
(
$return
[
'series'
]
as
$key
=>
$sd
)
{
...
...
@@ -107,6 +113,9 @@ namespace SmartData\SmartAPI
$return
[
'headers'
][]
=
'X-Sendfile: '
.
$file_path_for_digital_series
;
$return
[
'headers'
][]
=
'Content-type: application/json'
;
$return
[
'headers'
][]
=
'Content-Length: '
.
(
filesize
(
$file_path_for_digital_series
)
+
1
)
;
}
else
{
$return
=
json_encode
(
$return
,
JSON_NUMERIC_CHECK
);
}
}
else
{
throw
new
RequestFailedException
(
"Error processing request: null return"
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment