Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-05-08 07:44:45

jpdupont
Member
Registered: 2004-10-01
Posts: 752

Reset a new txp install

Each time I install TXP, I do the same stuff :
- Remove the demo site contents
- Remove empty the page/form/css contents

I create the script above to completely reset a fresh txp install . (Remove all the forms/pages/sections but the default one, and empty the defaults)

<?php
	if (!defined('txpath'))
		define("txpath", dirname(__FILE__).'/textpattern');
	include txpath.'/config.php';
	include txpath.'/lib/constants.php';
	include txpath.'/lib/txplib_misc.php';
	include txpath.'/lib/txplib_db.php';
	include txpath.'/lib/txplib_forms.php';
	include txpath.'/lib/txplib_html.php';
		// empty tables  
	safe_delete('textpattern','1=1');
	safe_delete('txp_image','1=1');
	safe_delete('txp_link','1=1');
	safe_delete('txp_discuss','1=1');
		// delete records  
	safe_delete('txp_category','name<>\'root\'');
	safe_delete('txp_section','name<>\'default\'');
	safe_delete('txp_form','name<>\'default\'');
	safe_delete('txp_page','name=\'archive\'');
		// empty fields
	safe_update('txp_css','css=\'\'','name=\'default\'');
	safe_update('txp_form','Form=\'\'','name=\'default\'');
	safe_update('txp_page','user_html=\'\'','name=\'default\'');
	safe_update('txp_page','user_html=\'\'','name=\'error_default\'');
?>

Works as expected … if I run the script 2 times !

(After first run some forms are not deteted and the error_default page is not emptied. At second run, all is ok.)

Any idea ? Move some lines at an other position ?

Last edited by jpdupont (2010-05-08 07:58:42)

Offline

#2 2010-05-08 16:48:46

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Reset a new txp install

jpdupont wrote:

Any idea ? Move some lines at an other position ?

Remember that the setup does not install updates. Updating is done during first login.

Offline

Board footer

Powered by FluxBB