com web/qa: Replace dirname(__FILE__) with shor ter __DIR__: phpt_details.php reports/detai ls.php reports/parserfunc.php reports/test-insert.php
reports/viewreports.php sample_tests/clean.php sam ple_tests/sample017.php sample_tests/sample02 2.php sample_tests/sample024.php sample_tes
ts/sample025.php
| From: | Peter Kokot | Date: | Thu, 18 Oct 2018 17:46:47 +0000 |
| Subject: | com web/qa: Replace dirname(__FILE__) with shor ter __DIR__: phpt_details.php reports/detai ls.php reports/parserfunc.php reports/test-insert.php reports/viewreports.php sample_tests/clean.php sam ple_tests/sample017.php sample_tests/sample02 2.php sample_tests/sample024.php sample_tes ts/sample025.php |
||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-68236@lists.php.net to get a copy of this message | ||
Commit: e80874c2c8dfaf758157c07f43c7a4867490bab4
Author: Peter Kokot <peterkokot@gmail.com> Thu, 18 Oct 2018 19:46:47 +0200
Parents: 040a9381d5949b35031bb47b0cbc0e89a7b29057
Branches: master
Link: http://git.php.net/?p=web/qa.git;a=commitdiff;h=e80874c2c8dfaf758157c07f43c7a4867490bab4
Log:
Replace dirname(__FILE__) with shorter __DIR__
Changed paths:
M phpt_details.php
M reports/details.php
M reports/parserfunc.php
M reports/test-insert.php
M reports/viewreports.php
M sample_tests/clean.php
M sample_tests/sample017.php
M sample_tests/sample022.php
M sample_tests/sample024..php
M sample_tests/sample025.php
Diff:
diff --git a/phpt_details.php b/phpt_details.php
index 44a1d6c..e01005c 100644
--- a/phpt_details.php
+++ b/phpt_details.php
@@ -887,8 +887,7 @@ PHP source code enclosed by PHP tags.</p>
<p><b>Example 1 (snippet):</b><br/>
<pre>--CLEAN--
<?php
- $temp_filename = dirname(__FILE__)."/DomDocument_save_basic.tmp";
- unlink($temp_filename);
+unlink(__DIR__.'/DomDocument_save_basic.tmp');
?></pre></p>
<p><b>Example 1 (full):</b> <a
href="sample_tests/sample024.php">sample024.phpt</a></p>
<p><b>Example 2 (snippet):</b><br/>
@@ -900,7 +899,7 @@ require_once('clean.inc');
<p><b>Example 3 (snippet):</b><br/>
<pre>--CLEAN--
<?php
-$key = ftok(dirname(__FILE__)."/003.phpt", 'q');
+$key = ftok(__DIR__.'/003.phpt', 'q');
$s = shm_attach($key);
shm_remove($s);
?></pre></p>
diff --git a/reports/details.php b/reports/details.php
index 00acc46..f26b865 100644
--- a/reports/details.php
+++ b/reports/details.php
@@ -31,7 +31,7 @@ if (!is_valid_php_version($_GET['version'], $QA_RELEASES)) {
$signature = $_GET['signature'];
$version = $_GET['version'];
-$dbFile = dirname(__FILE__).'/db/'.$version.'.sqlite';
+$dbFile = __DIR__.'/db/'.$version.'.sqlite';
$database = new SQLite3($dbFile, SQLITE3_OPEN_READONLY);
diff --git a/reports/parserfunc.php b/reports/parserfunc.php
index c071996..4b79344 100644
--- a/reports/parserfunc.php
+++ b/reports/parserfunc.php
@@ -55,7 +55,7 @@ function insertToDb_phpmaketest($array, $QA_RELEASES = array())
exit('invalid version');
}
- $dbFile =
dirname(__FILE__).'/db/'.$array['version'].'.sqlite';
+ $dbFile = __DIR__.'/db/'.$array['version'].'.sqlite';
$queriesCreate = array (
'failed' => 'CREATE TABLE IF NOT EXISTS failed (
diff --git a/reports/test-insert.php b/reports/test-insert.php
index f985735..3974c90 100644
--- a/reports/test-insert.php
+++ b/reports/test-insert.php
@@ -113,7 +113,7 @@ printf("%-30s", "Function call");
if ($return === true) echo " <font color='green'>OK</font> \n";
else echo " <font color='red'>KO (return:
".$return.")</font> \n";
-$dbFile = dirname(__FILE__).'/db/'.$array['version'].'.sqlite';
+$dbFile = __DIR__.'/db/'.$array['version'].'.sqlite';
printf("%-30s", "DB file exists");
if (file_exists($dbFile)) echo " <font color='green'>OK</font> \n";
diff --git a/reports/viewreports.php b/reports/viewreports.php
index 21be35e..a768b38 100644
--- a/reports/viewreports.php
+++ b/reports/viewreports.php
@@ -31,7 +31,7 @@ if (!is_valid_php_version($_GET['version'], $QA_RELEASES)) {
$testName = $_GET['test'];
$version = $_GET['version'];
-$dbFile = dirname(__FILE__).'/db/'.$version.'.sqlite';
+$dbFile = __DIR__.'/db/'.$version.'.sqlite';
$siteUpdate = date("D M d H:i:s Y T", filemtime($dbFile))."<br />\n";
$database = new SQLite3($dbFile, SQLITE3_OPEN_READONLY);
diff --git a/sample_tests/clean.php b/sample_tests/clean.php
index 97870ab..1f4e2b1 100644
--- a/sample_tests/clean.php
+++ b/sample_tests/clean.php
@@ -11,7 +11,7 @@ common_header();
<h1>Sample Test: clean.inc</h1>
<p>Back to "<a href="../phpt_details.php">PHPT Test File
Layout</a>"</p>
<pre><?php
-include_once(dirname(__FILE__) . '/imap_include.inc');
+include_once(__DIR__ . '/imap_include.inc');
$imap_stream = imap_open($default_mailbox, $username, $password);
diff --git a/sample_tests/sample017.php b/sample_tests/sample017.php
index f65f5d2..cfa06ba 100644
--- a/sample_tests/sample017.php
+++ b/sample_tests/sample017.php
@@ -22,7 +22,7 @@ PDOTest::skip();
?>
--FILE--
<?php
-if (getenv('REDIR_TEST_DIR') === false)
putenv('REDIR_TEST_DIR='.dirname(__FILE__) .
'/../../pdo/tests/');
+if (getenv('REDIR_TEST_DIR') === false)
putenv('REDIR_TEST_DIR='.__DIR__ . '/../../pdo/tests/');
require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc';
$db = PDOTest::factory();
diff --git a/sample_tests/sample022.php b/sample_tests/sample022.php
index 746875d..b0cd84f 100644
--- a/sample_tests/sample022.php
+++ b/sample_tests/sample022.php
@@ -17,7 +17,7 @@ shm_detach() tests
--FILE--
<?php
-$key = ftok(dirname(__FILE__)."/003.phpt", 'q');
+$key = ftok(__DIR__.'/003.phpt', 'q');
var_dump(shm_detach());
var_dump(shm_detach(1,1));
@@ -36,7 +36,7 @@ echo "Done\n";
?>
--CLEAN--
<?php
-$key = ftok(dirname(__FILE__)."/003.phpt", 'q');
+$key = ftok(__DIR__."/003.phpt", 'q');
$s = shm_attach($key);
shm_remove($s);
?>
diff --git a/sample_tests/sample024.php b/sample_tests/sample024.php
index f83ee04..ceeb13d 100644
--- a/sample_tests/sample024.php
+++ b/sample_tests/sample024.php
@@ -31,14 +31,13 @@ $title = $root->appendChild($title);
$text = $doc->createTextNode('This is the title');
$text = $title->appendChild($text);
-$temp_filename = dirname(__FILE__)."/DomDocument_save_basic.tmp";
+$temp_filename = __DIR__.'/DomDocument_save_basic.tmp';
echo 'Wrote: ' . $doc->save($temp_filename) . ' bytes';
// Wrote: 72 bytes
?>
--CLEAN--
<?php
- $temp_filename = dirname(__FILE__)."/DomDocument_save_basic.tmp";
- unlink($temp_filename);
+ unlink(__DIR__.'/DomDocument_save_basic.tmp');
?>
--EXPECTF--
Wrote: 72 bytes
diff --git a/sample_tests/sample025.php b/sample_tests/sample025.php
index 4e65ac0..c17189f 100644
--- a/sample_tests/sample025.php
+++ b/sample_tests/sample025.php
@@ -14,7 +14,7 @@ common_header();
Test imap_append() function : basic functionality
--SKIPIF--
<?php
-require_once(dirname(__FILE__).'/skipif.inc');
+require_once(__DIR__.'/skipif.inc');
?>
--FILE--
<?php
@@ -25,7 +25,7 @@ require_once(dirname(__FILE__).'/skipif.inc');
echo "*** Testing imap_append() : basic functionality ***\n";
-require_once(dirname(__FILE__).'/imap_include.inc');
+require_once(__DIR__.'/imap_include.inc');
echo "Create a new mailbox for test\n";
$imap_stream = setup_test_mailbox("", 0);