NAVIGATION
This shows you the differences between two versions of the page.
|
english:technics:database:phpwcms_file:sql-commands [2009/05/12 00:17] Knut Heermann (flip-flop) |
english:technics:database:phpwcms_file:sql-commands [2018/06/03 18:09] (current) |
||
|---|---|---|---|
| Line 2: | Line 2: | ||
| ===== sql commands ===== | ===== sql commands ===== | ||
| + | ** | ||
| + | Tool:** phpMyAdmin | ||
| ==== gain ownership of all of 'em! ==== | ==== gain ownership of all of 'em! ==== | ||
| Line 9: | Line 11: | ||
| UPDATE TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, 'find this', 'replace with that'); | UPDATE TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, 'find this', 'replace with that'); | ||
| </code> | </code> | ||
| - | This will translate into (where "2" is the f_uid of the second admin e.g. and you yourself are the number "1") | + | This will translate into (where "2" is the "f_uid" of the second admin e.g. and you yourself are the number "1") |
| <code> | <code> | ||
| UPDATE phpwcms_file SET f_uid=REPLACE(f_uid, '2', '1'); | UPDATE phpwcms_file SET f_uid=REPLACE(f_uid, '2', '1'); | ||
| </code> | </code> | ||
| + | |||
| + | \\ | ||
| + | **Example 1:** \\ | ||
| + | All files and folders with an ID > 51. | ||
| + | <code sql> | ||
| + | UPDATE phpwcms_file SET f_uid = REPLACE( f_uid, '2', '1' ) WHERE f_id >51; | ||
| + | </code> | ||
| + | \\ | ||
| + | **Example 2:** \\ | ||
| + | All files and folders within the directory with the ID = 66. | ||
| + | <code sql> | ||
| + | UPDATE phpwcms_file SET f_uid = REPLACE( f_uid, '2', '1' ) WHERE f_pid =66; | ||
| + | </code> | ||
| + | |||
| + | |||
| But this is still a placeholder! Imagine, which wonderful (and terrible) things you can do with that command!\\ | But this is still a placeholder! Imagine, which wonderful (and terrible) things you can do with that command!\\ | ||
| And the result of the above? The folder of the second admin is plain empty and you are the winner 8-) | And the result of the above? The folder of the second admin is plain empty and you are the winner 8-) | ||
| Line 18: | Line 35: | ||
| ==== deleting some dirt ==== | ==== deleting some dirt ==== | ||
| - | **Old entries inside your db** | ||
| - | Often the deleted entry in BE won´t killed in DB. You can regenerate the old entries via phpMyAdmin. | + | ([[:english:technics:database:sql-commands]]) |
| - | In future please rename the purging structure level to an nonsensical name (and save) before deleting this level. | ||
| - | To throwing out all deleted entries from db, please run this snippet using phpMyAdmin in SQL: | + | Diving right into it we plainly execute the following: |
| - | === For deleted articles: === | + | <code> |
| - | + | DELETE FROM phpwcms_file WHERE f_trash=8; | |
| - | <code sql>DELETE FROM phpwcms_article WHERE article_deleted=9; | + | </code> |
| - | DELETE FROM phpwcms_articlecontent WHERE acontent_trash=9;</code> | + | |
| - | + | ||
| - | === For deleted structure names: === | + | |
| - | + | ||
| - | <code sql>DELETE FROM phpwcms_articlecat WHERE acat_trash=9;</code> | + | |
| - | + | ||
| - | === For deleted files/pictures === | + | |
| <note important> | <note important> | ||
| - | For deleted files/pictures (only after you have cleared the trash can in filemanager and doing **Admin -> remove deleted files**!!! | + | For deleted files/pictures (only after you have cleared the trash can in filemanager and doing Admin -> remove deleted files!!! |
| </note> | </note> | ||
| - | <code sql>DELETE FROM phpwcms_file WHERE f_trash=8;</code> | ||