Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function storesAction()
- {
- if ($_SERVER['REQUEST_METHOD'] == 'POST') {
- $body = @file_get_contents('php://input');
- $json = json_decode($body, true);
- if (isset($json['version'])) {
- $client_cache_version = @$json['version'];
- $db = $this->getInvokeArg('bootstrap')->getPluginResource('db')->getDbAdapter();
- $sql = $db->quoteInto('SELECT * FROM stores where version_modified > ', $client_cache_version);
- $results = $db->fetchAll($sql);
- $version_sql = $db->quoteInto('SELECT max(version_modified) as version FROM stores');
- $version_results = $db->fetchAll($version_sql);
- $count = array(
- 'count' => sizeof($results)
- );
- array_push($results, $version_results['0']);
- array_push($results, $count);
- //ob_start("ob_gzhandler");
- header('HTTP/1.1 200 Stores list');
- echo json_encode($results);
- exit;
- }else {
- header('HTTP/1.1 400 Bad Request');
- exit;
- }
- }else{
- header('HTTP/1.1 400 Bad Request');
- exit;
- }
- }
Add Comment
Please, Sign In to add comment