This board is the new home for david63's extensions.

All of the extensions hosted here will need to be treated as a new install as there is no migration from the original ones to these, and furthermore, no support will be given to migrating to any of these extensions from previous versions.


Due to the selfishness of certain board members it has become necessary to apply a limit of how many downloads each member can make before making a donation. Once a donation has been made then you will have unlimited downloads.

[3.3.0] Auto db Backup

Fully working extensions
User avatar
devspace
Owner
Owner
Posts: 280
Joined: October 2022

[3.3.0] Auto db Backup

#1

Post by devspace »

Auto db Backup:

An extension for phpBB that will automatically backup your database using the phpBB Cron.

Compatibility:

Image Image

Image

Note:

If you are using any other version of this extension then it must be Disabled /Delete data and the original files deleted before installing this version - this will not delete any stored backup files but you will loose all settings.

Features:
  • Enable/disable auto database backup.
  • Auto db backup frequency - now set as hours.
  • Database optimization.
  • The quantity of stored backups can be set.
  • The backup time.
  • The backup file type - gzip, bzip2 or text.
  • The ability, via an event, to export the backup files.
Language(s):
  • en
Version:
  • 3.3.0
Installation:
  • Download the latest release and unzip it.
  • Upload the unzipped files to [board root]/ext/devspace/autodbbackup and enable it in the ACP
Configuration:
  • Maintenance
  • Auto database backup
  • Set required options
Extension Download:

User avatar
devspace
Owner
Owner
Posts: 280
Joined: October 2022

Auto db Backup

#2

Post by devspace »

Announcements:

downloader
Member
Member
Posts: 1
Joined: October 2022

Re: Auto db Backup

#3

Post by downloader »

Hi devspace,

great work. Three little things:

1. Folder name in zip-archive should be "autodbbackup" otherwise it doesn't install.
2. Default value for "Backup frequency" should be set to a valid value, e.g. "24" instead of "86400" (i think you thought of "s" instead of "h").
3. Default value for "Next backup time" should be set to a value that makes more sense.

Best regards.
Last edited by downloader on 18 Oct 2022, 15:19, edited 1 time in total.

User avatar
devspace
Owner
Owner
Posts: 280
Joined: October 2022

Re: Auto db Backup

#4

Post by devspace »

downloader wrote: 18 Oct 2022, 15:18
1. Folder name in zip-archive should be "autodbbackup" otherwise it doesn't install.
Fixed. Just a typo, thanks
downloader wrote: 18 Oct 2022, 15:18
2. Default value for "Backup frequency" should be set to a valid value, e.g. "24" instead of "86400" (i think you thought of "s" instead of "h").
3. Default value for "Next backup time" should be set to a value that makes more sense.
Not sure what you mean. The "backup frequency" is set to 1 and the next backup time is set to the current time.

panhead
Member
Member
Posts: 7
Joined: November 2022

Re: [3.3.0] Auto db Backup

#5

Post by panhead »

Hi,

When I enabled this extension i got this error:

Code: Select all

Something went wrong during the request and an exception was thrown. The changes made before the error occurred were reversed to the best of our abilities, but you should check the board for errors.

A required module does not exist: ACP_AUTO_DB_BACKUP

User avatar
devspace
Owner
Owner
Posts: 280
Joined: October 2022

Re: [3.3.0] Auto db Backup

#6

Post by devspace »

panhead wrote: 14 Jan 2023, 11:49
Hi,

When I enabled this extension i got this error:

Code: Select all

Something went wrong during the request and an exception was thrown. The changes made before the error occurred were reversed to the best of our abilities, but you should check the board for errors.

A required module does not exist: ACP_AUTO_DB_BACKUP
Not sure why you would be getting that error.

Did you have a previous version of this extension installed?

Did you unzip the files on the server?

panhead
Member
Member
Posts: 7
Joined: November 2022

Re: [3.3.0] Auto db Backup

#7

Post by panhead »

Code: Select all

Did you have a previous version of this extension installed?
Yes, long time ago. Disabled and data deleted.

Code: Select all

Did you unzip the files on the server?
Yes.

User avatar
devspace
Owner
Owner
Posts: 280
Joined: October 2022

Re: [3.3.0] Auto db Backup

#8

Post by devspace »

panhead wrote: 15 Jan 2023, 09:26

Code: Select all

Did you unzip the files on the server?
Yes.
Unzip on your local machine and ftp the files to your server. Some server configurations don't honour the directory structure when files are unzipped on the server which results in creating problems.

panhead
Member
Member
Posts: 7
Joined: November 2022

Re: [3.3.0] Auto db Backup

#9

Post by panhead »

I uploaded the unzipped files again and now get this error:

Code: Select all

SQL ERROR [ mysqli ]

Duplicate entry 'devspace/autodbbackup' for key 'ext_name' [1062]

SQL

INSERT INTO phpbb_ext (ext_name, ext_active, ext_state) VALUES ('devspace/autodbbackup', 0, 'b:1;')

BACKTRACE
Remove this entry from the table?

User avatar
devspace
Owner
Owner
Posts: 280
Joined: October 2022

Re: [3.3.0] Auto db Backup

#10

Post by devspace »

panhead wrote: 15 Jan 2023, 10:06
Remove this entry from the table?
Better option is to restore your backup

panhead
Member
Member
Posts: 7
Joined: November 2022

Re: [3.3.0] Auto db Backup

#11

Post by panhead »

But then I lose some topics & posts.

panhead
Member
Member
Posts: 7
Joined: November 2022

Re: [3.3.0] Auto db Backup

#12

Post by panhead »

Removed the entry from phpbb_ext, uploaded the unzipped files and enabled the extension again. Result:

Code: Select all

A required module does not exist: ACP_AUTO_DB_BACKUP

User avatar
devspace
Owner
Owner
Posts: 280
Joined: October 2022

Re: [3.3.0] Auto db Backup

#13

Post by devspace »

panhead wrote: 17 Jan 2023, 12:08
Removed the entry from phpbb_ext, uploaded the unzipped files and enabled the extension again.
Is this on a clean phpBB board?

panhead
Member
Member
Posts: 7
Joined: November 2022

Re: [3.3.0] Auto db Backup

#14

Post by panhead »

No, over 15 years old. On 3.3.9

User avatar
devspace
Owner
Owner
Posts: 280
Joined: October 2022

Re: [3.3.0] Auto db Backup

#15

Post by devspace »

Can you post the contents of migrations/v3_3_0/install_cat.php

panhead
Member
Member
Posts: 7
Joined: November 2022

Re: [3.3.0] Auto db Backup

#16

Post by panhead »

Code: Select all

<?php
/**
 *
 * @package Auto db Backup
 * @copyright (c) 2022 devspace
 * @license GNU General Public License, version 2 (GPL-2.0)
 *
 */

declare(strict_types=1);

namespace devspace\autodbbackup\migrations\v_3_3_0;

use phpbb\db\migration\migration;

class install_cat extends migration
{
	/**
	 * {@inheritdoc
	 */
	public function effectively_installed(): bool
	{
		$sql = 'SELECT module_id
				FROM ' . $this->table_prefix . "modules
				WHERE module_class = 'acp'
					AND module_langname = 'ACP_AUTO_DB_BACKUP_SETTINGS'";
		$result 	= $this->db->sql_query($sql);
		$module_id	= (bool) $this->db->sql_fetchfield('module_id');
		$this->db->sql_freeresult($result);

		return $module_id !== false;
	}

	/**
	 * {@inheritdoc
	 */
	public function update_data()
	{
		if ($this->module_check())
		{
			return [
				// Add the ACP cat module
				['module.add', ['acp', 'ACP_CAT_MAINTENANCE', 'ACP_AUTO_DB_BACKUP']],
			];
		}
		else
		{
			return [];
		}
	}

	/**
	 * {@inheritdoc
	 */
	protected function module_check()
	{
		$sql = 'SELECT module_id
                FROM ' . $this->table_prefix . "modules
                WHERE module_class = 'acp'
                    AND module_langname = 'ACP_AUTO_DB_BACKUP'
					AND right_id - left_id > 1";

		$result    = $this->db->sql_query($sql);
		$module_id = (int) $this->db->sql_fetchfield('module_id');
		$this->db->sql_freeresult($result);

		// return true if module is empty, false if has children
		return (bool) !$module_id;
	}
}

User avatar
3Di
Member
Member
Posts: 4
Joined: October 2022

Re: [3.3.0] Auto db Backup

#17

Post by 3Di »

Last night the backup was created twice in a very short time, not the usual 24 hours, what could be the reason?
You do not have the required permissions to view the files attached to this post.
I’m with 🇺🇦 Ukraine

User avatar
devspace
Owner
Owner
Posts: 280
Joined: October 2022

Re: [3.3.0] Auto db Backup

#18

Post by devspace »

What are your settings?

User avatar
3Di
Member
Member
Posts: 4
Joined: October 2022

Re: [3.3.0] Auto db Backup

#19

Post by 3Di »

2023-01-20 20_48_16-Auto database backup settings — Mozilla Firefox.png
You do not have the required permissions to view the files attached to this post.
I’m with 🇺🇦 Ukraine

User avatar
david63
Member
Member
Posts: 16
Joined: October 2022

Re: [3.3.0] Auto db Backup

#20

Post by david63 »

I have seen this happen before but, to be honest, I never spent any time looking into it, partly because trying to work out what happened historically in a cron job is almost impossible and also because I don't think that you can have too many backups.

If I had to make a guess as to what caused it I probably be thinking that it is something to do with timezones.

Out of interest what were the timezones of the users that triggered the backups and were they members or guests?

User avatar
3Di
Member
Member
Posts: 4
Joined: October 2022

Re: [3.3.0] Auto db Backup

#21

Post by 3Di »

david63 wrote: 21 Jan 2023, 08:19
what were the timezones of the users that triggered the backups and were they members or guests?

Code: Select all

Anonymous 	172.58.xxx.xxx 	20 Jan 2023 05:50 - "utc": "-06:00",

Anonymous 	96.250.xxx.xx 	20 Jan 2023 04:44 - "utc": "-05:00",
I’m with 🇺🇦 Ukraine

User avatar
david63
Member
Member
Posts: 16
Joined: October 2022

Re: [3.3.0] Auto db Backup

#22

Post by david63 »

And what timezone is the board in?

User avatar
3Di
Member
Member
Posts: 4
Joined: October 2022

Re: [3.3.0] Auto db Backup

#23

Post by 3Di »

Code: Select all

    PHP Timezone UTC
    Board Timezone UTC+01:00
I’m with 🇺🇦 Ukraine

User avatar
david63
Member
Member
Posts: 16
Joined: October 2022

Re: [3.3.0] Auto db Backup

#24

Post by david63 »

Looking at those times I don't think that timezones are the problem - but I still reserve judgement on that.

My other thought is that the

Code: Select all

auto_db_backup_next_gc
config variable should be dynamic, although when it is updated it sets it to dynamic. Try making it dynamic.

I suspect that this is something that will never get resolved, although as I said before, you cannot have too many backups.

stone23
Donor
Donor
Posts: 75
Joined: January 2023

Re: [3.3.0] Auto db Backup

#25

Post by stone23 »

Hello,
Personally, I manage to do a manual backup but the automatic backup does not work.