XF1 Cleanup Command

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...
 
Have I missed where the documentation is for the cli command? You reference it in the overview , but not the actual implementation
 
Last edited:
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
 
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.
 
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 . 👍
 
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.
 
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.
 
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?
...
 
Hi all,
I am performing tests of upgrades from XF1.5 to XF2.1 Beta.
Can I use this add on safely on XF2.1?
Thanks
David
 
Is there a way to identify all files that are not being used (i.e. outside the addons) basically I want to clear the whole server apart from the upgraded xenforo, there's files left on the server from vBulletin days in 2012.
 
I get this error when running the command:

Code:
X-Powered-By: PHP/4.4.9
Content-type: text/html

<br />
<b>Warning</b>:  Unexpected character in input:  '\' (ASCII=92) state=1 in <b>/***/cmd.php</b> on line <b>14</b><br />
<br />
<b>Warning</b>:  Unexpected character in input:  '\' (ASCII=92) state=1 in <b>/***/cmd.php</b> on line <b>14</b><br />
<br />
<b>Parse error</b>:  syntax error, unexpected T_STRING in <b>/***/cmd.php</b> on line <b>14</b><br />

What's the problem?
 
Last edited:
Top Bottom