#37: Use public database interface; fixes graupel on ownCloud 9
[grauphel.git] / controller / apicontroller.php
index 39de60d..23a47e7 100644 (file)
@@ -119,7 +119,7 @@ class ApiController extends Controller
                         'grauphel.api.user', array('username' => $username)
                     )
                 ),
-                'href' => null,//FIXME
+                'href' => null,
             );
         }
 
@@ -167,7 +167,9 @@ class ApiController extends Controller
                         'grauphel.api.notes', array('username' => $username)
                     )
                 ),
-                'href'    => null,
+                'href'    => $this->deps->urlGen->getAbsoluteURL(
+                    $this->deps->urlGen->linkToRoute('grauphel.gui.index')
+                ),
             ),
             'latest-sync-revision' => $syncdata->latestSyncRevision,
             'current-sync-guid'    => $syncdata->currentSyncGuid,
@@ -285,7 +287,8 @@ class ApiController extends Controller
         }
 
         //update
-        \OC_DB::beginTransaction();
+        $db = \OC::$server->getDatabaseConnection();
+        $db->beginTransaction();
         try {
             ++$syncdata->latestSyncRevision;
             foreach ($arPut['note-changes'] as $noteUpdate) {
@@ -304,9 +307,9 @@ class ApiController extends Controller
             }
 
             $this->notes->saveSyncData($syncdata);
-            \OC_DB::commit();
+            $db->commit();
         } catch (\DatabaseException $e) {
-            \OC_DB::getConnection()->rollBack();
+            $db->rollBack();
             throw $e;
         }
     }