public static function updateShare($nodeId, $shareType) { $obs = DBUtil::executeQuery('SELECT * FROM *PREFIX*snanny_observation_model WHERE file_id = ?', array($nodeId)); while ($row = $obs->fetch()) { if ($row != null) { $shared = 1; $sharedTime = time(); if ($shareType == -1) { //When unshare we check if there is still an existing share $result = DBUtil::executeQuery('SELECT COUNT(*) as c FROM *PREFIX*share WHERE file_source = ?', array($nodeId)); $value = 0; while ($row = $result->fetch()) { $value = $row['c']; } //If there is no share then we passed the status to unshared if ($value == 0) { $shared = 0; } } //DBUpdate DBUtil::executeQuery("UPDATE *PREFIX*snanny_observation_model SET shared = {$shared}, share_updated_time = {$sharedTime} WHERE file_id=?", array($nodeId)); } } }
/** * change O&M status on deletion * @param $nodeId fileId of the node */ public function logicalDelete($nodeId) { $sql = 'UPDATE *PREFIX*snanny_system SET status = 0 WHERE file_id = :id'; DBUtil::executeQuery($sql, array(':id' => $nodeId)); }
/** * change O&M status on deletion * @param $nodeId fileId of the node */ public function logicalDelete($nodeId) { $sql = 'UPDATE *PREFIX*snanny_observation_model SET status = 0, timestamp = :timestamp WHERE file_id = :id'; DBUtil::executeQuery($sql, array(':timestamp' => time(), ':id' => $nodeId)); }
public function logicalDeleteChildren($id) { $sql = 'UPDATE *PREFIX*snanny_system_ancestors ancestor INNER JOIN *PREFIX*snanny_system syst ON syst.uuid = ancestor.parent_uuid SET ancestor.status = 0 WHERE syst.file_id = :id'; DBUtil::executeQuery($sql, array(':id' => $id)); }
public static function getFileCacheByFileId($fileid) { $result = DBUtil::executeQuery('SELECT * FROM *PREFIX*filecache WHERE fileid = :fileid', array(':fileid' => $fileid)); while ($row = $result->fetch()) { return $row; } return null; }