lib/private/Tags.php
/**
	* Delete tags and tag/object relations for a user.
	*
	* For hooking up on post_deleteUser
	*
	* @param array $arguments
	*/
Delete tags and tag/object relations for a user.
For hooking up on post_deleteUser

@param array $arguments
Delete tags and tag / object relations for a user . For hooking up on post_deleteUser @param array $arguments
public static function post_deleteUser($arguments) {
		$result = null;
		try {
			$stmt = \OCP\DB::prepare('SELECT `id` FROM `' . self::TAG_TABLE . '` '
				. 'WHERE `uid` = ?');
			$result = $stmt->execute(array($arguments['uid']));
			if (\OCP\DB::isError($result)) {
				\OCP\Util::writeLog('core', __METHOD__. 'DB error: ' . \OCP\DB::getErrorMessage(), \OCP\Util::ERROR);
			}
		} catch(\Exception $e) {
			\OCP\Util::writeLog('core', __METHOD__.', exception: '.$e->getMessage(),
				\OCP\Util::ERROR);
		}
		if(!is_null($result)) {
			try {
				$stmt = \OCP\DB::prepare('DELETE FROM `' . self::RELATION_TABLE . '` '
					. 'WHERE `categoryid` = ?');
				while( $row = $result->fetchRow()) {
					try {
						$stmt->execute(array($row['id']));
					} catch(\Exception $e) {
						\OCP\Util::writeLog('core', __METHOD__.', exception: '.$e->getMessage(),
							\OCP\Util::ERROR);
					}
				}
			} catch(\Exception $e) {
				\OCP\Util::writeLog('core', __METHOD__.', exception: '.$e->getMessage(),
					\OCP\Util::ERROR);
			}
		}
		try {
			$stmt = \OCP\DB::prepare('DELETE FROM `' . self::TAG_TABLE . '` '
				. 'WHERE `uid` = ?');
			$result = $stmt->execute(array($arguments['uid']));
			if (\OCP\DB::isError($result)) {
				\OCP\Util::writeLog('core', __METHOD__. ', DB error: ' . \OCP\DB::getErrorMessage(), \OCP\Util::ERROR);
			}
		} catch(\Exception $e) {
			\OCP\Util::writeLog('core', __METHOD__ . ', exception: '
				. $e->getMessage(), \OCP\Util::ERROR);
		}
	}
public static function post_deleteUser ( $ arguments ) { $ result = null ; try { $ stmt = \ OCP \ DB :: prepare ( 'SELECT `id` FROM `' . self :: TAG_TABLE . '` ' . 'WHERE `uid` = ?' ) ; $ result = $ stmt -> execute ( array ( $ arguments [ 'uid' ] ) ) ; if ( \ OCP \ DB :: isError ( $ result ) ) { \ OCP \ Util :: writeLog ( 'core' , __METHOD__ . 'DB error: ' . \ OCP \ DB :: getErrorMessage ( ) , \ OCP \ Util :: ERROR ) ; } } catch ( \ Exception $ e ) { \ OCP \ Util :: writeLog ( 'core' , __METHOD__ . ', exception: ' . $ e -> getMessage ( ) , \ OCP \ Util :: ERROR ) ; } if ( ! is_null ( $ result ) ) { try { $ stmt = \ OCP \ DB :: prepare ( 'DELETE FROM `' . self :: RELATION_TABLE . '` ' . 'WHERE `categoryid` = ?' ) ; while ( $ row = $ result -> fetchRow ( ) ) { try { $ stmt -> execute ( array ( $ row [ 'id' ] ) ) ; } catch ( \ Exception $ e ) { \ OCP \ Util :: writeLog ( 'core' , __METHOD__ . ', exception: ' . $ e -> getMessage ( ) , \ OCP \ Util :: ERROR ) ; } } } catch ( \ Exception $ e ) { \ OCP \ Util :: writeLog ( 'core' , __METHOD__ . ', exception: ' . $ e -> getMessage ( ) , \ OCP \ Util :: ERROR ) ; } } try { $ stmt = \ OCP \ DB :: prepare ( 'DELETE FROM `' . self :: TAG_TABLE . '` ' . 'WHERE `uid` = ?' ) ; $ result = $ stmt -> execute ( array ( $ arguments [ 'uid' ] ) ) ; if ( \ OCP \ DB :: isError ( $ result ) ) { \ OCP \ Util :: writeLog ( 'core' , __METHOD__ . ', DB error: ' . \ OCP \ DB :: getErrorMessage ( ) , \ OCP \ Util :: ERROR ) ; } } catch ( \ Exception $ e ) { \ OCP \ Util :: writeLog ( 'core' , __METHOD__ . ', exception: ' . $ e -> getMessage ( ) , \ OCP \ Util :: ERROR ) ; } }
Delete tags and tag/object relations for a user.
Delete tags and tag / object relations for a user .
// Find all objectid/tagId pairs.