[Linpha-cvs] SF.net SVN: linpha: [4475] trunk/linpha2
Status: Inactive
Brought to you by:
bzrudi
From: <fan...@us...> - 2006-04-02 13:50:24
|
Revision: 4475 Author: fangehrn Date: 2006-04-02 06:50:15 -0700 (Sun, 02 Apr 2006) ViewCVS: http://svn.sourceforge.net/linpha/?rev=4475&view=rev Log Message: ----------- * added a reset_database.php script which reloads the table entries maybe needs to be extended to recreate all tables, but not yet.. Modified Paths: -------------- trunk/linpha2/ChangeLog Added Paths: ----------- trunk/linpha2/reset_database.php Modified: trunk/linpha2/ChangeLog =================================================================== --- trunk/linpha2/ChangeLog 2006-04-02 13:48:50 UTC (rev 4474) +++ trunk/linpha2/ChangeLog 2006-04-02 13:50:15 UTC (rev 4475) @@ -1,6 +1,8 @@ 2006-04-02 flo * added integrity check (checks album, tmp and cache folder) * updated documentation, added todo list + * added a reset_database.php script which reloads the table entries + maybe needs to be extended to recreate all tables, but not yet.. 2006-04-01 flo * update several folder paths Added: trunk/linpha2/reset_database.php =================================================================== --- trunk/linpha2/reset_database.php (rev 0) +++ trunk/linpha2/reset_database.php 2006-04-02 13:50:15 UTC (rev 4475) @@ -0,0 +1,72 @@ +<?php +if(!defined('LINPHA_DIR')) { define('LINPHA_DIR','.'); } + +include_once(LINPHA_DIR.'/lib/classes/linpha.class.php'); +$linpha = new linpha(); +$linpha->sql->startSession(); + +$_SESSION['sys_im_bracket_support'] = $GLOBALS['linpha']->sql->config->value['sys_im_bracket_support']; +$_SESSION['sys_im_use_convert'] = $GLOBALS['linpha']->sql->config->value['sys_im_use_convert']; +$_SESSION['sys_im_convert_path'] = $GLOBALS['linpha']->sql->config->value['sys_im_convert_path']; +$_SESSION['language'] = $GLOBALS['linpha']->sql->config->value['sys_lang']; +$_SESSION['album_dir'] = $GLOBALS['linpha']->sql->config->value['sys_path_album_dir']; +$_SESSION['cache_dir'] = $GLOBALS['linpha']->sql->config->value['sys_path_cache_dir']; +$_SESSION['tmp_dir'] = $GLOBALS['linpha']->sql->config->value['sys_path_tmp_dir']; + + + +echo "<br /><br />".tr("Truncate Table Data")."... "; +$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."config"); +$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."groups"); +$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."meta_category"); +$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."meta_comments"); +$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."meta_data"); +$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."meta_exif"); +$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."meta_fields"); +$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."meta_iptc"); +$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."permissions"); +$GLOBALS['linpha']->db->Execute("TRUNCATE ".PREFIX."photos"); + +echo "<br /><br />".tr("Inserting Table Data")."... "; +include_once(LINPHA_DIR.'/install/sql/sql.data.php'); +foreach($sql_queries AS $value) +{ + $result = $linpha->db->Execute($value); + if(!$result) + { + echo failed_msg(); + echo $value; + echo ' '.$linpha->db->ErrorMsg().'<br />'; + $error_nr = 1; + } +} + +function failed_msg() +{ + $str = "<font color='red'>"; + $str .= "failed"; + $str .= "</font>"; + return $str; +} + +function warning_msg() +{ + $str = "<font color='orange'>"; + $str .= "warning"; + $str .= "</font>"; + return $str; +} + +function success_msg() +{ + $str = "<font color='green'>"; + $str .= "ok"; + $str .= "</font>"; + return $str; +} + +function tr($str) +{ + return $str; +} +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |