install:unused_files
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
install:unused_files [2015-02-25 19:22] – Shorten Python script and make it Python3 compatible 67.241.151.78 | install:unused_files [2023-02-28 13:41] (current) – Link to new dokuwiki repo saggi | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== Removing Unused Files ===== | + | ====== Removing Unused Files ====== |
- | When a new DokuWiki version is released, some of the files that were needed previously may become obsolete. Keeping | + | When a new DokuWiki version is released, some of the files that were needed previously may become obsolete. |
+ | |||
+ | Keeping | ||
+ | |||
+ | * Misleading error messages related to outdated plugins. | ||
+ | * They pose a security risk. | ||
+ | * They could break later installations. | ||
+ | |||
+ | So we recommend to delete them. | ||
A list of all files that were removed in recent releases can be found in '' | A list of all files that were removed in recent releases can be found in '' | ||
- | You can also see the current list at https:// | + | You can also see the current list at https:// |
- | ==== Using RemoveOld Plugin ==== | + | :!: Important: The list of files is case-sensitive. On case-insensitive file systems((Case-insensitive file systems are, under some circumstances: |
- | To remove old files from DokuWiki' | + | ===== Using a Plugin ===== |
- | ==== Using a Script ==== | + | |
+ | When upgrading your wiki using the [[plugin: | ||
+ | |||
+ | Alternatively | ||
+ | |||
+ | ===== Using a Script | ||
People with shell access to their server can use a script to automatically delete all old files. | People with shell access to their server can use a script to automatically delete all old files. | ||
- | === Linux Shell === | + | ==== Linux Shell ==== |
This simple line should work on any Linux system | This simple line should work on any Linux system | ||
Line 22: | Line 35: | ||
</ | </ | ||
- | === *nix Shell === | + | ==== *nix Shell ==== |
Some systems may not support the "rm -d" option for directory removal. In that case, you have to use recursive removal (just be sure to double-check that the file list does not include any paths that will delete too much): | Some systems may not support the "rm -d" option for directory removal. In that case, you have to use recursive removal (just be sure to double-check that the file list does not include any paths that will delete too much): | ||
Line 30: | Line 43: | ||
</ | </ | ||
- | === Python Script === | + | ==== Python Script |
Here's a Python script that will also print the files deleted | Here's a Python script that will also print the files deleted | ||
Line 48: | Line 61: | ||
</ | </ | ||
- | === Ruby Script === | + | Here's an alternative Python script that is case sensitive and will also delete directories included in the list |
+ | <code python> | ||
+ | import os | ||
+ | import shutil | ||
+ | |||
+ | def exists_casesensitive(path): | ||
+ | if not os.path.exists(path): | ||
+ | return False | ||
+ | directory, filename = os.path.split(path) | ||
+ | return filename in os.listdir(directory) | ||
+ | |||
+ | with open(" | ||
+ | for line in file: | ||
+ | line = line.strip() | ||
+ | if line and not line.startswith('#' | ||
+ | path = line.rstrip(os.linesep) | ||
+ | if exists_casesensitive(path): | ||
+ | if os.path.isdir(path): | ||
+ | shutil.rmtree(path) | ||
+ | print(' | ||
+ | else: | ||
+ | os.remove(path) | ||
+ | print(' | ||
+ | else: | ||
+ | # | ||
+ | pass | ||
+ | </ | ||
+ | |||
+ | ==== Ruby Script | ||
Here's a Ruby script doing the same | Here's a Ruby script doing the same | ||
Line 61: | Line 102: | ||
</ | </ | ||
- | === PHP Script === | + | ==== PHP Script |
The same for PHP: | The same for PHP: | ||
Line 84: | Line 125: | ||
</ | </ | ||
- | === Powershell Script === | + | ==== Powershell Script |
Here's a one-line powershell script doing the same | Here's a one-line powershell script doing the same | ||
Line 92: | Line 133: | ||
</ | </ | ||
- | === CMD Script === | + | ==== CMD Script |
- | Here's a one-line Windows' | + | Here's a one-line Windows' |
< | < | ||
for /F %i in (' | for /F %i in (' | ||
</ | </ |
install/unused_files.1424888566.txt.gz · Last modified: 2015-02-25 19:22 by 67.241.151.78