<commit_before># Removes references to IPFS from the server, and cleans up ipfs.
# It might be worth running `sudo ipfs sh; cd /home/ipfs; gzip -c -r .ipfs >ipfsrepo.20180915.prerestore.zip` before 
# And will need to run the preseeder in /usr/local/dweb-mirror afterwards to get the popular collections back in
cd /usr/local/dweb-gateway

python3 -c '
import logging
import os
from python.config import config
from python.maintenance import resetipfs

logging.basicConfig(**config["logging"])    # For server
cachetabledomain=config["domains"]["directory"]+config["domains"]["metadataverifykey"]+"/domain"
cachetable=config["domains"]["directory"]+config["domains"]["metadataverifykey"]

print("Step 1: removing", cachetable, "which is where leafs stored - these refer to IPFS hashes for metadata")
try:
    os.remove(cachetabledomain)
except FileNotFoundError:    # Might already have been deleted
    pass
try:
    os.rmdir(cachetable)
except FileNotFoundError:    # Might already have been deleted
    pass

print("Step 2: Remove all REDIS links to IPFS hashes")
resetipfs(removeipfs=True)

print("Step 3: Clearing out IPFS repo")

'
# The sudo stuff below here isn't tested - all these commands need running as ipfs
sudo -u ipfs ipfs pin ls --type recursive -q | sudo -u ipfs xargs ipfs pin rm
sudo -u ipfs ipfs repo gc
<commit_msg>Changes made on server<commit_after># Removes references to IPFS from the server, and cleans up ipfs.
# It might be worth running `sudo ipfs sh; cd /home/ipfs; gzip -c -r .ipfs >ipfsrepo.20180915.prerestore.zip` before 
# And will need to run the preseeder in /usr/local/dweb-mirror afterwards to get the popular collections back in
cd /usr/local/dweb-gateway

python3 -c '
import logging
import os
from python.config import config
from python.maintenance import resetipfs

logging.basicConfig(**config["logging"])    # For server
cachetabledomain=config["domains"]["directory"]+config["domains"]["metadataverifykey"]+"/domain"
cachetable=config["domains"]["directory"]+config["domains"]["metadataverifykey"]

print("Step 1: removing", cachetable, "which is where leafs stored - these refer to IPFS hashes for metadata")
try:
    os.remove(cachetabledomain)
except FileNotFoundError:    # Might already have been deleted
    pass
try:
    os.rmdir(cachetable)
except FileNotFoundError:    # Might already have been deleted
    pass

print("Step 2: Remove all REDIS links to IPFS hashes")
resetipfs(removeipfs=True)

print("Step 3: Clearing out IPFS repo")

'
# The sudo stuff below here isn't tested - all these commands need running as ipfs
#sudo -u ipfs ipfs pin ls --type recursive -q | sudo -u ipfs xargs ipfs pin rm
#sudo -u ipfs ipfs repo gc

{'fraction_non_alphanumeric': 0.09683426443202979, 'fraction_numerical': 0.008938547486033519, 'mean_word_length': 4.813852813852814, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '621131', 'n_tokens_mistral': 848, 'n_tokens_neox': 813, 'n_words': 311}