Go Back   vb.org Archive > Community Central > Community Lounge
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #21  
Old 12-01-2004, 07:00 AM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Shame there's not a tool to do that automatically
Reply With Quote
  #22  
Old 12-01-2004, 08:00 AM
Zero Tolerance's Avatar
Zero Tolerance Zero Tolerance is offline
 
Join Date: Feb 2004
Location: England
Posts: 813
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

- Zero Tolerance
Reply With Quote
  #23  
Old 12-01-2004, 11:54 AM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Oh yeah, that could be done quite easily too

[high]* Dean C codes it[/high]
Reply With Quote
  #24  
Old 12-01-2004, 12:56 PM
Tal-CPO Tal-CPO is offline
 
Join Date: Sep 2004
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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

- 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


Reply With Quote
  #25  
Old 12-01-2004, 01:57 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dean C
Shame there's not a tool to do that automatically
I just wrote a script in PHP...
Reply With Quote
  #26  
Old 12-01-2004, 02:40 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #27  
Old 12-01-2004, 05:07 PM
filburt1 filburt1 is offline
 
Join Date: Feb 2002
Location: Maryland, US
Posts: 6,144
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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>";
?>
Reply With Quote
  #28  
Old 12-01-2004, 05:12 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That's cheating - why not do it recursively and filter out any non PHP extensions
Reply With Quote
  #29  
Old 12-01-2004, 05:29 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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;
}
 
?>
Reply With Quote
  #30  
Old 12-01-2004, 06:03 PM
assassingod's Avatar
assassingod assassingod is offline
 
Join Date: Jul 2002
Posts: 3,337
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Dean C
Badda bing badda boom:
Bravo!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:37 AM.


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.06011 seconds
  • Memory Usage 2,302KB
  • Queries Executed 14 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete