/** * @brief removes a calendar * @param integer $id * @return boolean */ public static function deleteCalendar($id) { $calendar = self::find($id); if (!self::isAllowedToDeleteCalendar($calendar)) { $sharedCalendar = OCP\Share::getItemSharedWithBySource('calendar', $id); if (!$sharedCalendar || !($sharedCalendar['permissions'] & OCP\PERMISSION_DELETE)) { throw new Exception(OC_Calendar_App::$l10n->t('You do not have the permissions to delete this calendar.')); } } $stmt = OCP\DB::prepare('DELETE FROM `*PREFIX*clndr_calendars` WHERE `id` = ?'); $stmt->execute(array($id)); $stmt = OCP\DB::prepare('DELETE FROM `*PREFIX*clndr_objects` WHERE `calendarid` = ?'); $stmt->execute(array($id)); OCP\Share::unshareAll('calendar', $id); OCP\Util::emitHook('OC_Calendar', 'deleteCalendar', $id); if (OCP\USER::isLoggedIn() and count(self::allCalendars(OCP\USER::getUser())) == 0) { self::addDefaultCalendars(OCP\USER::getUser()); } return true; }
} } } return $files; } public function getLocalFile($path) { $source = $this->getSource($path); if ($source) { $storage = OC_Filesystem::getStorage($source); return $storage->getLocalFile($this->getInternalPath($source)); } } public function touch($path, $mtime = null) { $source = $this->getSource($path); if ($source) { $storage = OC_Filesystem::getStorage($source); return $storage->touch($this->getInternalPath($source), $time); } } public static function setup() { OC_Filesystem::mount('OC_Filestorage_Shared', array('datadir' => '/' . OCP\USER::getUser() . '/files/Shared'), '/' . OCP\USER::getUser() . '/files/Shared/'); } } if (OCP\USER::isLoggedIn()) { OC_Filestorage_Shared::setup(); } else { OCP\Util::connectHook('OC_User', 'post_login', 'OC_Filestorage_Shared', 'setup'); }