Artifact e38b6e743d2eb3b9da3b035886ac0cc8c311d29d:
File
src/shun.c
part of check-in
[94a93469c8]
- Clicking the "Shun" submenu does not shun immediately, but only takes
you to the page where you can click the "shun" button.
by
drh on
2008-06-02 15:01:53.
0000: 2f 2a 0a 2a 2a 20 43 6f 70 79 72 69 67 68 74 20 /*.** Copyright
0010: 28 63 29 20 32 30 30 38 20 44 2e 20 52 69 63 68 (c) 2008 D. Rich
0020: 61 72 64 20 48 69 70 70 0a 2a 2a 0a 2a 2a 20 54 ard Hipp.**.** T
0030: 68 69 73 20 70 72 6f 67 72 61 6d 20 69 73 20 66 his program is f
0040: 72 65 65 20 73 6f 66 74 77 61 72 65 3b 20 79 6f ree software; yo
0050: 75 20 63 61 6e 20 72 65 64 69 73 74 72 69 62 75 u can redistribu
0060: 74 65 20 69 74 20 61 6e 64 2f 6f 72 0a 2a 2a 20 te it and/or.**
0070: 6d 6f 64 69 66 79 20 69 74 20 75 6e 64 65 72 20 modify it under
0080: 74 68 65 20 74 65 72 6d 73 20 6f 66 20 74 68 65 the terms of the
0090: 20 47 4e 55 20 47 65 6e 65 72 61 6c 20 50 75 62 GNU General Pub
00a0: 6c 69 63 0a 2a 2a 20 4c 69 63 65 6e 73 65 20 76 lic.** License v
00b0: 65 72 73 69 6f 6e 20 32 20 61 73 20 70 75 62 6c ersion 2 as publ
00c0: 69 73 68 65 64 20 62 79 20 74 68 65 20 46 72 65 ished by the Fre
00d0: 65 20 53 6f 66 74 77 61 72 65 20 46 6f 75 6e 64 e Software Found
00e0: 61 74 69 6f 6e 2e 0a 2a 2a 0a 2a 2a 20 54 68 69 ation..**.** Thi
00f0: 73 20 70 72 6f 67 72 61 6d 20 69 73 20 64 69 73 s program is dis
0100: 74 72 69 62 75 74 65 64 20 69 6e 20 74 68 65 20 tributed in the
0110: 68 6f 70 65 20 74 68 61 74 20 69 74 20 77 69 6c hope that it wil
0120: 6c 20 62 65 20 75 73 65 66 75 6c 2c 0a 2a 2a 20 l be useful,.**
0130: 62 75 74 20 57 49 54 48 4f 55 54 20 41 4e 59 20 but WITHOUT ANY
0140: 57 41 52 52 41 4e 54 59 3b 20 77 69 74 68 6f 75 WARRANTY; withou
0150: 74 20 65 76 65 6e 20 74 68 65 20 69 6d 70 6c 69 t even the impli
0160: 65 64 20 77 61 72 72 61 6e 74 79 20 6f 66 0a 2a ed warranty of.*
0170: 2a 20 4d 45 52 43 48 41 4e 54 41 42 49 4c 49 54 * MERCHANTABILIT
0180: 59 20 6f 72 20 46 49 54 4e 45 53 53 20 46 4f 52 Y or FITNESS FOR
0190: 20 41 20 50 41 52 54 49 43 55 4c 41 52 20 50 55 A PARTICULAR PU
01a0: 52 50 4f 53 45 2e 20 20 53 65 65 20 74 68 65 20 RPOSE. See the
01b0: 47 4e 55 0a 2a 2a 20 47 65 6e 65 72 61 6c 20 50 GNU.** General P
01c0: 75 62 6c 69 63 20 4c 69 63 65 6e 73 65 20 66 6f ublic License fo
01d0: 72 20 6d 6f 72 65 20 64 65 74 61 69 6c 73 2e 0a r more details..
01e0: 2a 2a 20 0a 2a 2a 20 59 6f 75 20 73 68 6f 75 6c ** .** You shoul
01f0: 64 20 68 61 76 65 20 72 65 63 65 69 76 65 64 20 d have received
0200: 61 20 63 6f 70 79 20 6f 66 20 74 68 65 20 47 4e a copy of the GN
0210: 55 20 47 65 6e 65 72 61 6c 20 50 75 62 6c 69 63 U General Public
0220: 0a 2a 2a 20 4c 69 63 65 6e 73 65 20 61 6c 6f 6e .** License alon
0230: 67 20 77 69 74 68 20 74 68 69 73 20 6c 69 62 72 g with this libr
0240: 61 72 79 3b 20 69 66 20 6e 6f 74 2c 20 77 72 69 ary; if not, wri
0250: 74 65 20 74 6f 20 74 68 65 0a 2a 2a 20 46 72 65 te to the.** Fre
0260: 65 20 53 6f 66 74 77 61 72 65 20 46 6f 75 6e 64 e Software Found
0270: 61 74 69 6f 6e 2c 20 49 6e 63 2e 2c 20 35 39 20 ation, Inc., 59
0280: 54 65 6d 70 6c 65 20 50 6c 61 63 65 20 2d 20 53 Temple Place - S
0290: 75 69 74 65 20 33 33 30 2c 0a 2a 2a 20 42 6f 73 uite 330,.** Bos
02a0: 74 6f 6e 2c 20 4d 41 20 20 30 32 31 31 31 2d 31 ton, MA 02111-1
02b0: 33 30 37 2c 20 55 53 41 2e 0a 2a 2a 0a 2a 2a 20 307, USA..**.**
02c0: 41 75 74 68 6f 72 20 63 6f 6e 74 61 63 74 20 69 Author contact i
02d0: 6e 66 6f 72 6d 61 74 69 6f 6e 3a 0a 2a 2a 20 20 nformation:.**
02e0: 20 64 72 68 40 68 77 61 63 69 2e 63 6f 6d 0a 2a drh@hwaci.com.*
02f0: 2a 20 20 20 68 74 74 70 3a 2f 2f 77 77 77 2e 68 * http://www.h
0300: 77 61 63 69 2e 63 6f 6d 2f 64 72 68 2f 0a 2a 2a waci.com/drh/.**
0310: 0a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a .***************
0320: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0330: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0340: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0350: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a ****************
0360: 0a 2a 2a 0a 2a 2a 20 54 68 69 73 20 66 69 6c 65 .**.** This file
0370: 20 63 6f 6e 74 61 69 6e 73 20 63 6f 64 65 20 75 contains code u
0380: 73 65 64 20 74 6f 20 6d 61 6e 61 67 65 20 53 48 sed to manage SH
0390: 55 4e 20 74 61 62 6c 65 20 6f 66 20 74 68 65 20 UN table of the
03a0: 72 65 70 6f 73 69 74 6f 72 79 0a 2a 2f 0a 23 69 repository.*/.#i
03b0: 6e 63 6c 75 64 65 20 22 63 6f 6e 66 69 67 2e 68 nclude "config.h
03c0: 22 0a 23 69 6e 63 6c 75 64 65 20 22 73 68 75 6e ".#include "shun
03d0: 2e 68 22 0a 23 69 6e 63 6c 75 64 65 20 3c 61 73 .h".#include <as
03e0: 73 65 72 74 2e 68 3e 0a 0a 2f 2a 0a 2a 2a 20 52 sert.h>../*.** R
03f0: 65 74 75 72 6e 20 74 72 75 65 20 69 66 20 74 68 eturn true if th
0400: 65 20 67 69 76 65 6e 20 55 55 49 44 20 73 68 6f e given UUID sho
0410: 75 6c 64 20 62 65 20 73 68 75 6e 6e 65 64 2e 0a uld be shunned..
0420: 2a 2f 0a 69 6e 74 20 75 75 69 64 5f 69 73 5f 73 */.int uuid_is_s
0430: 68 75 6e 6e 65 64 28 63 6f 6e 73 74 20 63 68 61 hunned(const cha
0440: 72 20 2a 7a 55 75 69 64 29 7b 0a 20 20 73 74 61 r *zUuid){. sta
0450: 74 69 63 20 53 74 6d 74 20 71 3b 0a 20 20 69 6e tic Stmt q;. in
0460: 74 20 72 63 3b 0a 20 20 69 66 28 20 7a 55 75 69 t rc;. if( zUui
0470: 64 3d 3d 30 20 7c 7c 20 7a 55 75 69 64 5b 30 5d d==0 || zUuid[0]
0480: 3d 3d 30 20 29 20 72 65 74 75 72 6e 20 30 3b 0a ==0 ) return 0;.
0490: 20 20 64 62 5f 73 74 61 74 69 63 5f 70 72 65 70 db_static_prep
04a0: 61 72 65 28 26 71 2c 20 22 53 45 4c 45 43 54 20 are(&q, "SELECT
04b0: 31 20 46 52 4f 4d 20 73 68 75 6e 20 57 48 45 52 1 FROM shun WHER
04c0: 45 20 75 75 69 64 3d 3a 75 75 69 64 22 29 3b 0a E uuid=:uuid");.
04d0: 20 20 64 62 5f 62 69 6e 64 5f 74 65 78 74 28 26 db_bind_text(&
04e0: 71 2c 20 22 3a 75 75 69 64 22 2c 20 7a 55 75 69 q, ":uuid", zUui
04f0: 64 29 3b 0a 20 20 72 63 20 3d 20 64 62 5f 73 74 d);. rc = db_st
0500: 65 70 28 26 71 29 3b 0a 20 20 64 62 5f 72 65 73 ep(&q);. db_res
0510: 65 74 28 26 71 29 3b 0a 20 20 72 65 74 75 72 6e et(&q);. return
0520: 20 72 63 3d 3d 53 51 4c 49 54 45 5f 52 4f 57 3b rc==SQLITE_ROW;
0530: 0a 7d 0a 0a 2f 2a 0a 2a 2a 20 57 45 42 50 41 47 .}../*.** WEBPAG
0540: 45 3a 20 73 68 75 6e 0a 2a 2f 0a 76 6f 69 64 20 E: shun.*/.void
0550: 73 68 75 6e 5f 70 61 67 65 28 76 6f 69 64 29 7b shun_page(void){
0560: 0a 20 20 53 74 6d 74 20 71 3b 0a 20 20 69 6e 74 . Stmt q;. int
0570: 20 63 6e 74 20 3d 20 30 3b 0a 20 20 63 6f 6e 73 cnt = 0;. cons
0580: 74 20 63 68 61 72 20 2a 7a 55 75 69 64 20 3d 20 t char *zUuid =
0590: 50 28 22 75 75 69 64 22 29 3b 0a 20 20 69 6e 74 P("uuid");. int
05a0: 20 6e 55 75 69 64 3b 0a 20 20 63 68 61 72 20 7a nUuid;. char z
05b0: 43 61 6e 6f 6e 69 63 61 6c 5b 55 55 49 44 5f 53 Canonical[UUID_S
05c0: 49 5a 45 2b 31 5d 3b 0a 0a 20 20 6c 6f 67 69 6e IZE+1];.. login
05d0: 5f 63 68 65 63 6b 5f 63 72 65 64 65 6e 74 69 61 _check_credentia
05e0: 6c 73 28 29 3b 0a 20 20 69 66 28 20 21 67 2e 6f ls();. if( !g.o
05f0: 6b 41 64 6d 69 6e 20 29 7b 0a 20 20 20 20 6c 6f kAdmin ){. lo
0600: 67 69 6e 5f 6e 65 65 64 65 64 28 29 3b 0a 20 20 gin_needed();.
0610: 7d 0a 20 20 69 66 28 20 7a 55 75 69 64 20 29 7b }. if( zUuid ){
0620: 0a 20 20 20 20 6e 55 75 69 64 20 3d 20 73 74 72 . nUuid = str
0630: 6c 65 6e 28 7a 55 75 69 64 29 3b 0a 20 20 20 20 len(zUuid);.
0640: 69 66 28 20 6e 55 75 69 64 21 3d 34 30 20 7c 7c if( nUuid!=40 ||
0650: 20 21 76 61 6c 69 64 61 74 65 31 36 28 7a 55 75 !validate16(zUu
0660: 69 64 2c 20 6e 55 75 69 64 29 20 29 7b 0a 20 20 id, nUuid) ){.
0670: 20 20 20 20 7a 55 75 69 64 20 3d 20 30 3b 0a 20 zUuid = 0;.
0680: 20 20 20 7d 65 6c 73 65 7b 0a 20 20 20 20 20 20 }else{.
0690: 6d 65 6d 63 70 79 28 7a 43 61 6e 6f 6e 69 63 61 memcpy(zCanonica
06a0: 6c 2c 20 7a 55 75 69 64 2c 20 55 55 49 44 5f 53 l, zUuid, UUID_S
06b0: 49 5a 45 2b 31 29 3b 0a 20 20 20 20 20 20 63 61 IZE+1);. ca
06c0: 6e 6f 6e 69 63 61 6c 31 36 28 7a 43 61 6e 6f 6e nonical16(zCanon
06d0: 69 63 61 6c 2c 20 55 55 49 44 5f 53 49 5a 45 29 ical, UUID_SIZE)
06e0: 3b 0a 20 20 20 20 20 20 7a 55 75 69 64 20 3d 20 ;. zUuid =
06f0: 7a 43 61 6e 6f 6e 69 63 61 6c 3b 0a 20 20 20 20 zCanonical;.
0700: 7d 0a 20 20 7d 0a 20 20 73 74 79 6c 65 5f 68 65 }. }. style_he
0710: 61 64 65 72 28 22 53 68 75 6e 6e 65 64 20 41 72 ader("Shunned Ar
0720: 74 69 66 61 63 74 73 22 29 3b 0a 20 20 69 66 28 tifacts");. if(
0730: 20 7a 55 75 69 64 20 26 26 20 50 28 22 73 75 62 zUuid && P("sub
0740: 22 29 20 29 7b 0a 20 20 20 20 64 62 5f 6d 75 6c ") ){. db_mul
0750: 74 69 5f 65 78 65 63 28 22 44 45 4c 45 54 45 20 ti_exec("DELETE
0760: 46 52 4f 4d 20 73 68 75 6e 20 57 48 45 52 45 20 FROM shun WHERE
0770: 75 75 69 64 3d 27 25 73 27 22 2c 20 7a 55 75 69 uuid='%s'", zUui
0780: 64 29 3b 0a 20 20 20 20 69 66 28 20 64 62 5f 65 d);. if( db_e
0790: 78 69 73 74 73 28 22 53 45 4c 45 43 54 20 31 20 xists("SELECT 1
07a0: 46 52 4f 4d 20 62 6c 6f 62 20 57 48 45 52 45 20 FROM blob WHERE
07b0: 75 75 69 64 3d 27 25 73 27 22 2c 20 7a 55 75 69 uuid='%s'", zUui
07c0: 64 29 20 29 7b 0a 20 20 20 20 20 20 40 20 3c 70 d) ){. @ <p
07d0: 3e 3c 66 6f 6e 74 20 63 6f 6c 6f 72 3d 22 62 6c ><font color="bl
07e0: 75 65 22 3e 41 72 74 69 66 61 63 74 20 0a 20 20 ue">Artifact .
07f0: 20 20 20 20 40 20 3c 61 20 68 72 65 66 3d 22 25 @ <a href="%
0800: 73 28 67 2e 7a 42 61 73 65 55 52 4c 29 2f 61 72 s(g.zBaseURL)/ar
0810: 74 69 66 61 63 74 2f 25 73 28 7a 55 75 69 64 29 tifact/%s(zUuid)
0820: 22 3e 25 73 28 7a 55 75 69 64 29 3c 2f 61 3e 20 ">%s(zUuid)</a>
0830: 69 73 20 6e 6f 0a 20 20 20 20 20 20 40 20 6c 6f is no. @ lo
0840: 6e 67 65 72 20 62 65 69 6e 67 20 73 68 75 6e 6e nger being shunn
0850: 65 64 2e 3c 2f 66 6f 6e 74 3e 3c 2f 70 3e 0a 20 ed.</font></p>.
0860: 20 20 20 7d 65 6c 73 65 7b 0a 20 20 20 20 20 20 }else{.
0870: 40 20 3c 70 3e 3c 66 6f 6e 74 20 63 6f 6c 6f 72 @ <p><font color
0880: 3d 22 62 6c 75 65 22 3e 41 72 74 69 66 61 63 74 ="blue">Artifact
0890: 20 25 73 28 7a 55 75 69 64 29 3c 2f 61 3e 20 77 %s(zUuid)</a> w
08a0: 69 6c 6c 20 6e 6f 20 6c 6f 6e 67 65 72 0a 20 20 ill no longer.
08b0: 20 20 20 20 40 20 62 65 20 73 68 75 6e 6e 65 64 @ be shunned
08c0: 2e 20 20 42 75 74 20 69 74 20 64 6f 65 73 20 6e . But it does n
08d0: 6f 74 20 65 78 69 73 74 20 69 6e 20 74 68 65 20 ot exist in the
08e0: 72 65 70 6f 73 69 74 6f 72 79 2e 20 20 49 74 0a repository. It.
08f0: 20 20 20 20 20 20 40 20 6d 61 79 20 62 65 20 6e @ may be n
0900: 65 63 65 73 73 61 72 79 20 74 6f 20 72 65 62 75 ecessary to rebu
0910: 69 6c 64 20 74 68 65 20 72 65 70 6f 73 69 74 6f ild the reposito
0920: 72 79 20 75 73 69 6e 67 20 74 68 65 0a 20 20 20 ry using the.
0930: 20 20 20 40 20 3c 62 3e 66 6f 73 73 69 6c 20 72 @ <b>fossil r
0940: 65 62 75 69 6c 64 3c 2f 62 3e 20 63 6f 6d 6d 61 ebuild</b> comma
0950: 6e 64 2d 6c 69 6e 65 20 62 65 66 6f 72 65 20 74 nd-line before t
0960: 68 65 20 61 72 74 69 66 61 63 74 20 63 6f 6e 74 he artifact cont
0970: 65 6e 74 0a 20 20 20 20 20 20 40 20 63 61 6e 20 ent. @ can
0980: 70 75 6c 6c 65 64 20 69 6e 20 66 72 6f 6d 20 6f pulled in from o
0990: 74 68 65 72 20 72 65 73 70 6f 73 69 74 6f 72 69 ther respositori
09a0: 65 73 2e 3c 2f 66 6f 6e 74 3e 3c 2f 70 3e 0a 20 es.</font></p>.
09b0: 20 20 20 7d 0a 20 20 7d 0a 20 20 69 66 28 20 7a }. }. if( z
09c0: 55 75 69 64 20 26 26 20 50 28 22 61 64 64 22 29 Uuid && P("add")
09d0: 20 29 7b 0a 20 20 20 20 64 62 5f 6d 75 6c 74 69 ){. db_multi
09e0: 5f 65 78 65 63 28 22 49 4e 53 45 52 54 20 4f 52 _exec("INSERT OR
09f0: 20 49 47 4e 4f 52 45 20 49 4e 54 4f 20 73 68 75 IGNORE INTO shu
0a00: 6e 20 56 41 4c 55 45 53 28 27 25 73 27 29 22 2c n VALUES('%s')",
0a10: 20 7a 55 75 69 64 29 3b 0a 20 20 20 20 40 20 3c zUuid);. @ <
0a20: 70 3e 3c 66 6f 6e 74 20 63 6f 6c 6f 72 3d 22 62 p><font color="b
0a30: 6c 75 65 22 3e 41 72 74 69 66 61 63 74 0a 20 20 lue">Artifact.
0a40: 20 20 40 20 3c 61 20 68 72 65 66 3d 22 25 73 28 @ <a href="%s(
0a50: 67 2e 7a 42 61 73 65 55 52 4c 29 2f 61 72 74 69 g.zBaseURL)/arti
0a60: 66 61 63 74 2f 25 73 28 7a 55 75 69 64 29 22 3e fact/%s(zUuid)">
0a70: 25 73 28 7a 55 75 69 64 29 3c 2f 61 3e 20 68 61 %s(zUuid)</a> ha
0a80: 73 20 62 65 65 6e 0a 20 20 20 20 40 20 73 68 75 s been. @ shu
0a90: 6e 6e 65 64 2e 20 20 49 74 20 77 69 6c 6c 20 6e nned. It will n
0aa0: 6f 20 6c 6f 6e 67 65 72 20 62 65 20 70 75 73 68 o longer be push
0ab0: 65 64 2e 0a 20 20 20 20 40 20 49 74 20 77 69 6c ed.. @ It wil
0ac0: 6c 20 62 65 20 72 65 6d 6f 76 65 64 20 66 72 6f l be removed fro
0ad0: 6d 20 74 68 65 20 72 65 70 6f 73 69 74 6f 72 79 m the repository
0ae0: 20 74 68 65 20 6e 65 78 74 20 74 69 6d 65 20 74 the next time t
0af0: 68 65 20 72 65 73 70 6f 73 69 74 6f 72 79 0a 20 he respository.
0b00: 20 20 20 40 20 69 73 20 72 65 62 75 69 6c 74 20 @ is rebuilt
0b10: 75 73 69 6e 67 20 74 68 65 20 3c 62 3e 66 6f 73 using the <b>fos
0b20: 73 69 6c 20 72 65 62 75 69 6c 64 3c 2f 62 3e 20 sil rebuild</b>
0b30: 63 6f 6d 6d 61 6e 64 2d 6c 69 6e 65 3c 2f 66 6f command-line</fo
0b40: 6e 74 3e 3c 2f 70 3e 0a 20 20 7d 0a 20 20 40 20 nt></p>. }. @
0b50: 3c 70 3e 54 68 65 20 61 72 74 69 66 61 63 74 73 <p>The artifacts
0b60: 20 6c 69 73 74 65 64 20 62 65 6c 6f 77 20 68 61 listed below ha
0b70: 76 65 20 62 65 65 6e 20 73 68 75 6e 6e 65 64 20 ve been shunned
0b80: 62 79 20 74 68 69 73 20 72 65 70 6f 73 69 74 6f by this reposito
0b90: 72 79 2e 0a 20 20 40 20 54 68 69 73 20 6d 65 61 ry.. @ This mea
0ba0: 6e 73 20 74 68 61 74 20 74 68 65 20 61 72 74 69 ns that the arti
0bb0: 66 61 63 74 73 20 77 69 6c 6c 20 6e 6f 74 20 62 facts will not b
0bc0: 65 20 74 72 61 6e 73 6d 69 74 74 65 64 20 6f 6e e transmitted on
0bd0: 20 61 20 70 75 73 68 20 6e 6f 72 0a 20 20 40 20 a push nor. @
0be0: 72 65 63 69 65 76 65 64 20 6f 6e 20 61 20 70 75 recieved on a pu
0bf0: 6c 6c 2e 20 20 54 68 65 73 65 20 61 72 74 69 66 ll. These artif
0c00: 61 63 74 73 20 61 72 65 20 62 61 6e 6e 65 64 20 acts are banned
0c10: 66 72 6f 6d 20 74 68 65 20 72 65 73 70 6f 73 69 from the resposi
0c20: 74 6f 72 79 2e 3c 2f 70 3e 0a 20 20 40 20 3c 62 tory.</p>. @ <b
0c30: 6c 6f 63 6b 71 75 6f 74 65 3e 0a 20 20 64 62 5f lockquote>. db_
0c40: 70 72 65 70 61 72 65 28 26 71 2c 20 0a 20 20 20 prepare(&q, .
0c50: 20 20 22 53 45 4c 45 43 54 20 75 75 69 64 2c 20 "SELECT uuid,
0c60: 45 58 49 53 54 53 28 53 45 4c 45 43 54 20 31 20 EXISTS(SELECT 1
0c70: 46 52 4f 4d 20 62 6c 6f 62 20 57 48 45 52 45 20 FROM blob WHERE
0c80: 62 6c 6f 62 2e 75 75 69 64 3d 73 68 75 6e 2e 75 blob.uuid=shun.u
0c90: 75 69 64 29 22 0a 20 20 20 20 20 22 20 20 46 52 uid)". " FR
0ca0: 4f 4d 20 73 68 75 6e 20 4f 52 44 45 52 20 42 59 OM shun ORDER BY
0cb0: 20 75 75 69 64 22 29 3b 0a 20 20 77 68 69 6c 65 uuid");. while
0cc0: 28 20 64 62 5f 73 74 65 70 28 26 71 29 3d 3d 53 ( db_step(&q)==S
0cd0: 51 4c 49 54 45 5f 52 4f 57 20 29 7b 0a 20 20 20 QLITE_ROW ){.
0ce0: 20 63 6f 6e 73 74 20 63 68 61 72 20 2a 7a 55 75 const char *zUu
0cf0: 69 64 20 3d 20 64 62 5f 63 6f 6c 75 6d 6e 5f 74 id = db_column_t
0d00: 65 78 74 28 26 71 2c 20 30 29 3b 0a 20 20 20 20 ext(&q, 0);.
0d10: 69 6e 74 20 73 74 69 6c 6c 45 78 69 73 74 73 20 int stillExists
0d20: 3d 20 64 62 5f 63 6f 6c 75 6d 6e 5f 69 6e 74 28 = db_column_int(
0d30: 26 71 2c 20 31 29 3b 0a 20 20 20 20 63 6e 74 2b &q, 1);. cnt+
0d40: 2b 3b 0a 20 20 20 20 69 66 28 20 73 74 69 6c 6c +;. if( still
0d50: 45 78 69 73 74 73 20 29 7b 0a 20 20 20 20 20 20 Exists ){.
0d60: 40 20 3c 62 3e 3c 61 20 68 72 65 66 3d 22 25 73 @ <b><a href="%s
0d70: 28 67 2e 7a 42 61 73 65 55 52 4c 29 2f 61 72 74 (g.zBaseURL)/art
0d80: 69 66 61 63 74 2f 25 73 28 7a 55 75 69 64 29 22 ifact/%s(zUuid)"
0d90: 3e 25 73 28 7a 55 75 69 64 29 3c 2f 61 3e 3c 2f >%s(zUuid)</a></
0da0: 62 3e 3c 62 72 3e 0a 20 20 20 20 7d 65 6c 73 65 b><br>. }else
0db0: 7b 0a 20 20 20 20 20 20 40 20 3c 62 3e 25 73 28 {. @ <b>%s(
0dc0: 7a 55 75 69 64 29 3c 2f 62 3e 3c 62 72 3e 0a 20 zUuid)</b><br>.
0dd0: 20 20 20 7d 0a 20 20 7d 0a 20 20 69 66 28 20 63 }. }. if( c
0de0: 6e 74 3d 3d 30 20 29 7b 0a 20 20 20 20 40 20 3c nt==0 ){. @ <
0df0: 69 3e 6e 6f 20 61 72 74 69 66 61 63 74 73 20 61 i>no artifacts a
0e00: 72 65 20 73 68 75 6e 6e 65 64 20 6f 6e 20 74 68 re shunned on th
0e10: 69 73 20 73 65 72 76 65 72 3c 2f 69 3e 0a 20 20 is server</i>.
0e20: 7d 0a 20 20 64 62 5f 66 69 6e 61 6c 69 7a 65 28 }. db_finalize(
0e30: 26 71 29 3b 0a 20 20 40 20 3c 2f 62 6c 6f 63 6b &q);. @ </block
0e40: 71 75 6f 74 65 3e 0a 20 20 40 20 3c 68 72 3e 0a quote>. @ <hr>.
0e50: 20 20 40 20 3c 61 20 6e 61 6d 65 3d 22 61 64 64 @ <a name="add
0e60: 73 68 75 6e 22 3e 3c 2f 61 3e 0a 20 20 40 20 3c shun"></a>. @ <
0e70: 70 3e 54 6f 20 73 68 75 6e 20 61 6e 20 61 72 74 p>To shun an art
0e80: 69 66 61 63 74 2c 20 65 6e 74 65 72 20 69 74 73 ifact, enter its
0e90: 20 55 55 49 44 20 69 6e 20 74 68 65 0a 20 20 40 UUID in the. @
0ea0: 20 66 6f 6c 6c 6f 77 69 6e 67 20 62 6f 78 20 61 following box a
0eb0: 6e 64 20 70 72 65 73 73 20 74 68 65 20 22 53 68 nd press the "Sh
0ec0: 75 6e 22 20 62 75 74 74 6f 6e 2e 20 20 54 68 69 un" button. Thi
0ed0: 73 20 77 69 6c 6c 20 63 61 75 73 65 20 74 68 65 s will cause the
0ee0: 20 61 72 74 69 66 61 63 74 0a 20 20 40 20 74 6f artifact. @ to
0ef0: 20 62 65 20 72 65 6d 6f 76 65 64 20 66 72 6f 6d be removed from
0f00: 20 74 68 65 20 72 65 70 6f 73 69 74 6f 72 79 20 the repository
0f10: 61 6e 64 20 77 69 6c 6c 20 70 72 65 76 65 6e 74 and will prevent
0f20: 20 74 68 65 20 61 72 74 69 66 61 63 74 20 66 72 the artifact fr
0f30: 6f 6d 20 62 65 69 6e 67 0a 20 20 40 20 72 65 61 om being. @ rea
0f40: 64 64 65 64 20 74 6f 20 74 68 65 20 72 65 70 6f dded to the repo
0f50: 73 69 74 6f 72 79 20 62 79 20 73 75 62 73 65 71 sitory by subseq
0f60: 75 65 6e 74 20 73 79 6e 63 20 6f 70 65 72 61 74 uent sync operat
0f70: 69 6f 6e 2e 3c 2f 70 3e 0a 20 20 40 0a 20 20 40 ion.</p>. @. @
0f80: 20 3c 70 3e 57 61 72 6e 69 6e 67 3a 20 20 53 68 <p>Warning: Sh
0f90: 75 6e 6e 69 6e 67 20 73 68 6f 75 6c 64 20 6f 6e unning should on
0fa0: 6c 79 20 62 65 20 75 73 65 64 20 74 6f 20 72 65 ly be used to re
0fb0: 6d 6f 76 65 20 69 6e 61 70 70 72 6f 70 72 69 61 move inappropria
0fc0: 74 65 20 63 6f 6e 74 65 6e 74 0a 20 20 40 20 66 te content. @ f
0fd0: 72 6f 6d 20 74 68 65 20 72 65 70 6f 73 69 74 6f rom the reposito
0fe0: 72 79 2e 20 20 49 6e 61 70 70 72 6f 70 72 69 61 ry. Inappropria
0ff0: 74 65 20 63 6f 6e 74 65 6e 74 20 69 6e 63 6c 75 te content inclu
1000: 64 65 73 20 73 75 63 68 20 74 68 69 6e 67 73 20 des such things
1010: 61 73 0a 20 20 40 20 73 70 61 6d 20 61 64 64 65 as. @ spam adde
1020: 64 20 74 6f 20 57 69 6b 69 2c 20 66 69 6c 65 73 d to Wiki, files
1030: 20 74 68 61 74 20 76 69 6f 6c 61 74 65 20 63 6f that violate co
1040: 70 79 72 69 67 68 74 20 6f 72 20 70 61 74 65 6e pyright or paten
1050: 74 20 61 67 72 65 65 6d 65 6e 74 73 2c 0a 20 20 t agreements,.
1060: 40 20 6f 72 20 61 72 74 69 66 61 63 74 73 20 74 @ or artifacts t
1070: 68 61 74 20 62 79 20 64 65 73 69 67 6e 20 6f 72 hat by design or
1080: 20 61 63 63 69 64 65 6e 74 20 69 6e 74 65 72 66 accident interf
1090: 65 72 65 20 77 69 74 68 20 74 68 65 20 70 72 6f ere with the pro
10a0: 63 65 73 73 69 6e 67 0a 20 20 40 20 6f 66 20 74 cessing. @ of t
10b0: 68 65 20 72 65 70 6f 73 69 74 6f 72 79 2e 20 20 he repository.
10c0: 44 6f 20 6e 6f 74 20 73 68 75 6e 20 61 72 74 69 Do not shun arti
10d0: 66 61 63 74 73 20 6d 65 72 65 6c 79 20 74 6f 20 facts merely to
10e0: 72 65 6d 6f 76 65 20 74 68 65 6d 20 66 72 6f 6d remove them from
10f0: 0a 20 20 40 20 73 69 67 68 74 20 2d 20 73 65 74 . @ sight - set
1100: 20 74 68 65 20 22 68 69 64 64 65 6e 22 20 74 61 the "hidden" ta
1110: 67 20 6f 6e 20 73 75 63 68 20 61 72 74 69 66 61 g on such artifa
1120: 63 74 73 20 69 6e 73 74 65 61 64 2e 3c 2f 70 3e cts instead.</p>
1130: 0a 20 20 40 20 0a 20 20 40 20 3c 62 6c 6f 63 6b . @ . @ <block
1140: 71 75 6f 74 65 3e 0a 20 20 40 20 3c 66 6f 72 6d quote>. @ <form
1150: 20 6d 65 74 68 6f 64 3d 22 50 4f 53 54 22 20 61 method="POST" a
1160: 63 74 69 6f 6e 3d 22 25 73 28 67 2e 7a 42 61 73 ction="%s(g.zBas
1170: 65 55 52 4c 29 2f 25 73 28 67 2e 7a 50 61 74 68 eURL)/%s(g.zPath
1180: 29 22 3e 0a 20 20 40 20 3c 69 6e 70 75 74 20 74 )">. @ <input t
1190: 79 70 65 3d 22 74 65 78 74 22 20 6e 61 6d 65 3d ype="text" name=
11a0: 22 75 75 69 64 22 20 76 61 6c 75 65 3d 22 25 68 "uuid" value="%h
11b0: 28 50 44 28 22 73 68 75 6e 22 2c 22 22 29 29 22 (PD("shun",""))"
11c0: 20 73 69 7a 65 3d 22 35 30 22 3e 0a 20 20 40 20 size="50">. @
11d0: 3c 69 6e 70 75 74 20 74 79 70 65 3d 22 73 75 62 <input type="sub
11e0: 6d 69 74 22 20 6e 61 6d 65 3d 22 61 64 64 22 20 mit" name="add"
11f0: 76 61 6c 75 65 3d 22 53 68 75 6e 22 3e 0a 20 20 value="Shun">.
1200: 40 20 3c 2f 66 6f 72 6d 3e 0a 20 20 40 20 3c 2f @ </form>. @ </
1210: 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 20 20 40 0a blockquote>. @.
1220: 20 20 40 20 3c 70 3e 45 6e 74 65 72 20 74 68 65 @ <p>Enter the
1230: 20 55 55 49 44 20 6f 66 20 61 20 70 72 65 76 69 UUID of a previ
1240: 6f 75 73 20 73 68 75 6e 6e 65 64 20 61 72 74 69 ous shunned arti
1250: 66 61 63 74 20 74 6f 20 63 61 75 73 65 20 69 74 fact to cause it
1260: 20 74 6f 20 62 65 0a 20 20 40 20 61 63 63 65 70 to be. @ accep
1270: 74 65 64 20 61 67 61 69 6e 20 69 6e 20 74 68 65 ted again in the
1280: 20 72 65 70 6f 73 69 74 6f 72 79 2e 20 20 54 68 repository. Th
1290: 65 20 61 72 74 69 66 61 63 74 20 63 6f 6e 74 65 e artifact conte
12a0: 6e 74 20 69 73 20 6e 6f 74 0a 20 20 40 20 72 65 nt is not. @ re
12b0: 73 74 6f 72 65 64 20 62 65 63 61 75 73 65 20 74 stored because t
12c0: 68 65 20 63 6f 6e 74 65 6e 74 20 69 73 20 75 6e he content is un
12d0: 6b 6e 6f 77 6e 2e 20 20 54 68 65 20 6f 6e 6c 79 known. The only
12e0: 20 63 68 61 6e 67 65 20 69 73 20 74 68 61 74 0a change is that.
12f0: 20 20 40 20 74 68 65 20 66 6f 72 6d 65 72 6c 79 @ the formerly
1300: 20 73 68 75 6e 6e 65 64 20 61 72 74 69 66 61 63 shunned artifac
1310: 74 20 77 69 6c 6c 20 62 65 20 61 63 63 65 70 74 t will be accept
1320: 65 64 20 6f 6e 20 73 75 62 73 65 71 75 65 6e 74 ed on subsequent
1330: 20 73 79 6e 63 0a 20 20 40 20 6f 70 65 72 61 74 sync. @ operat
1340: 69 6f 6e 73 2e 3c 2f 70 3e 0a 20 20 40 0a 20 20 ions.</p>. @.
1350: 40 20 3c 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 20 @ <blockquote>.
1360: 20 40 20 3c 66 6f 72 6d 20 6d 65 74 68 6f 64 3d @ <form method=
1370: 22 50 4f 53 54 22 20 61 63 74 69 6f 6e 3d 22 25 "POST" action="%
1380: 73 28 67 2e 7a 42 61 73 65 55 52 4c 29 2f 25 73 s(g.zBaseURL)/%s
1390: 28 67 2e 7a 50 61 74 68 29 22 3e 0a 20 20 40 20 (g.zPath)">. @
13a0: 3c 69 6e 70 75 74 20 74 79 70 65 3d 22 74 65 78 <input type="tex
13b0: 74 22 20 6e 61 6d 65 3d 22 75 75 69 64 22 20 73 t" name="uuid" s
13c0: 69 7a 65 3d 22 35 30 22 3e 0a 20 20 40 20 3c 69 ize="50">. @ <i
13d0: 6e 70 75 74 20 74 79 70 65 3d 22 73 75 62 6d 69 nput type="submi
13e0: 74 22 20 6e 61 6d 65 3d 22 73 75 62 22 20 76 61 t" name="sub" va
13f0: 6c 75 65 3d 22 41 63 63 65 70 74 22 3e 0a 20 20 lue="Accept">.
1400: 40 20 3c 2f 66 6f 72 6d 3e 0a 20 20 40 20 3c 2f @ </form>. @ </
1410: 62 6c 6f 63 6b 71 75 6f 74 65 3e 0a 20 20 73 74 blockquote>. st
1420: 79 6c 65 5f 66 6f 6f 74 65 72 28 29 3b 0a 7d 0a yle_footer();.}.
1430: 0a 2f 2a 0a 2a 2a 20 52 65 6d 6f 76 65 20 66 72 ./*.** Remove fr
1440: 6f 6d 20 74 68 65 20 42 4c 4f 42 20 74 61 62 6c om the BLOB tabl
1450: 65 20 61 6c 6c 20 61 72 74 69 66 61 63 74 73 20 e all artifacts
1460: 74 68 61 74 20 61 72 65 20 69 6e 20 74 68 65 20 that are in the
1470: 53 48 55 4e 20 74 61 62 6c 65 2e 0a 2a 2f 0a 76 SHUN table..*/.v
1480: 6f 69 64 20 73 68 75 6e 5f 61 72 74 69 66 61 63 oid shun_artifac
1490: 74 73 28 76 6f 69 64 29 7b 0a 20 20 53 74 6d 74 ts(void){. Stmt
14a0: 20 71 3b 0a 20 20 64 62 5f 6d 75 6c 74 69 5f 65 q;. db_multi_e
14b0: 78 65 63 28 0a 20 20 20 20 20 22 43 52 45 41 54 xec(. "CREAT
14c0: 45 20 54 45 4d 50 20 54 41 42 4c 45 20 74 6f 73 E TEMP TABLE tos
14d0: 68 75 6e 28 72 69 64 20 49 4e 54 45 47 45 52 20 hun(rid INTEGER
14e0: 50 52 49 4d 41 52 59 20 4b 45 59 29 3b 22 0a 20 PRIMARY KEY);".
14f0: 20 20 20 20 22 49 4e 53 45 52 54 20 49 4e 54 4f "INSERT INTO
1500: 20 74 6f 73 68 75 6e 20 53 45 4c 45 43 54 20 72 toshun SELECT r
1510: 69 64 20 46 52 4f 4d 20 62 6c 6f 62 2c 20 73 68 id FROM blob, sh
1520: 75 6e 20 57 48 45 52 45 20 62 6c 6f 62 2e 75 75 un WHERE blob.uu
1530: 69 64 3d 73 68 75 6e 2e 75 75 69 64 3b 22 0a 20 id=shun.uuid;".
1540: 20 29 3b 0a 20 20 64 62 5f 70 72 65 70 61 72 65 );. db_prepare
1550: 28 26 71 2c 0a 20 20 20 20 20 22 53 45 4c 45 43 (&q,. "SELEC
1560: 54 20 72 69 64 20 46 52 4f 4d 20 64 65 6c 74 61 T rid FROM delta
1570: 20 57 48 45 52 45 20 73 72 63 69 64 20 49 4e 20 WHERE srcid IN
1580: 74 6f 73 68 75 6e 22 0a 20 20 29 3b 0a 20 20 77 toshun". );. w
1590: 68 69 6c 65 28 20 64 62 5f 73 74 65 70 28 26 71 hile( db_step(&q
15a0: 29 3d 3d 53 51 4c 49 54 45 5f 52 4f 57 20 29 7b )==SQLITE_ROW ){
15b0: 0a 20 20 20 20 69 6e 74 20 73 72 63 69 64 20 3d . int srcid =
15c0: 20 64 62 5f 63 6f 6c 75 6d 6e 5f 69 6e 74 28 26 db_column_int(&
15d0: 71 2c 20 30 29 3b 0a 20 20 20 20 63 6f 6e 74 65 q, 0);. conte
15e0: 6e 74 5f 75 6e 64 65 6c 74 61 28 73 72 63 69 64 nt_undelta(srcid
15f0: 29 3b 0a 20 20 7d 0a 20 20 64 62 5f 66 69 6e 61 );. }. db_fina
1600: 6c 69 7a 65 28 26 71 29 3b 0a 20 20 64 62 5f 6d lize(&q);. db_m
1610: 75 6c 74 69 5f 65 78 65 63 28 0a 20 20 20 20 20 ulti_exec(.
1620: 22 44 45 4c 45 54 45 20 46 52 4f 4d 20 64 65 6c "DELETE FROM del
1630: 74 61 20 57 48 45 52 45 20 72 69 64 20 49 4e 20 ta WHERE rid IN
1640: 74 6f 73 68 75 6e 3b 22 0a 20 20 20 20 20 22 44 toshun;". "D
1650: 45 4c 45 54 45 20 46 52 4f 4d 20 62 6c 6f 62 20 ELETE FROM blob
1660: 57 48 45 52 45 20 72 69 64 20 49 4e 20 74 6f 73 WHERE rid IN tos
1670: 68 75 6e 3b 22 0a 20 20 20 20 20 22 44 52 4f 50 hun;". "DROP
1680: 20 54 41 42 4c 45 20 74 6f 73 68 75 6e 3b 22 0a TABLE toshun;".
1690: 20 20 29 3b 0a 7d 0a );.}.