Created
September 8, 2020 12:49
-
-
Save jazzl0ver/c61eec1fd544f7d3c1a6e8140e4e5c22 to your computer and use it in GitHub Desktop.
A dirty hack to move MantisBT attachments to disk by 100 at a time. Might be needed to execute it several times. Useful when there're a lot of attachments out there. Don't forget to raise max_execution_time and memory_limit PHP parameters in php.ini.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- mantisbt-1.3.20/admin/move_attachments.php.orig 2019-09-26 19:42:19.000000000 +0300 | |
+++ mantisbt-1.3.20/admin/move_attachments.php 2020-09-08 15:43:06.000000000 +0300 | |
@@ -175,8 +175,13 @@ | |
# Process projects list | |
foreach( $p_projects as $t_project ) { | |
+ | |
+ $start = 0; | |
+ while ($start <= 1500) { | |
+ error_log($start); | |
+ | |
# Retrieve attachments for the project | |
- $t_result = db_query( $t_query, array( $t_project ) ); | |
+ $t_result = db_query( $t_query, array( $t_project ), 100, $start ); | |
# Project upload path | |
$t_upload_path = project_get_upload_path( $t_project ); | |
@@ -253,6 +258,9 @@ | |
'data' => $t_data, | |
); | |
+ $start += 100; | |
+ } | |
+ | |
} | |
return $t_moved; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment