From 6a6e50208a9d02f2b3a72c31ed08d951e21e9314 Mon Sep 17 00:00:00 2001 From: Platonides Date: Thu, 21 Feb 2013 00:50:27 +0100 Subject: [PATCH] Move around/add PHP_SAPI check, making find-entries happier. Change-Id: Ic166066a543c4a5c0958351fdfe5f984e8d443d7 --- includes/normal/Utf8Test.php | 7 ++++--- includes/normal/UtfNormalBench.php | 8 ++++---- includes/normal/UtfNormalMemStress.php | 8 ++++---- includes/normal/UtfNormalTest.php | 8 ++++---- maintenance/Maintenance.php | 4 ++++ maintenance/language/generateNormalizerData.php | 4 ++-- maintenance/language/validate.php | 4 ++++ 7 files changed, 26 insertions(+), 17 deletions(-) diff --git a/includes/normal/Utf8Test.php b/includes/normal/Utf8Test.php index 904a27ff61..c5c1be59ea 100644 --- a/includes/normal/Utf8Test.php +++ b/includes/normal/Utf8Test.php @@ -27,6 +27,10 @@ /** */ +if ( PHP_SAPI != 'cli' ) { + die( "Run me from the command line please.\n" ); +} + require_once 'UtfNormalDefines.php'; require_once 'UtfNormalUtil.php'; require_once 'UtfNormal.php'; @@ -34,9 +38,6 @@ mb_internal_encoding( "utf-8" ); $verbose = false; #$verbose = true; -if( PHP_SAPI != 'cli' ) { - die( "Run me from the command line please.\n" ); -} $in = fopen( "UTF-8-test.txt", "rt" ); if( !$in ) { diff --git a/includes/normal/UtfNormalBench.php b/includes/normal/UtfNormalBench.php index 392ba2bfdf..89de929038 100644 --- a/includes/normal/UtfNormalBench.php +++ b/includes/normal/UtfNormalBench.php @@ -24,6 +24,10 @@ * @ingroup UtfNormal */ +if( PHP_SAPI != 'cli' ) { + die( "Run me from the command line please.\n" ); +} + if( isset( $_SERVER['argv'] ) && in_array( '--icu', $_SERVER['argv'] ) ) { dl( 'php_utfnormal.so' ); } @@ -34,10 +38,6 @@ require_once 'UtfNormal.php'; define( 'BENCH_CYCLES', 5 ); -if( PHP_SAPI != 'cli' ) { - die( "Run me from the command line please.\n" ); -} - $testfiles = array( 'testdata/washington.txt' => 'English text', 'testdata/berlin.txt' => 'German text', diff --git a/includes/normal/UtfNormalMemStress.php b/includes/normal/UtfNormalMemStress.php index 257e105bab..9732d7624f 100644 --- a/includes/normal/UtfNormalMemStress.php +++ b/includes/normal/UtfNormalMemStress.php @@ -26,6 +26,10 @@ * @ingroup UtfNormal */ +if( PHP_SAPI != 'cli' ) { + die( "Run me from the command line please.\n" ); +} + if( isset( $_SERVER['argv'] ) && in_array( '--icu', $_SERVER['argv'] ) ) { dl( 'php_utfnormal.so' ); } @@ -38,10 +42,6 @@ define( 'BENCH_CYCLES', 1 ); define( 'BIGSIZE', 1024 * 1024 * 10); // 10m ini_set('memory_limit', BIGSIZE + 120 * 1024 * 1024); -if( PHP_SAPI != 'cli' ) { - die( "Run me from the command line please.\n" ); -} - $testfiles = array( 'testdata/washington.txt' => 'English text', 'testdata/berlin.txt' => 'German text', diff --git a/includes/normal/UtfNormalTest.php b/includes/normal/UtfNormalTest.php index 22e6471673..661e53fd7f 100644 --- a/includes/normal/UtfNormalTest.php +++ b/includes/normal/UtfNormalTest.php @@ -25,6 +25,10 @@ * @ingroup UtfNormal */ +if( PHP_SAPI != 'cli' ) { + die( "Run me from the command line please.\n" ); +} + $verbose = true; #define( 'PRETTY_UTF8', true ); @@ -54,10 +58,6 @@ require_once 'UtfNormalDefines.php'; require_once 'UtfNormalUtil.php'; require_once 'UtfNormal.php'; -if( PHP_SAPI != 'cli' ) { - die( "Run me from the command line please.\n" ); -} - $in = fopen("NormalizationTest.txt", "rt"); if( !$in ) { print "Couldn't open NormalizationTest.txt -- can't run tests.\n"; diff --git a/maintenance/Maintenance.php b/maintenance/Maintenance.php index b2bbf9b7b7..aab7bb3896 100644 --- a/maintenance/Maintenance.php +++ b/maintenance/Maintenance.php @@ -20,6 +20,10 @@ * @defgroup Maintenance Maintenance */ +if( PHP_SAPI != 'cli' ) { + die( "Run me from the command line please.\n" ); +} + // Make sure we're on PHP5.3.2 or better if ( !function_exists( 'version_compare' ) || version_compare( PHP_VERSION, '5.3.2' ) < 0 ) { // We need to use dirname( __FILE__ ) here cause __DIR__ is PHP5.3+ diff --git a/maintenance/language/generateNormalizerData.php b/maintenance/language/generateNormalizerData.php index 33163d4939..c03162c416 100644 --- a/maintenance/language/generateNormalizerData.php +++ b/maintenance/language/generateNormalizerData.php @@ -21,10 +21,10 @@ * @ingroup MaintenanceLanguage */ -require_once( __DIR__ . '/../Maintenance.php' ); - require_once( __DIR__ . '/../../includes/normal/UtfNormalUtil.php' ); +require_once( __DIR__ . '/../Maintenance.php' ); + /** * Generates normalizer data files for Arabic and Malayalam. * For NFC see includes/normal. diff --git a/maintenance/language/validate.php b/maintenance/language/validate.php index 751e744ddf..4f00496f47 100644 --- a/maintenance/language/validate.php +++ b/maintenance/language/validate.php @@ -21,6 +21,10 @@ * @ingroup MaintenanceLanguage */ +if ( PHP_SAPI != 'cli' ) { + die( "Run me from the command line please.\n" ); +} + if ( !isset( $argv[1] ) ) { print "Usage: php {$argv[0]} \n"; exit( 1 ); -- 2.20.1