Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
18 posts Page 2 of 2
I've been dancing with the idea to get back to test this thing again for the last two days.
I hope to get through what I am now within next several days and will post here all the results.
You are doing really great, @Tim! I'm sure you got the fun of creating something cool here :)
The latest update to this utility now includes security and stability enhancements contributed by @KK. :)
Working perfectly.

How can I limit database operations only to logged in SuperAdmin?
How can I limit database operations only to logged in SuperAdmin?

At the beginning of each file, you'll find the line
Code: Select all
if( $AUTH->user->access_level < K_ACCESS_LEVEL_ADMIN ) die( 'Please login as admin.' );

Change it to
Code: Select all
if( $AUTH->user->access_level < K_ACCESS_LEVEL_SUPER_ADMIN ) die( 'Please login as super admin.' );

You'll need to make the change in 3 files:
    file_manager.php
    index.php
    restore.php
Thank you, I will limit this things for super-admin.
Good news, everybody!

The latest update to the database utility adds automatic backup functionality with a built-in cron job script. You can now effortlessly protect your sites from painful and costly database corruption incidents. If you're already using this utility, be sure to grab a fresh download and set up a cron job to keep your database backed up.

Regular database backups are a boring and fussy but essential part of managing a CMS-based website. Don't kick yourself later. Back it up now! :)
Hello

This tool is indeed very useful. But I had some problems. The following features did not work:

"Save a Backup" on the server: ok
"Save a Backup" on local WAMPP installation: No File is created
"Download a Backup" on server: The file created is empty
"Download a Backup" on local WAMPP installation: The file created is empty

Kind regards,
Oliver
Hi Oliver. Thanks for reporting the trouble you're having with the database utility.

This utility is something that has been developed while being posted in the open forum. As you can see from the thread, although it was working for me on my own systems, my first draft didn't even work right for the very first person who tried it! I have updated the code several times since it was originally posted: responding to troubles on different systems, adding features, fixing bugs.

So the first thing is that if you're using a version of this utility that was downloaded more than a few weeks ago (since April 12), get a new copy of the download. But I guess you probably didn't download this a few months ago and wait until now to try it.

Let's start by taking these two together:
"Save a Backup" on the server: ok
"Download a Backup" on server: The file created is empty

Creating empty files was one of the very first problems I ran into. This was caused by having the wrong path to the system's mysql commands. The config.php file was meant to address the problem. It discovers the correct path and as a fallback allows you to hard code the path to the system's mysql files.

But downloading files and saving them on the server both use the same command path. If one works, then the other should as well. So I'm left scratching my head. The code does include several layers of error reporting. Were there any errors reported?

Next, these two are probably related:
"Save a Backup" on local WAMPP installation: No File is created
"Download a Backup" on local WAMPP installation: The file created is empty

@KK tried using my code on a project of his own and discovered that it wasn't working on his Windows system. He shared his corrections with me and I incorporated them into this project. The thing is, I'm strictly an amateur at this. I don't even have a Windows computer for testing. I did ask a couple of the Couch forumites to test the code for me, and they reported it was working. So that's about as much as I know about that.

Again, I think this comes down to the paths to the system's mysql commands being malformed. If you're using the latest version of the utility, you should be getting error reports along with or instead of these errors. You might want to look into hard coding the system paths in the config.php file if you can figure out the correct path.

Another thing to look at is what the utility reports as the file path. When you save a backup, you should get a message that says "Database backup saved to path/to/couch/database/backups/DBNAME_2016-05-10_114153.sql". Check that path name. You might find some obvious error.

At this point, I'm kind of stumped because I can't reproduce or test the errors you're experiencing. But I have no doubt that they're real. Since this utility relies on system commands rather than php functions, I've learned that there are lots of ways for different system and server configurations to cause problems.

You're right that this is a very useful tool. I'm glad to have it for myself, especially with the cron job files that are included. And @KK was kind enough to pin it among the featured Tips and Tricks threads because backing up database files is such an important part of managing a website. But getting it to work across all different systems and server configurations has been more of a challenge than I ever expected.

I may have gotten in over my head, so I welcome input from any other users or developers who think they can help make this utility more stable and functional across different systems. Input from some of the more savvy programmers in the community might be needed to really get this working for everyone.

As for your own issues, be sure that you have downloaded the most recent version, and let me know if there are any errors being reported or the path names look malformed. I honestly appreciate your feedback and hope we can get this working for you.

All the best,
Tim
18 posts Page 2 of 2