/** * recursively retrieves all the revisions of the file. * recurses UP the revisions path. * PRIVATE! use fs_get_revisions() above. */ function fs_get_revisions_recursive($file_id) { global $db; if ($file_id == 0) { return array(); } $sql = "SELECT * FROM ".TABLE_PREFIX."files WHERE parent_file_id=$file_id"; $result = mysql_query($sql, $db); $row = mysql_fetch_assoc($result); if (!$row) { return array(); } return array_merge(array($row), fs_get_revisions_recursive($row['file_id'])); }
/** * recursively retrieves all the revisions of the file. * recurses UP the revisions path. * PRIVATE! use fs_get_revisions() above. */ function fs_get_revisions_recursive($file_id) { if ($file_id == 0) { return array(); } $sql = "SELECT * FROM %sfiles WHERE parent_file_id=%d"; $row = queryDB($sql, array(TABLE_PREFIX, $file_id), TRUE); if (count($row) == 0) { return array(); } return array_merge(array($row), fs_get_revisions_recursive($row['file_id'])); }