Update cache only when there are changes

This commit is contained in:
mkuba50 2017-10-10 19:38:04 +02:00
parent 181198d077
commit 496e015611
2 changed files with 15 additions and 5 deletions

View File

@ -67,7 +67,10 @@ function uupListIds() {
'uuid' => $uuid, 'uuid' => $uuid,
); );
$builds = array_merge($builds, array($build.$arch.$title.$uuid => $temp)); $builds = array_merge(
$builds,
array($build.$arch.$title.$uuid => $temp)
);
} }
krsort($builds); krsort($builds);
@ -81,9 +84,16 @@ function uupListIds() {
consoleLogger('Done parsing database info.'); consoleLogger('Done parsing database info.');
if(!file_exists('cache')) mkdir('cache'); if($newDb != $database) {
$success = @file_put_contents('cache/fileinfo.json', json_encode($newDb)."\n"); if(!file_exists('cache')) mkdir('cache');
if(!$success) consoleLogger('Failed to update database cache.');
$success = @file_put_contents(
'cache/fileinfo.json',
json_encode($newDb)."\n"
);
if(!$success) consoleLogger('Failed to update database cache.');
}
return array( return array(
'apiVersion' => uupApiVersion(), 'apiVersion' => uupApiVersion(),

View File

@ -16,7 +16,7 @@ limitations under the License.
*/ */
function uupApiVersion() { function uupApiVersion() {
return '1.1.0'; return '1.1.1';
} }
function uupApiPrintBrand() { function uupApiPrintBrand() {