mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-04 21:44:57 +02:00
[ticket/12692] Update the database regularly
PHPBB3-12692
This commit is contained in:
parent
c96cc2cb05
commit
54be6b1f62
@ -84,6 +84,13 @@ class delete extends \phpbb\console\command\command
|
||||
if (@unlink($thumbnail_path))
|
||||
{
|
||||
$thumbnail_deleted[] = $row['attach_id'];
|
||||
|
||||
if (sizeof($thumbnail_deleted) === 250)
|
||||
{
|
||||
$this->commit_changes($thumbnail_deleted);
|
||||
$thumbnail_deleted = array();
|
||||
}
|
||||
|
||||
if ($input->getOption('verbose'))
|
||||
{
|
||||
$output->writeln($this->user->lang('THUMBNAIL_DELETED', $row['real_filename'], $row['physical_filename']));
|
||||
@ -102,12 +109,22 @@ class delete extends \phpbb\console\command\command
|
||||
|
||||
if (!empty($thumbnail_deleted))
|
||||
{
|
||||
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
|
||||
SET thumbnail = 0
|
||||
WHERE ' . $this->db->sql_in_set('attach_id', $thumbnail_deleted);
|
||||
$this->db->sql_query($sql);
|
||||
$this->commit_changes($thumbnail_deleted);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Commits the changes to the database
|
||||
*
|
||||
* @param array $thumbnail_deleted
|
||||
*/
|
||||
protected function commit_changes(array $thumbnail_deleted)
|
||||
{
|
||||
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
|
||||
SET thumbnail = 0
|
||||
WHERE ' . $this->db->sql_in_set('attach_id', $thumbnail_deleted);
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
@ -106,6 +106,13 @@ class generate extends \phpbb\console\command\command
|
||||
if (create_thumbnail($source, $destination, $row['mimetype']))
|
||||
{
|
||||
$thumbnail_created[] = (int) $row['attach_id'];
|
||||
|
||||
if (sizeof($thumbnail_created) === 250)
|
||||
{
|
||||
$this->commit_changes($thumbnail_created);
|
||||
$thumbnail_created = array();
|
||||
}
|
||||
|
||||
if ($input->getOption('verbose'))
|
||||
{
|
||||
$output->writeln($this->user->lang('THUMBNAIL_GENERATED', $row['real_filename'], $row['physical_filename']));
|
||||
@ -124,12 +131,22 @@ class generate extends \phpbb\console\command\command
|
||||
|
||||
if (!empty($thumbnail_created))
|
||||
{
|
||||
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
|
||||
SET thumbnail = 1
|
||||
WHERE ' . $this->db->sql_in_set('attach_id', $thumbnail_created);
|
||||
$this->db->sql_query($sql);
|
||||
$this->commit_changes($thumbnail_created);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Commits the changes to the database
|
||||
*
|
||||
* @param array $thumbnail_created
|
||||
*/
|
||||
protected function commit_changes(array $thumbnail_created)
|
||||
{
|
||||
$sql = 'UPDATE ' . ATTACHMENTS_TABLE . '
|
||||
SET thumbnail = 1
|
||||
WHERE ' . $this->db->sql_in_set('attach_id', $thumbnail_created);
|
||||
$this->db->sql_query($sql);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user