File tree Expand file tree Collapse file tree 2 files changed +87
-0
lines changed Expand file tree Collapse file tree 2 files changed +87
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Requirements:
4+ # - Windows Commandline
5+ # - Cygwin + curl (Intune-Client)
6+ # - Alternative: https://curl.se/windows/
7+ #
8+ # (c) 2025 Oliver Glowa (glo03) / Arvato Systems GmbH
9+ #
10+ # Ensure that $MY_SPACES is set in ~/.restapi/my.conf
11+
12+ source " $( dirname " $0 " ) " /env-restapi.sh
13+
14+ if [ " ${SPACEKEY} " = " " ]; then
15+ __availSpaces=(${MY_SPACES} quit)
16+ PS3=' Please enter your choice: '
17+ printf " \nPlease select a space:\n"
18+ select __answer in " ${__availSpaces[@]} "
19+ do
20+ case $__answer in
21+ " quit" )
22+ break
23+ ;;
24+ * ) SPACEKEY=" ${__answer} "
25+ break
26+ ;;
27+ esac
28+ done
29+ printf " \nYou have chosen space '%s'.\n" " ${SPACEKEY} "
30+ if [ " ${SPACEKEY} " = " " ]; then
31+ exit 20
32+ fi
33+ fi
Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ # Requirements:
4+ # - Windows Commandline
5+ # - Cygwin + curl (Intune-Client)
6+ # - Alternative: https://curl.se/windows/
7+ #
8+ # (c) 2024 Oliver Glowa (glo03) / Arvato Systems GmbH
9+ #
10+ # Call:
11+ # ./count-pages.sh [<SPACEKEY>|interactive menu]
12+ #
13+
14+ source ./common/env-restapi.sh
15+
16+ if [ " $1 " != " " ]; then
17+ SPACEKEY=$1
18+ else
19+ source ./common/space-choose.sh
20+ fi
21+
22+ getSpaceSize () {
23+ local __type=$1
24+ local __result=$2
25+
26+ # Get the space size
27+ local __searchUrl=" ${CONF_SEARCH_URL} ?cql=type+in+(${__type} )+AND+space=${SPACEKEY} "
28+ printf " %s\n" " ${__searchUrl} "
29+
30+ # Get the number of pages
31+ local __curlResult
32+ __curlResult=$( curl -s -H " ${CONF_AUTH} " " ${__searchUrl} " )
33+ local __spaceSize
34+ __spaceSize=$( jq -r ' .totalSize' <<< " ${__curlResult}" )
35+
36+ # Some output
37+ # printf "The space \"%s\" has %6s %s.\n" "${SPACEKEY}" "${__spaceSize}" "${__type}s.\n"
38+ eval " $__result " =" '${__spaceSize} '"
39+ }
40+
41+ getSpaceSize " page" SIZE_PAGE
42+ getSpaceSize " attachment" SIZE_ATTACHMENT
43+ getSpaceSize " blogpost" SIZE_BLOG
44+ getSpaceSize " comment" SIZE_COMMENT
45+
46+ SIZE_TOTAL=$(( SIZE_PAGE + SIZE_ATTACHMENT + SIZE_BLOG + SIZE_COMMENT))
47+
48+ # Some output
49+ printf " \n"
50+ printf " The space \" %s\" has %6s pages.\n" " ${SPACEKEY} " " ${SIZE_PAGE} "
51+ printf " The space \" %s\" has %6s attachments.\n" " ${SPACEKEY} " " ${SIZE_ATTACHMENT} "
52+ printf " The space \" %s\" has %6s blogposts.\n" " ${SPACEKEY} " " ${SIZE_BLOG} "
53+ printf " The space \" %s\" has %6s comments.\n" " ${SPACEKEY} " " ${SIZE_COMMENT} "
54+ printf " \nA total of %6s elements.\n" " ${SIZE_TOTAL} "
You can’t perform that action at this time.
0 commit comments