vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Community Lounge (https://vborg.vbsupport.ru/forumdisplay.php?f=13)
-   -   Biggest coding project ever (https://vborg.vbsupport.ru/showthread.php?t=71981)

Dean C 12-01-2004 07:00 AM

Shame there's not a tool to do that automatically :)

Zero Tolerance 12-01-2004 08:00 AM

Quote:

Originally Posted by Dean C
Shame there's not a tool to do that automatically :)

I suppose a simple php script could open all files in a certain directory and find it out. But it would be no use to anyone here :p

- Zero Tolerance

Dean C 12-01-2004 11:54 AM

Oh yeah, that could be done quite easily too :)

[high]* Dean C codes it[/high]

Tal-CPO 12-01-2004 12:56 PM

Quote:

Originally Posted by Zero Tolerance
I suppose a simple php script could open all files in a certain directory and find it out. But it would be no use to anyone here :p

- Zero Tolerance


if you use linux/unix/mac try "wc"

lko@raysrv1:/home/lko> wc bin/*
0 0 0 bin/CVS
23 41 509 bin/addop.sh
38 70 870 bin/cleanup.sh
175 677 6170 bin/create-instance.sh
23 41 509 bin/delop.sh
64 142 1360 bin/gen_email_conf.sh
26 54 559 bin/jas3-cleanup.sh
67 225 1424 bin/logrotate
76 185 1856 bin/make-httpd-conf.sh
81 259 2125 bin/remove-instance.sh
58 175 1366 bin/update-me.sh
631 1869 16748 total


;)

filburt1 12-01-2004 01:57 PM

Quote:

Originally Posted by Dean C
Shame there's not a tool to do that automatically :)

I just wrote a script in PHP...;)

Dean C 12-01-2004 02:40 PM

Upload a phps and PM me the url - I'm too lazy to code one now that I got started on coding WinterDir for the night again :)

filburt1 12-01-2004 05:07 PM

Here it is (with some parts removed). It's obviously very uniquely coded to my needs.
PHP Code:

<?php
$files 
= array
(
    
"includes/functions_vbms",
    
"includes/functions_vbms_installer",
    
"includes/init_vbms",
    
"includes/preinit_vbms",
    
"includes/vbms_checkmail_classdefs",
    
"includes/vbms_checkmail_filterengine",
    
"includes/vbms_checkmail_functions",
    
"includes/vbms_frontend_init",
    
"includes/cron/vbms_checkmail",
    
"vbms",
    
"vbms_ab",
    
"vbms_alias",
    
"vbms_filters",
    
"vbms_folders",
    
"vbms_misc",
    
"vbms_new",
    
"vbms_read",
    
"admincp/install_vbms",
    
"admincp/vbms_permissions",
    
"admincp/install_vbms_steps/step0",
    
"admincp/install_vbms_steps/step1",
    
"admincp/install_vbms_steps/step2",
    
"admincp/install_vbms_steps/step3",
    
"admincp/install_vbms_steps/step4",
    
"admincp/install_vbms_steps/step5",
    
"admincp/install_vbms_queries/settings",
    
"admincp/install_vbms_queries/stylechangeslist",
    
"admincp/install_vbms_queries/vbmstables"
);

echo 
"<ul>";
$total 0;
foreach (
$files as $file)
{
    
$filename = (strpos($file"queries") ? "$file.sql" "$file.php");
    
$linecount sizeof(file("foo/$filename"));
    echo 
"<li>$filename is $linecount lines</li>";
    
$total += $linecount;
}
echo 
"</ul>";
echo 
"Total PHP and SQL: " number_format($total) . "<br />";

$stylelines sizeof(file("foo/admincp/install_vbms_xml/phrases.xml"));
echo 
"Style XML is $stylelines lines<br />";

echo 
"<b>Grand total of PHP and style XML is " number_format($stylelines $total) . " lines of code</b>";
?>


Dean C 12-01-2004 05:12 PM

That's cheating - why not do it recursively and filter out any non PHP extensions ;)

Dean C 12-01-2004 05:29 PM

Badda bing badda boom:

PHP Code:

<?php

$path 
$_SERVER['DOCUMENT_ROOT'] . '/dev/';
$total map_dirs($path);
echo 
'<br /><br /><b>Total Lines = ' number_format($total) . '</b>';

function 
get_file_extension($filename)
{
    return 
substr(strrchr($filename'.'), 1);
}

function 
map_dirs($path)
{
    static 
$total_lines 0;
    if(
is_dir($path))
    {
        if(
$contents opendir($path))
        {
            while((
$node readdir($contents)) !== false)
            {
                if(!
in_array($node, array('.''..')))
                {

                    if(
is_dir($path '/' $node)) 
                    {
                        echo 
'<br /><b>' $node '</b>';
                    }
                    else if(
get_file_extension($node) == 'php')
                    {
                        
$linecount sizeof(file($path '/' $node));
                        
$total_lines $total_lines $linecount;
                        echo 
'<br />---- ' $node ' (Lines: ' number_format($linecount) . ')';
                    }
                    
                    
map_dirs($path '/' $node);
                }
            }
        }
    }
    return 
$total_lines;
}
 
?>


assassingod 12-01-2004 06:03 PM

Quote:

Originally Posted by Dean C
Badda bing badda boom:

Bravo!


All times are GMT. The time now is 12:31 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01236 seconds
  • Memory Usage 1,769KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete