Ejegg has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/246273

Change subject: Allow for multiple audit files per date
......................................................................

Allow for multiple audit files per date

Amazon might process both a settlement file and a refund file with
the same date.  Instead of allowing only one file per date, we
have an array of files per date and flatten them before returning.

Bug: T111425
Change-Id: I40eeeaa35c317574efc8280b7033d6718447d438
---
M sites/all/modules/wmf_audit/BaseAuditProcessor.php
1 file changed, 8 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/73/246273/1

diff --git a/sites/all/modules/wmf_audit/BaseAuditProcessor.php 
b/sites/all/modules/wmf_audit/BaseAuditProcessor.php
index 27b233b..0a4e9c2 100644
--- a/sites/all/modules/wmf_audit/BaseAuditProcessor.php
+++ b/sites/all/modules/wmf_audit/BaseAuditProcessor.php
@@ -484,16 +484,21 @@
        protected function get_all_recon_files() {
                $files_directory = $this->get_recon_dir();
                //foreach file in the directory, if it matches our pattern, add 
it to the array.
-               $files = array();
+               $files_by_date = array();
                if ( $handle = opendir( $files_directory ) ) {
                        while ( ( $file = readdir( $handle ) ) !== false ) {
                                if ( $this->get_filetype( $file ) === 'recon' ) 
{
                                        $filedate = $this->get_recon_file_date( 
$file ); //which is not the same thing as the edited date... probably.
-                                       $files[$filedate] = $files_directory . 
$file;
+                                       $files_by_date[$filedate][] = 
$files_directory . $file;
                                }
                        }
                        closedir( $handle );
-                       ksort( $files );
+                       ksort( $files_by_date );
+                       // now flatten it
+                       $files = array();
+                       foreach ( $files_by_date as $date => $date_files ) {
+                               $files = array_merge( $files, $date_files );
+                       }
                        return $files;
                } else {
                        //can't open the directory at all. Problem.

-- 
To view, visit https://gerrit.wikimedia.org/r/246273
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I40eeeaa35c317574efc8280b7033d6718447d438
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to