[TASK] Re-style record list search box
[Packages/TYPO3.CMS.git] / typo3 / sysext / lowlevel / README.rst
1 Introduction
2 ============
3
4 For various reasons your TYPO3 installation may over time accumulate data with integrity problems or data you wish
5 to delete completely. For instance, why keep old versions of published content? Keep that in your backup - don't load
6 your running website with that overhead!
7
8 Or what about deleted records? Why not flush them - they also fill up your database and filesystem and most likely you
9 can rely on your backups in case of an emergency recovery?
10
11 Also, relations between records and files inside TYPO3 may be lost over time for various reasons.
12
13 If your website runs as it should such "integrity problems" are mostly easy to automatically repair by simply removing
14 the references pointing to a missing record or file.
15
16 However, it might also be "soft references" from eg. internal links (`<a href="t3://page?id=123">...</a>`) or a file references in a
17 TypoScript template (`something.file = fileadmin/template/miss_me.jpg`) which are missing. Those cannot be automatically
18 repaired but the cleanup script incorporates warnings that will tell you about these problems if they exist and you
19 can manually fix them.
20
21 These scripts provides solutions to these problems by offering an array of tools that can analyze your TYPO3 installation
22 for various problems and in some cases offer fixes for them.
23
24
25
26 Preparations
27 ============
28
29 THERE IS ABSOLUTELY NO WARRANTY associated with this script! It is completely on your OWN RISK that you run it.
30 It may cause accidental data loss due to software bugs or circumstances that it does not know about yet - or data
31 loss might happen due to misuse!
32
33 ALWAYS make a complete backup of your website! That means:
34
35 * Dump the complete database to an SQL file. This can usually be done from the command line like this::
36
37 mysqldump [database name] -u [database user] -p --add-drop-table > ./mywebsite.sql
38
39 * Save all files in the webroot of your site. I usually do this from the command line like this::
40
41 tar czf ./mywebsite.tgz [webroot directory of your site]
42
43 It could be a good idea to run a `myisamchk` on your database just to make sure MySQL has everything pulled together right.
44
45 Something like this will do::
46
47 myisamchk [path_to_mysql_databases]/[database_name]/*.MYI -s -r
48
49
50
51 Running the script
52 ==================
53
54 The "[base command]" is::
55
56 [typo3_site_directory]/typo3/sysext/core/bin/typo3
57
58 Try this first. If it all works out you should see a help-screen. Otherwise there will be instructions about what to do.
59
60 You can use the script entirely by following the help screens. However, through this document you get some idea about
61 the best order of events since they may affect each other.
62
63 For each of the tools in the test you can see a help screen by running::
64
65 [base command] --help [toolkey]
66
67 Example with the tool "orphan_records"::
68
69 [typo3_site_directory]/typo3/sysext/core/bin/typo3 --help cleanup:orphanrecords
70
71
72
73 Suggested order of clean up
74 ---------------------------
75
76 The suggested order below assumes that you are interested in running all these tests. Maybe you are not! So you should
77 check the description of each one and if there is any of the tests you wish not to run, just leave it out.
78
79 It kind of gets simpler that way since the complexity mostly is when you wish to run all tests successively in which
80 case there is an optimal order that ensures you don't have to run the tests all over again.
81
82 - `[base command] cleanup:orphanrecords`
83
84 - As a beginning, get all orphaned records out of the system since you probably want to. Since orphan records may
85 keep some missing relations from being detected it's a good idea to get them out immediately.
86
87 - `[base command] cleanup:multiplereferencedfiles`
88
89 - Fix any files referenced twice or more before you delete records (which could potentially delete a file that is
90 referenced by another file).
91
92 - `[base command] cleanup:deletedrecords`
93
94 - Flush deleted records. As a rule of thumb, tools that create deleted records should be run before this one so
95 the deleted records they create are also flushed (if you like to of course)
96
97 - `[base command] cleanup:missingrelations`
98
99 - Remove missing relations at this point.
100 - If you get an error like this; "\TYPO3\CMS\Core\Database\ReferenceIndex::setReferenceValue(): ERROR: No reference
101 record with hash="132ddb399c0b15593f0d95a58159439f" was found!" just run the test again until no errors occur.
102 The reason is that another fixed reference in the same record and field changed the reference index hash. Running
103 the test again will find the new hash string which will then work for you.
104
105 - `[base command] cleanup:flexforms`
106
107 - After the "deleted" tool since we cannot clean-up deleted records and to make sure nothing unimportant
108 is cleaned up.
109
110
111 Executed anytime
112 ----------------
113
114 These can be executed anytime, however you should wait till all deleted records and versions are flushed so you don't
115 waste system resources on fixing deleted records.
116
117 ::
118
119 [base command] cleanup:missingfiles
120 [base command] cleanup:lostfiles
121
122
123 Nightly reports of problems in the system
124 -----------------------------------------
125
126 If you wish to scan your TYPO3 installations for problems with a cronjob or so, a shell script that outputs a
127 report could look like this::
128
129 #!/bin/sh
130 [typo3_site_directory]/typo3/sysext/core/bin/typo3 cleanup:orphanrecords -vv --dry-run
131 [typo3_site_directory]/typo3/sysext/core/bin/typo3 cleanup:multiplereferencedfiles --update-refindex -vv --dry-run
132 [typo3_site_directory]/typo3/sysext/core/bin/typo3 cleanup:deletedrecords -v --dry-run
133 [typo3_site_directory]/typo3/sysext/core/bin/typo3 cleanup:missingrelations --update-refindex -vv --dry-run
134 [typo3_site_directory]/typo3/sysext/core/bin/typo3 cleanup:flexforms -vv --dry-run
135 [typo3_site_directory]/typo3/sysext/core/bin/typo3 cleanup:missingfiles --update-refindex -vv --dry-run
136 [typo3_site_directory]/typo3/sysext/core/bin/typo3 cleanup:lostfiles --update-refindex -vv --dry-run
137
138
139 You may wish to change the verbosity level from `-vv` to `-v` as in the case above, depending on how important
140 you consider the warnings.
141
142 The output can then be put into a logfile so the logging system can report errors.
143
144 You might also wish to disable tests like "deleted" which would report deleted records - something that might not
145 warrant a warning, frankly speaking...
146
147 Example script for checking your installation
148 ---------------------------------------------
149
150 ::
151
152 #!/bin/sh
153 ./typo3/sysext/core/bin/typo3 cleanup:orphanrecords -vv --dry-run
154 ./typo3/sysext/core/bin/typo3 cleanup:multiplereferencedfiles -vv --dry-run
155 ./typo3/sysext/core/bin/typo3 cleanup:deletedrecords -v --dry-run
156 ./typo3/sysext/core/bin/typo3 cleanup:missingrelations -vv --dry-run
157 ./typo3/sysext/core/bin/typo3 cleanup:flexforms -vv --dry-run
158 ./typo3/sysext/core/bin/typo3 cleanup:missingfiles -vv --dry-run
159 ./typo3/sysext/core/bin/typo3 cleanup:lostfiles -vv --dry-run
160
161
162 Example script for cleaning your installation
163 ---------------------------------------------
164
165 ::
166
167 #!/bin/sh
168 ./typo3/sysext/core/bin/typo3 cleanup:orphanrecords -vv
169 ./typo3/sysext/core/bin/typo3 cleanup:multiplereferencedfiles -vv --update-refindex
170 ./typo3/sysext/core/bin/typo3 cleanup:deletedrecords -v
171 ./typo3/sysext/core/bin/typo3 cleanup:missingrelations -vv --update-refindex
172 ./typo3/sysext/core/bin/typo3 cleanup:flexforms -vv
173 ./typo3/sysext/core/bin/typo3 cleanup:missingfiles --update-refindex
174 ./typo3/sysext/core/bin/typo3 cleanup:lostfiles -vv --update-refindex
175