Add database management page
[grauphel.git] / lib / notestorage.php
index c6659034e8da7d337bca551b43cf32cf126dcac6..fb6803029f780b8a00b31c8f6b54685d40daf435 100644 (file)
@@ -189,6 +189,22 @@ class NoteStorage
         \OC_DB::executeAudited($sql, $params);
     }
 
+    /**
+     * Delete synchronization data for the given user.
+     *
+     * @param SyncData $syncdata Synchronization data object
+     *
+     * @return void
+     */
+    public function deleteSyncData()
+    {
+        \OC_DB::executeAudited(
+            'DELETE FROM `*PREFIX*grauphel_syncdata`'
+            . ' WHERE `syncdata_user` = ?',
+            array($this->username)
+        );
+    }
+
     /**
      * Load a note from the storage.
      *
@@ -280,6 +296,20 @@ class NoteStorage
         );
     }
 
+    /**
+     * Delete all notes from storage.
+     *
+     * @return void
+     */
+    public function deleteAll()
+    {
+        \OC_DB::executeAudited(
+            'DELETE FROM `*PREFIX*grauphel_notes`'
+            . ' WHERE `note_user` = ?',
+            array($this->username)
+        );
+    }
+
     /**
      * Load notes for the given user in short form.
      * Optionally only those changed after $since revision