jenkins-bot has submitted this change and it was merged.

Change subject: Don't assume configured directories end in a slash
......................................................................


Don't assume configured directories end in a slash

Add the slash regardless.

Change-Id: Ie3fc0f09c227102cc692117f0da23d979f0e1d84
---
M sites/all/modules/wmf_audit/BaseAuditProcessor.php
M sites/all/modules/wmf_audit/tests/WorldpayAuditTest.php
M sites/all/modules/wmf_audit/worldpay/worldpay_audit.module
3 files changed, 14 insertions(+), 13 deletions(-)

Approvals:
  Ejegg: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/sites/all/modules/wmf_audit/BaseAuditProcessor.php 
b/sites/all/modules/wmf_audit/BaseAuditProcessor.php
index af04821..4079b10 100644
--- a/sites/all/modules/wmf_audit/BaseAuditProcessor.php
+++ b/sites/all/modules/wmf_audit/BaseAuditProcessor.php
@@ -513,7 +513,7 @@
                                }
                                if ( $this->get_filetype( $file ) === 'recon' ) 
{
                                        $sort_key = 
$this->get_recon_file_sort_key( $file ); // report date or sequence number or 
something
-                                       $files_by_sort_key[$sort_key][] = 
$files_directory . $file;
+                                       $files_by_sort_key[$sort_key][] = 
$files_directory . '/' . $file;
                                }
                        }
                        closedir( $handle );
@@ -791,14 +791,14 @@
                //This date is not ready yet. Get the zipped version from the 
archive, unzip
                //to the working directory, and distill.
                $compressed_filename = $this->get_compressed_log_file_name( 
$date );
-               $full_archive_path = wmf_audit_get_log_archive_dir() . 
$compressed_filename;
+               $full_archive_path = wmf_audit_get_log_archive_dir() . '/' . 
$compressed_filename;
                $working_directory = $this->get_working_log_dir();
                $cleanup = array(); //add files we want to make sure aren't 
there anymore when we're done here.
                if ( file_exists( $full_archive_path ) ) {
                        wmf_audit_echo( "Retrieving $full_archive_path" );
                        $cmd = "cp $full_archive_path " . $working_directory;
                        exec( escapeshellcmd( $cmd ), $ret, $errorlevel );
-                       $full_compressed_path = $working_directory . 
$compressed_filename;
+                       $full_compressed_path = $working_directory . '/' . 
$compressed_filename;
                        if ( !file_exists( $full_compressed_path ) ) {
                                wmf_audit_log_error( "FILE PROBLEM: Trying to 
get log archives, and something went wrong with $cmd", 'FILE_MOVE' );
                                return false;
@@ -811,7 +811,7 @@
                        exec( escapeshellcmd( $cmd ), $ret, $errorlevel );
                        //now check to make sure the file you expect, actually 
exists
                        $uncompressed_file = 
$this->get_uncompressed_log_file_name( $date );
-                       $full_uncompressed_path = $working_directory . 
$uncompressed_file;
+                       $full_uncompressed_path = $working_directory . '/' . 
$uncompressed_file;
                        if ( !file_exists( $full_uncompressed_path ) ) {
                                wmf_audit_log_error( "FILE PROBLEM: Something 
went wrong with uncompressing logs: $cmd : $full_uncompressed_path doesn't 
exist.", 'FILE_UNCOMPRESS' );
                        } else {
@@ -864,7 +864,7 @@
                while ( ( $file = readdir( $handle ) ) !== false ) {
                        $temp_date = false;
                        if ( $this->get_filetype( $file ) === 'working_log' ) {
-                               $full_path = $working_dir . $file;
+                               $full_path = $working_dir . '/' . $file;
                                $temp_date = $this->get_working_log_file_date( 
$file );
                        }
                        if ( !$temp_date ) {
diff --git a/sites/all/modules/wmf_audit/tests/WorldpayAuditTest.php 
b/sites/all/modules/wmf_audit/tests/WorldpayAuditTest.php
index 38325c1..0caf034 100644
--- a/sites/all/modules/wmf_audit/tests/WorldpayAuditTest.php
+++ b/sites/all/modules/wmf_audit/tests/WorldpayAuditTest.php
@@ -24,9 +24,9 @@
        parent::setUp();
        self::$messages = array();
        $dirs = array(
-           'wmf_audit_log_archive_dir' => __DIR__ . '/data/logs/',
-           'worldpay_audit_recon_completed_dir' => $this->getTempDir(),
-           'worldpay_audit_working_log_dir' => $this->getTempDir(),
+           'wmf_audit_log_archive_dir' => __DIR__ . '/data/logs',
+           'worldpay_audit_recon_completed_dir' => $this->getTempDir() . 
'/completed',
+           'worldpay_audit_working_log_dir' => $this->getTempDir() . 
'/working',
        );
 
        foreach ( $dirs as $var => $dir ) {
@@ -41,7 +41,7 @@
 
     public function auditTestProvider() {
        return array(
-           array( __DIR__ . '/data/TransactionReconciliationFile/', array(
+           array( __DIR__ . '/data/TransactionReconciliationFile', array(
                'main' => array(
                    array(
                      'utm_source' => 'worldpay_audit',
diff --git a/sites/all/modules/wmf_audit/worldpay/worldpay_audit.module 
b/sites/all/modules/wmf_audit/worldpay/worldpay_audit.module
index 33dc5e1..07d0687 100644
--- a/sites/all/modules/wmf_audit/worldpay/worldpay_audit.module
+++ b/sites/all/modules/wmf_audit/worldpay/worldpay_audit.module
@@ -1,9 +1,10 @@
 <?php
 
-define( 'WP_AUDIT_RECON_PARSER_DIR', '/usr/local/src/WP_Parser_Lib/' );
-define( 'WP_AUDIT_RECON_FILES_DIR', '/usr/local/src/recon_files/' );
-define( 'WP_AUDIT_RECON_COMPLETED_DIR', 
'/usr/local/src/recon_files-completed/' );
-define( 'WP_AUDIT_WORKING_LOG_DIR', '/usr/local/src/log_files-working/' );
+// Defaults
+define( 'WP_AUDIT_RECON_PARSER_DIR', '/usr/local/src/WP_Parser_Lib' );
+define( 'WP_AUDIT_RECON_FILES_DIR', '/usr/local/src/recon_files' );
+define( 'WP_AUDIT_RECON_COMPLETED_DIR', '/usr/local/src/recon_files-completed' 
);
+define( 'WP_AUDIT_WORKING_LOG_DIR', '/usr/local/src/log_files-working' );
 define( 'WP_AUDIT_LOG_SEARCH_PAST_DAYS', 7 );
 define( 'WP_AUDIT_TEST_MODE', true );
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: Ie3fc0f09c227102cc692117f0da23d979f0e1d84
Gerrit-PatchSet: 4
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Awight <[email protected]>
Gerrit-Reviewer: AndyRussG <[email protected]>
Gerrit-Reviewer: Awight <[email protected]>
Gerrit-Reviewer: Cdentinger <[email protected]>
Gerrit-Reviewer: Eileen <[email protected]>
Gerrit-Reviewer: Ejegg <[email protected]>
Gerrit-Reviewer: Katie Horn <[email protected]>
Gerrit-Reviewer: Pcoombe <[email protected]>
Gerrit-Reviewer: XenoRyet <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to