aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/console/command
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/phpbb/console/command')
-rw-r--r--phpBB/phpbb/console/command/thumbnail/delete.php25
-rw-r--r--phpBB/phpbb/console/command/thumbnail/generate.php25
2 files changed, 42 insertions, 8 deletions
diff --git a/phpBB/phpbb/console/command/thumbnail/delete.php b/phpBB/phpbb/console/command/thumbnail/delete.php
index 82a53727ab..7c66011d5c 100644
--- a/phpBB/phpbb/console/command/thumbnail/delete.php
+++ b/phpBB/phpbb/console/command/thumbnail/delete.php
@@ -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);
+ }
}
diff --git a/phpBB/phpbb/console/command/thumbnail/generate.php b/phpBB/phpbb/console/command/thumbnail/generate.php
index 1070b7b37a..c27d91d4d5 100644
--- a/phpBB/phpbb/console/command/thumbnail/generate.php
+++ b/phpBB/phpbb/console/command/thumbnail/generate.php
@@ -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);
+ }
}