Resource icon

XF1 Cleanup Command 1.0.0

No permission to download

XenForo

Company info
Staff member
XenForo submitted a new resource:

XF1 Cleanup Command - Moves all known legacy XF1 files to a special _legacy directory.

There are a number of files in XF1 which are no longer required or usable by XF2.

This CLI command will move any known legacy XF1 file into a specially created _legacy directory. From there, you can either archive or remove that directory.

This will not necessarily move all add-on files. It will move any files stored under the old library directory, but other files these add-ons create may still remain. You would have to contact the author of any add-on to check if...
Read more about this resource...
 

andybond

Active member
Have I missed where the documentation is for the cli command? You reference it in the overview , but not the actual implementation
 
Last edited:

Mr Lucky

Well-known member
I will be doing this manually, but I see

and the list of $dirs to learn which files/directories can be removed manually.
and I see library

Code:
$dirs = [
            'install/data',
            'install/templates',
            'js/flot',
            'js/flow.js',
            'js/jquery',
            'js/redactor',
            'js/sortable',
            'js/swfupload',
            'js/videojs',
            'js/xenforo',
            'library',
However /library/ is included with xenforo 2 upgrade
 

Chris D

XenForo developer
Staff member
It won't cause a problem. XF2 doesn't use it apart from the upgrade process where it needs to read the old config.php file.
 

Itworx4me

Well-known member
It would be awesome if you could provide something similar for the database. To compare a default database structure to your current one. Than decide if a table needs to be deleted or not. I have found that some addon leave orphaned tables after uninstall . 👍
 

Chris D

XenForo developer
Staff member
There is a CLI tool built in for this already, but you would have to seriously use it with caution as it's not exactly for this use case.

We use it, for example, to ensure that a new install XF2 database has the same schema as an upgraded from XF1 to XF2 database -- this helps us avoid mistakes in the installer/upgrade scripts.

As it's a developer tool, you'd have to enable development mode temporarily (so remove it afterwards):
PHP:
$config['development']['enabled'] = false;
And you would have to have your own database created from a clean installation for comparison.

Its usage is:
Rich (BB code):
php cmd.php xf-dev:compare-schema dbname
You would replace dbname with the empty database you want to compare your database to.

The output would be similar to this:
Code:
The following differences were found:
* REMOVE xf_rm_category
* REMOVE xf_rm_category_field
* REMOVE xf_rm_category_prefix
* REMOVE xf_rm_category_watch
* REMOVE xf_rm_resource
* REMOVE xf_rm_resource_download
* REMOVE xf_rm_resource_feature
* REMOVE xf_rm_resource_field
* REMOVE xf_rm_resource_field_value
* REMOVE xf_rm_resource_prefix
* REMOVE xf_rm_resource_prefix_group
* REMOVE xf_rm_resource_rating
* REMOVE xf_rm_resource_update
* REMOVE xf_rm_resource_version
* REMOVE xf_rm_resource_watch
* REMOVE xf_user.xfrm_resource_count
References are how to change dbname to match yourdbname.
So this comparison output is from an installation that has XFRM installed compared to a clean XF2 database that does not have XFRM installed. Now, obviously you might actually want XFRM to be installed, so you wouldn't want to be following the output it gives and removing all of your XFRM tables and columns :) So proceed with caution. And take a back up before deleting anything.
 

Itworx4me

Well-known member
There is a CLI tool built in for this already, but you would have to seriously use it with caution as it's not exactly for this use case.

We use it, for example, to ensure that a new install XF2 database has the same schema as an upgraded from XF1 to XF2 database -- this helps us avoid mistakes in the installer/upgrade scripts.

As it's a developer tool, you'd have to enable development mode temporarily (so remove it afterwards):
PHP:
$config['development']['enabled'] = false;
And you would have to have your own database created from a clean installation for comparison.

Its usage is:
Rich (BB code):
php cmd.php xf-dev:compare-schema dbname
You would replace dbname with the empty database you want to compare your database to.

The output would be similar to this:
Code:
The following differences were found:
* REMOVE xf_rm_category
* REMOVE xf_rm_category_field
* REMOVE xf_rm_category_prefix
* REMOVE xf_rm_category_watch
* REMOVE xf_rm_resource
* REMOVE xf_rm_resource_download
* REMOVE xf_rm_resource_feature
* REMOVE xf_rm_resource_field
* REMOVE xf_rm_resource_field_value
* REMOVE xf_rm_resource_prefix
* REMOVE xf_rm_resource_prefix_group
* REMOVE xf_rm_resource_rating
* REMOVE xf_rm_resource_update
* REMOVE xf_rm_resource_version
* REMOVE xf_rm_resource_watch
* REMOVE xf_user.xfrm_resource_count
References are how to change dbname to match yourdbname.
So this comparison output is from an installation that has XFRM installed compared to a clean XF2 database that does not have XFRM installed. Now, obviously you might actually want XFRM to be installed, so you wouldn't want to be following the output it gives and removing all of your XFRM tables and columns :) So proceed with caution. And take a back up before deleting anything.
Very useful @Chris D Thanks for posting. Found a lot of orphaned tables.
 

Jean-Baptiste

Formerly allewreK
Do you know why I got the following error :

Code:
php cmd.php xf:legacy-cleanup
Command "xf:legacy-cleanup" is not defined.

Did you mean one of these?
...
 
Top