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

Change subject: Don't use wfIsWindows() in CDB writers
......................................................................


Don't use wfIsWindows() in CDB writers

Uses the same logic, but without the dependency on MediaWiki.
Planning to use this in the het-deploy code.

Change-Id: I5d6baf6fe63d135c679e4795287daa0a8722dde6
---
M includes/utils/Cdb.php
M includes/utils/CdbDBA.php
M includes/utils/CdbPHP.php
3 files changed, 9 insertions(+), 2 deletions(-)

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



diff --git a/includes/utils/Cdb.php b/includes/utils/Cdb.php
index 71fa8c8..0995aed 100644
--- a/includes/utils/Cdb.php
+++ b/includes/utils/Cdb.php
@@ -145,6 +145,13 @@
                        $this->close();
                }
        }
+
+       /**
+        * Are we running on Windows?
+        */
+       protected function isWindows() {
+               return substr( php_uname(), 0, 7 ) == 'Windows';
+       }
 }
 
 /**
diff --git a/includes/utils/CdbDBA.php b/includes/utils/CdbDBA.php
index 5193409..efcaf21 100644
--- a/includes/utils/CdbDBA.php
+++ b/includes/utils/CdbDBA.php
@@ -64,7 +64,7 @@
                if ( isset( $this->handle ) ) {
                        dba_close( $this->handle );
                }
-               if ( wfIsWindows() ) {
+               if ( $this->isWindows() ) {
                        unlink( $this->realFileName );
                }
                if ( !rename( $this->tmpFileName, $this->realFileName ) ) {
diff --git a/includes/utils/CdbPHP.php b/includes/utils/CdbPHP.php
index c6edaf5..f05f786 100644
--- a/includes/utils/CdbPHP.php
+++ b/includes/utils/CdbPHP.php
@@ -334,7 +334,7 @@
                if ( isset( $this->handle ) ) {
                        fclose( $this->handle );
                }
-               if ( wfIsWindows() && file_exists( $this->realFileName ) ) {
+               if ( $this->isWindows() && file_exists( $this->realFileName ) ) 
{
                        unlink( $this->realFileName );
                }
                if ( !rename( $this->tmpFileName, $this->realFileName ) ) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5d6baf6fe63d135c679e4795287daa0a8722dde6
Gerrit-PatchSet: 8
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>
Gerrit-Reviewer: Parent5446 <[email protected]>
Gerrit-Reviewer: Siebrand <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to