r63736 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63735‎ | r63736 | r63737 >
Date:12:44, 14 March 2010
Author:catrope
Status:ok
Tags:
Comment:
Fix r63718 and r63719: correct spelling of "stylize_recursivly()", fix syntax error introduced by stylize
Modified paths:
  • /trunk/tools/code-utils/lint.php (modified) (history)
  • /trunk/tools/code-utils/stylize.php (modified) (history)

Diff [purge]

Index: trunk/tools/code-utils/stylize.php
@@ -4,7 +4,7 @@
55 * A PHP code beautifier aimed at adding lots of spaces to files that lack them,
66 * in keeping with MediaWiki's spacey site style.
77 *
8 - * @author tstarling
 8+ * @author Tim Starling
99 * @author Jeroen De Dauw
1010 */
1111
@@ -19,7 +19,7 @@
2020 if ( count( $argv ) ) {
2121 foreach ( $argv as $dirOrFile ) {
2222 if ( is_dir( $dirOrFile ) ) {
23 - stylize_recursivly( $dirOrFile );
 23+ stylize_recursively( $dirOrFile );
2424 } else {
2525 stylize_file( $dirOrFile );
2626 }
@@ -28,10 +28,10 @@
2929 stylize_file( '-' );
3030 }
3131
32 -function stylize_recursivly( $dir ) {
 32+function stylize_recursively( $dir ) {
3333 foreach ( glob( "$dir/*" ) as $dirOrFile ) {
3434 if ( is_dir( $dirOrFile ) ) { // It's a directory, so call this function again.
35 - stylize_recursivly( $dirOrFile );
 35+ stylize_recursively( $dirOrFile );
3636 } elseif ( is_file( $dirOrFile ) ) { // It's a file, so let's stylize it.
3737 // Only stylize php and js files, omitting minified js files.
3838 if ( preg_match( '/\.(php|php5|js)$/', $dirOrFile ) && !preg_match( '/\.(min\.js)$/', $dirOrFile ) ) {
@@ -58,7 +58,8 @@
5959 }
6060 $stylizer = new Stylizer( $s );
6161 $s = $stylizer->stylize();
62 - if ( $backup ) rename( $filename, "$filename~" );
 62+ if ( $backup )
 63+ rename( $filename, "$filename~" );
6364 file_put_contents( $filename, $s );
6465 }
6566 }
Index: trunk/tools/code-utils/lint.php
@@ -34,7 +34,7 @@
3535 }
3636 if ( is_dir( "$dir/$fileName" ) ) {
3737 $ret = check_dir( "$dir/$fileName" );
38 - } elseif ( substr( $fileName, - 4 ) == '.php' ) {
 38+ } elseif ( substr( $fileName, -4 ) == '.php' ) {
3939 $ret = check_file( "$dir/$fileName" );
4040 } else {
4141 $ret = true;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r63718Added suport for stylizing directories recursivlyjeroendedauw00:44, 14 March 2010
r63719Stylized stylize.php :Djeroendedauw00:46, 14 March 2010

Status & tagging log