apps/files_sharing/lib/ExpireSharesJob.php
/**
	 * Makes the background job do its work
	 *
	 * @param array $argument unused argument
	 */
Makes the background job do its work
@param array $argument unused argument
Makes the background job do its work @param array $argument unused argument
public function run($argument) {
		$connection = \OC::$server->getDatabaseConnection();
		$logger = \OC::$server->getLogger();
		$now = new \DateTime();
		$now = $now->format('Y-m-d H:i:s');
		$qb = $connection->getQueryBuilder();
		$qb->select('id', 'file_source', 'uid_owner', 'item_type')
			->from('share')
			->where(
				$qb->expr()->andX(
					$qb->expr()->eq('share_type', $qb->expr()->literal(\OCP\Share::SHARE_TYPE_LINK)),
					$qb->expr()->lte('expiration', $qb->expr()->literal($now)),
					$qb->expr()->orX(
						$qb->expr()->eq('item_type', $qb->expr()->literal('file')),
						$qb->expr()->eq('item_type', $qb->expr()->literal('folder'))
					)
				)
			);
		$shares = $qb->execute();
		while($share = $shares->fetch()) {
			\OCP\Share::unshare($share['item_type'], $share['file_source'], \OCP\Share::SHARE_TYPE_LINK, null, $share['uid_owner']);
		}
		$shares->closeCursor();
	}
public function run ( $ argument ) { $ connection = \ OC :: $ server -> getDatabaseConnection ( ) ; $ logger = \ OC :: $ server -> getLogger ( ) ; $ now = new \ DateTime ( ) ; $ now = $ now -> format ( 'Y-m-d H:i:s' ) ; $ qb = $ connection -> getQueryBuilder ( ) ; $ qb -> select ( 'id' , 'file_source' , 'uid_owner' , 'item_type' ) -> from ( 'share' ) -> where ( $ qb -> expr ( ) -> andX ( $ qb -> expr ( ) -> eq ( 'share_type' , $ qb -> expr ( ) -> literal ( \ OCP \ Share :: SHARE_TYPE_LINK ) ) , $ qb -> expr ( ) -> lte ( 'expiration' , $ qb -> expr ( ) -> literal ( $ now ) ) , $ qb -> expr ( ) -> orX ( $ qb -> expr ( ) -> eq ( 'item_type' , $ qb -> expr ( ) -> literal ( 'file' ) ) , $ qb -> expr ( ) -> eq ( 'item_type' , $ qb -> expr ( ) -> literal ( 'folder' ) ) ) ) ) ; $ shares = $ qb -> execute ( ) ; while ( $ share = $ shares -> fetch ( ) ) { \ OCP \ Share :: unshare ( $ share [ 'item_type' ] , $ share [ 'file_source' ] , \ OCP \ Share :: SHARE_TYPE_LINK , null , $ share [ 'uid_owner' ] ) ; } $ shares -> closeCursor ( ) ; }
Makes the background job do its work
 @param array $argument unused argument
Makes the background job do its work @param array $argument unused argument
//Current time /*
		 * Expire file link shares only (for now)
		 */