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 [2014-01-09 05:15] – 91.8.36.67 | 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:// |
+ | |||
+ | :!: Important: The list of files is case-sensitive. On case-insensitive file systems((Case-insensitive file systems are, under some circumstances: | ||
+ | |||
+ | ===== Using a Plugin ===== | ||
+ | |||
+ | When upgrading your wiki using the [[plugin: | ||
+ | |||
+ | Alternatively the [[plugin: | ||
- | ==== Using a Script ==== | + | ===== 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 19: | 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): | ||
< | < | ||
- | grep -Ev ' | + | grep -Ev ' |
</ | </ | ||
- | === 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 33: | Line 49: | ||
<code python> | <code python> | ||
import os | import os | ||
- | file = open(" | + | for line in open(" |
- | for line in file: | + | if line.isspace() |
- | # | + | |
- | if not line.isspace() | + | |
- | if not line[0:1] =='#' | + | try: |
- | line = line.rstrip(os.linesep) | + | if os.path.exists(line): |
- | try: | + | print(' |
- | if(os.path.exists(line)): | + | os.remove(line) |
- | print(' | + | except OSError: |
- | | + | pass |
- | except OSError, err: | + | |
- | pass | + | |
</ | </ | ||
- | === 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 60: | Line 102: | ||
</ | </ | ||
- | === PHP Script === | + | ==== PHP Script |
The same for PHP: | The same for PHP: | ||
<code php> | <code php> | ||
<?php | <?php | ||
- | /* Security function, | + | /* Security function, |
- | //exit(' | + | exit(' |
$path = getcwd(); | $path = getcwd(); | ||
Line 83: | 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 91: | Line 133: | ||
</ | </ | ||
- | ==== RemoveOld Plugin | + | ==== CMD Script |
- | To remove old files from DokuWiki' | + | Here' |
+ | |||
+ | < | ||
+ | for /F %i in (' | ||
+ | </ |
install/unused_files.1389240949.txt.gz · Last modified: 2014-01-09 05:15 by 91.8.36.67