<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[FrontAccounting forum — Renaming Backup File Feature Mod]]></title>
		<link>https://frontaccounting.com/punbb/viewtopic.php?id=5399</link>
		<atom:link href="https://frontaccounting.com/punbb/extern.php?action=feed&amp;tid=5399&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Renaming Backup File Feature Mod.]]></description>
		<lastBuildDate>Mon, 22 Dec 2014 21:52:55 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Renaming Backup File Feature Mod]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=21855#p21855</link>
			<description><![CDATA[<p>Additional mods are now available to execute system shell commands.<br />View the <a href="https://github.com/apmuthu/frontaccounting/commit/0c4ba9979a97122392b095833f58cb634f05cc65">commit</a>.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Mon, 22 Dec 2014 21:52:55 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=21855#p21855</guid>
		</item>
		<item>
			<title><![CDATA[Re: Renaming Backup File Feature Mod]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=21847#p21847</link>
			<description><![CDATA[<p>A set of screenshots for this feature are now in <a href="https://github.com/apmuthu/frontaccounting/wiki/FA-Backup-Rename-Screenshots">my FA Support Wiki</a>.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Sun, 21 Dec 2014 18:11:38 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=21847#p21847</guid>
		</item>
		<item>
			<title><![CDATA[Re: Renaming Backup File Feature Mod]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=21827#p21827</link>
			<description><![CDATA[<p>Actually, I was testing out various means of directly populating the database with suppliers data when I needed to rollback several times to different snapshots. The standard naming feature has just the database name, table prefix and date and time (hh:mm only). Twice, when backups were done within the same integral minute, the old one was overwritten.</p><p>Also providing some sort of a suffix to the file name part (not the extension) would be human readable. </p><p>We can use several linux and dos commands to achieve the same but when done within the Web UI it seemed cool and useful. Many times we may have the same named file from different VPSes which auto synch to a single folder with similar names and even if the date and time portions are different, the files are easy to get confused with one another. </p><p>It also helps avoid having to give FTP and shell / SSH access to the end user.</p><p>QED.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Sat, 20 Dec 2014 16:55:29 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=21827#p21827</guid>
		</item>
		<item>
			<title><![CDATA[Re: Renaming Backup File Feature Mod]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=21824#p21824</link>
			<description><![CDATA[<p>Could you explain me what is case use of the proposed feature?<br />You can (and should) always name the uploaded file properly, so why we should complicate the application interface with this additional option here? Using&nbsp; &#039;mv&#039; command or &#039;Rename&#039; option in your windowed OS is quite easy.</p><p>Janusz</p>]]></description>
			<author><![CDATA[null@example.com (itronics)]]></author>
			<pubDate>Sat, 20 Dec 2014 15:48:32 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=21824#p21824</guid>
		</item>
		<item>
			<title><![CDATA[Re: Renaming Backup File Feature Mod]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=21822#p21822</link>
			<description><![CDATA[<p>Screenshot of the new functionality is attached. The New file name needs to be entered into the <strong>comments</strong> section of the Create Backup Column.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Sat, 20 Dec 2014 10:52:04 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=21822#p21822</guid>
		</item>
		<item>
			<title><![CDATA[Renaming Backup File Feature Mod]]></title>
			<link>https://frontaccounting.com/punbb/viewtopic.php?pid=21821#p21821</link>
			<description><![CDATA[<p>I have just made a modification of the <strong>admin/backups.php</strong> file to allow for renaming of backup files to .sql or .gz files after stripping all spaces (and periods for other extensions, forcing an <strong>.sql.gz</strong> extension for such ones).</p><p>@joe: you can include it in the core.</p><div class="codebox"><pre><code>--- old/admin/backups.php    Sat Dec 20 14:35:56 2014
+++ new/admin/backups.php    Sat Dec 20 15:43:18 2014
@@ -142,6 +142,26 @@
         display_error(_(&quot;Select backup file first.&quot;));
 }
 
+if (get_post(&#039;rendump&#039;)) {
+    if ($backup_name) {
+        $rename_file = str_replace(&quot; &quot;, &quot;&quot;, trim(get_post(&#039;comments&#039;)));
+        if (strlen($rename_file) &gt; 0) {
+
+            $file_extn = pathinfo($rename_file, PATHINFO_EXTENSION);
+            if (!in_array($file_extn, Array(&quot;sql&quot;,&quot;gz&quot;)))
+                $rename_file = str_replace(&quot;.&quot;, &quot;&quot;, $rename_file) . &#039;.sql.gz&#039;;
+            $rename_path = BACKUP_PATH . $rename_file;
+
+            if (rename($backup_path, $rename_path)) {
+                display_notification($backup_name . &quot; : &quot; . _(&quot;File successfully renamed.&quot;).&quot; &quot;
+                    . _(&quot;New Filename&quot;) . &quot;: &quot; . $rename_path);
+                $Ajax-&gt;activate(&#039;backups&#039;);
+            } else display_error(_(&quot;Can&#039;t rename backup file.&quot;));
+
+        } else display_error($rename_file . &quot; : &quot; . _(&quot;Enter valid new file name to rename backup file.&quot;));
+    } else display_error(_(&quot;Select backup file first.&quot;));
+}
+
 if (get_post(&#039;deldump&#039;)) {
     if ($backup_name) {
         if (unlink($backup_path)) {
@@ -191,6 +211,8 @@
     start_table();
     submit_row(&#039;view&#039;,_(&quot;View Backup&quot;), false, &#039;&#039;, &#039;&#039;, false);
     submit_row(&#039;download&#039;,_(&quot;Download Backup&quot;), false, &#039;&#039;, &#039;&#039;, false);
+    submit_row(&#039;rendump&#039;,_(&quot;Rename Backup&quot;), false, &#039;&#039;,&#039;&#039;, &#039;process&#039;);
+    submit_js_confirm(&#039;rendump&#039;,_(&quot;You are about to rename database backup file.\nDo you want to continue?&quot;));
     submit_row(&#039;restore&#039;,_(&quot;Restore Backup&quot;), false, &#039;&#039;,&#039;&#039;, &#039;process&#039;);
     submit_js_confirm(&#039;restore&#039;,_(&quot;You are about to restore database from backup file.\nDo you want to continue?&quot;));</code></pre></div><p>Pushed to <a href="https://github.com/apmuthu/frontaccounting/commit/80c426d3cc67be1857ed667932dc45952b007199">my github repo</a> till inclusion into core.</p>]]></description>
			<author><![CDATA[null@example.com (apmuthu)]]></author>
			<pubDate>Sat, 20 Dec 2014 10:40:00 +0000</pubDate>
			<guid>https://frontaccounting.com/punbb/viewtopic.php?pid=21821#p21821</guid>
		</item>
	</channel>
</rss>
