* remove function_exists calls for things that functions that always
authorMark A. Hershberger <mah@users.mediawiki.org>
Wed, 19 May 2010 05:33:27 +0000 (05:33 +0000)
committerMark A. Hershberger <mah@users.mediawiki.org>
Wed, 19 May 2010 05:33:27 +0000 (05:33 +0000)
  exist under supported versions of PHP
** assert() is always defined for DifferenceEngine()
** mail() is always defined for UserMailer()
** is_executable() is defined for Windows from PHP 5.0.0 on

includes/Math.php
includes/UserMailer.php
includes/diff/DifferenceEngine.php

index 3a06c5f..be8b878 100644 (file)
@@ -56,7 +56,7 @@ class MathRenderer {
                                }
                        }
 
-                       if( function_exists( 'is_executable' ) && !is_executable( $wgTexvc ) ) {
+                       if( !is_executable( $wgTexvc ) ) {
                                return $this->_error( 'math_notexvc' );
                        }
                        $cmd = $wgTexvc . ' ' .
index 5ae6c51..99f99d2 100644 (file)
@@ -197,16 +197,12 @@ class UserMailer {
                        ini_set( 'html_errors', '0' );
                        set_error_handler( array( 'UserMailer', 'errorHandler' ) );
 
-                       if (function_exists('mail')) {
-                               if (is_array($to)) {
-                                       foreach ($to as $recip) {
-                                               $sent = mail( $recip->toString(), wfQuotedPrintable( $subject ), $body, $headers );
-                                       }
-                               } else {
-                                       $sent = mail( $to->toString(), wfQuotedPrintable( $subject ), $body, $headers );
+                       if (is_array($to)) {
+                               foreach ($to as $recip) {
+                                       $sent = mail( $recip->toString(), wfQuotedPrintable( $subject ), $body, $headers );
                                }
                        } else {
-                               self::$mErrorString = 'PHP is not configured to send mail';
+                               $sent = mail( $to->toString(), wfQuotedPrintable( $subject ), $body, $headers );
                        }
 
                        restore_error_handler();
index 184d1fc..b13c726 100644 (file)
@@ -9,8 +9,6 @@
 // You may copy this code freely under the conditions of the GPL.
 //
 
-define('USE_ASSERTS', function_exists('assert'));
-
 /**
  * @todo document
  * @private
@@ -153,8 +151,8 @@ class _DiffEngine {
                $edits = array();
                $xi = $yi = 0;
                while ($xi < $n_from || $yi < $n_to) {
-                       USE_ASSERTS && assert($yi < $n_to || $this->xchanged[$xi]);
-                       USE_ASSERTS && assert($xi < $n_from || $this->ychanged[$yi]);
+                       assert($yi < $n_to || $this->xchanged[$xi]);
+                       assert($xi < $n_from || $this->ychanged[$yi]);
 
                        // Skip matching "snake".
                        $copy = array();
@@ -316,13 +314,13 @@ class _DiffEngine {
                                while (list ($junk, $y) = each($matches))
                                if (empty($this->in_seq[$y])) {
                                        $k = $this->_lcs_pos($y);
-                                       USE_ASSERTS && assert($k > 0);
+                                       assert($k > 0);
                                        $ymids[$k] = $ymids[$k-1];
                                        break;
                                }
                                while (list ( /* $junk */, $y) = each($matches)) {
                                        if ($y > $this->seq[$k-1]) {
-                                               USE_ASSERTS && assert($y < $this->seq[$k]);
+                                               assert($y < $this->seq[$k]);
                                                // Optimization: this is a common case:
                                                //      next match is just replacing previous match.
                                                $this->in_seq[$this->seq[$k]] = false;
@@ -330,7 +328,7 @@ class _DiffEngine {
                                                $this->in_seq[$y] = 1;
                                        } else if (empty($this->in_seq[$y])) {
                                                $k = $this->_lcs_pos($y);
-                                               USE_ASSERTS && assert($k > 0);
+                                               assert($k > 0);
                                                $ymids[$k] = $ymids[$k-1];
                                        }
                                }
@@ -366,7 +364,7 @@ class _DiffEngine {
                        $end = $mid;
                }
 
-               USE_ASSERTS && assert($ypos != $this->seq[$end]);
+               assert($ypos != $this->seq[$end]);
 
                $this->in_seq[$this->seq[$end]] = false;
                $this->seq[$end] = $ypos;
@@ -446,7 +444,7 @@ class _DiffEngine {
                $i = 0;
                $j = 0;
 
-               USE_ASSERTS && assert('sizeof($lines) == sizeof($changed)');
+               assert('sizeof($lines) == sizeof($changed)');
                $len = sizeof($lines);
                $other_len = sizeof($other_changed);
 
@@ -466,7 +464,7 @@ class _DiffEngine {
                        $j++;
 
                        while ($i < $len && ! $changed[$i]) {
-                               USE_ASSERTS && assert('$j < $other_len && ! $other_changed[$j]');
+                               assert('$j < $other_len && ! $other_changed[$j]');
                                $i++; $j++;
                                while ($j < $other_len && $other_changed[$j])
                                $j++;
@@ -498,10 +496,10 @@ class _DiffEngine {
                                        $changed[--$i] = false;
                                        while ($start > 0 && $changed[$start - 1])
                                        $start--;
-                                       USE_ASSERTS && assert('$j > 0');
+                                       assert('$j > 0');
                                        while ($other_changed[--$j])
                                        continue;
-                                       USE_ASSERTS && assert('$j >= 0 && !$other_changed[$j]');
+                                       assert('$j >= 0 && !$other_changed[$j]');
                                }
 
                                /*
@@ -524,7 +522,7 @@ class _DiffEngine {
                                        while ($i < $len && $changed[$i])
                                        $i++;
 
-                                       USE_ASSERTS && assert('$j < $other_len && ! $other_changed[$j]');
+                                       assert('$j < $other_len && ! $other_changed[$j]');
                                        $j++;
                                        if ($j < $other_len && $other_changed[$j]) {
                                                $corresponding = $i;
@@ -541,10 +539,10 @@ class _DiffEngine {
                        while ($corresponding < $i) {
                                $changed[--$start] = 1;
                                $changed[--$i] = 0;
-                               USE_ASSERTS && assert('$j > 0');
+                               assert('$j > 0');
                                while ($other_changed[--$j])
                                continue;
-                               USE_ASSERTS && assert('$j >= 0 && !$other_changed[$j]');
+                               assert('$j >= 0 && !$other_changed[$j]');
                        }
                }
                wfProfileOut( __METHOD__ );