php-general Digest 22 Jul 2011 19:06:12 -0000 Issue 7411

2011-07-22 Thread php-general-digest-help

php-general Digest 22 Jul 2011 19:06:12 - Issue 7411

Topics (messages 314148 through 314167):

dependency check
314148 by: Andreas Moroder
314150 by: Nilesh Govindarajan
314154 by: Alex Nikitin
314156 by: Nilesh Govindarajan
314158 by: Alex Nikitin
314167 by: Ashley Sheridan

Re: PHP frameworks
314149 by: Richard Quadling
314151 by: Floyd Resler
314152 by: Richard Quadling
314153 by: Floyd Resler

SOAP client and SSL version 3
314155 by: Pawel Furtak

File concurrent file access
314157 by: Florian Lemaitre
314159 by: Jonathan Tapicer

Escaping '
314160 by: Floyd Resler
314161 by: Daniel Brown
314162 by: Geoff Lane
314163 by: Richard Quadling
314164 by: Richard Quadling
314165 by: Floyd Resler
314166 by: Floyd Resler

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---

Hallo,

I have a PHP application made of many files ( php, images etc. )
I have a strong suspicion that many of the files in the application 
directory are no more in use, because of changes made on the application.
Is there a tool that, starting from the entry point of the application, 
 scans the files recursively for included/used files and lists them ?

With this list I could delete the remaining files.

Thanks
Andreas

---End Message---
---BeginMessage---
On 07/22/2011 11:21 AM, Andreas Moroder wrote:
 Hallo,
 
 I have a PHP application made of many files ( php, images etc. )
 I have a strong suspicion that many of the files in the application
 directory are no more in use, because of changes made on the application.
 Is there a tool that, starting from the entry point of the application,
  scans the files recursively for included/used files and lists them ?
 With this list I could delete the remaining files.
 
 Thanks
 Andreas
 
 

You could write a python or even php script to do that, storing all the
files an array/list and then finding files (regex) which are not
included in any of the php files.

Of course, this applies if and only if you haven't used __autoload() magic.

-- 
Regards,
Nilesh Govindarajan
@nileshgr on twitter/identica
---End Message---
---BeginMessage---
On Fri, Jul 22, 2011 at 8:17 AM, Nilesh Govindarajan
cont...@nileshgr.comwrote:

 On 07/22/2011 11:21 AM, Andreas Moroder wrote:
  Hallo,
 
  I have a PHP application made of many files ( php, images etc. )
  I have a strong suspicion that many of the files in the application
  directory are no more in use, because of changes made on the application.
  Is there a tool that, starting from the entry point of the application,
   scans the files recursively for included/used files and lists them ?
  With this list I could delete the remaining files.
 
  Thanks
  Andreas
 
 

 You could write a python or even php script to do that, storing all the
 files an array/list and then finding files (regex) which are not
 included in any of the php files.

 Of course, this applies if and only if you haven't used __autoload() magic.

 --
 Regards,
 Nilesh Govindarajan
 @nileshgr on twitter/identica

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



Or you could just grep the directory, not saying you have to do this, but
this was kind of fun to write anyways, if i spent more time on it, i could
perfect it, but i dont have that kind of time, so this will still give you a
few doubles, but it shouldn't give you false-positives as long as you have
all the extensions in that grep regex (and you cant make it more generic
without introducing false-positives)...

grep -oiPR [a-zA-Z0-9]+\.(php|js|png|
jpg|css|htm|html) directory | awk 'function getfiles(input, files, i, n,
file) {result = ; n=split(input, files, :); for(i=0; i=n; i++) {
if(files[i] !~ /^\s*$/) print files[i];}} {getfiles($0)}' | sort -biu

This should give you all the files that reference files and the files they
reference.

--
The trouble with programmers is that you can never tell what a programmer is
doing until it’s too late.  ~Seymour Cray
---End Message---
---BeginMessage---
On 07/22/2011 06:56 PM, Alex Nikitin wrote:
 
 
 Or you could just grep the directory, not saying you have to do this,
 but this was kind of fun to write anyways, if i spent more time on it, i
 could perfect it, but i dont have that kind of time, so this will still
 give you a few doubles, but it shouldn't give you false-positives as
 long as you have all the extensions in that grep regex (and you cant
 make it more generic without introducing false-positives)...
 
 grep -oiPR [a-zA-Z0-9]+\.(php|js|png|
 jpg|css|htm|html) 

[PHP] dependency check

2011-07-22 Thread Andreas Moroder

Hallo,

I have a PHP application made of many files ( php, images etc. )
I have a strong suspicion that many of the files in the application 
directory are no more in use, because of changes made on the application.
Is there a tool that, starting from the entry point of the application, 
 scans the files recursively for included/used files and lists them ?

With this list I could delete the remaining files.

Thanks
Andreas


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: PHP frameworks

2011-07-22 Thread Richard Quadling
On 21 July 2011 23:56, Shawn McKenzie nos...@mckenzies.net wrote:
 On 07/21/2011 03:59 PM, Chris Stinemetz wrote:
 Hello all,

 I am thinking about venturing into PHP frameworks, but I would like to
 get advice on what the correct selection would be for someone that is
 about intermediate in PHP knowledge.

 Thank you,

 So, with your post you will probably get one or more replies suggesting
 every one of the popular frameworks and then several that suggest some
 lesser known ones.

 I think Zend looks great, but for many people (including me) it is
 overly complex and cumbersome.  It is a very professional and
 standardised class library, but has no glue to put it all together for
 you. Also, it takes OOP to the extreme (for PHP anyway).  Everything has
 abstract classes, interfaces and the like.

 CI is good from a lightweight, gives you something to build on perspective.

 I however prefer CakePHP.  Its been around for a while, it can
 automatically build an app from just a well designed database and
 doesn't require configuration files in XML, YAML or what have you.  The
 documentation is OK and could be much better.

 It really depends on what you want out of the framework.  I would
 suggest going through the CakePHP and CI tutorials and seeing which one
 seems like a good fit for you.


I use a combination of Zend Framework (Soap and Config), PEAR (for
Console_CommandLine) and my own code developed along the lines of Zend
Framework.

I think the What framework is best question can be partially
answered by asking which framework allow you the greatest degree of
flexibility.

I don't have to use any part of Zend that I don't want. Same with PEAR.

Having said that, none of these frameworks will write your app for
you. Others may, based upon various rules or file structures.



-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] dependency check

2011-07-22 Thread Nilesh Govindarajan
On 07/22/2011 11:21 AM, Andreas Moroder wrote:
 Hallo,
 
 I have a PHP application made of many files ( php, images etc. )
 I have a strong suspicion that many of the files in the application
 directory are no more in use, because of changes made on the application.
 Is there a tool that, starting from the entry point of the application,
  scans the files recursively for included/used files and lists them ?
 With this list I could delete the remaining files.
 
 Thanks
 Andreas
 
 

You could write a python or even php script to do that, storing all the
files an array/list and then finding files (regex) which are not
included in any of the php files.

Of course, this applies if and only if you haven't used __autoload() magic.

-- 
Regards,
Nilesh Govindarajan
@nileshgr on twitter/identica

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP frameworks

2011-07-22 Thread Floyd Resler

On Jul 21, 2011, at 11:41 PM, Micky Hulse wrote:

 On Thu, Jul 21, 2011 at 6:44 PM, Shawn McKenzie nos...@mckenzies.net wrote:
 A la CakePHP.  Will automagically build controllers and views for the
 admin of your tables/models if you wish.
 
 Oooh, interesting! I will check out CakePHP! Thanks for tip! :)
 

I actually use my own framework.  I needed a very light weight, flexible 
framework.  I designed it from the ground up to be very flexible and to use 
AJAX and jQuery on the client side.  If you'd be interested in check it out, 
just let me know and I'll give you a link to the source code.

Take care,
Floyd


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP frameworks

2011-07-22 Thread Richard Quadling
On 22 July 2011 13:26, Floyd Resler fres...@adex-intl.com wrote:

 On Jul 21, 2011, at 11:41 PM, Micky Hulse wrote:

 On Thu, Jul 21, 2011 at 6:44 PM, Shawn McKenzie nos...@mckenzies.net wrote:
 A la CakePHP.  Will automagically build controllers and views for the
 admin of your tables/models if you wish.

 Oooh, interesting! I will check out CakePHP! Thanks for tip! :)


 I actually use my own framework.  I needed a very light weight, flexible 
 framework.  I designed it from the ground up to be very flexible and to use 
 AJAX and jQuery on the client side.  If you'd be interested in check it out, 
 just let me know and I'll give you a link to the source code.

 Take care,
 Floyd


http://www.brandonsavage.net/why-every-developer-should-write-their-own-framework/


-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP frameworks

2011-07-22 Thread Floyd Resler

On Jul 22, 2011, at 8:33 AM, Richard Quadling wrote:

 On 22 July 2011 13:26, Floyd Resler fres...@adex-intl.com wrote:
 
 On Jul 21, 2011, at 11:41 PM, Micky Hulse wrote:
 
 On Thu, Jul 21, 2011 at 6:44 PM, Shawn McKenzie nos...@mckenzies.net 
 wrote:
 A la CakePHP.  Will automagically build controllers and views for the
 admin of your tables/models if you wish.
 
 Oooh, interesting! I will check out CakePHP! Thanks for tip! :)
 
 
 I actually use my own framework.  I needed a very light weight, flexible 
 framework.  I designed it from the ground up to be very flexible and to use 
 AJAX and jQuery on the client side.  If you'd be interested in check it out, 
 just let me know and I'll give you a link to the source code.
 
 Take care,
 Floyd
 
 
 http://www.brandonsavage.net/why-every-developer-should-write-their-own-framework/
 

Good article!  I knew there was a reason why I never released mine but just 
offer it up on occasion to someone who might find it useful!  :)

Take care,
Floyd



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] SOAP client and SSL version 3

2011-07-22 Thread Pawel Furtak
Hello,
I'm trying to enforce ssl version 3 for PHP Soap client.
Is it possible somehow ?


Pawel

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] dependency check

2011-07-22 Thread Nilesh Govindarajan
On 07/22/2011 06:56 PM, Alex Nikitin wrote:
 
 
 Or you could just grep the directory, not saying you have to do this,
 but this was kind of fun to write anyways, if i spent more time on it, i
 could perfect it, but i dont have that kind of time, so this will still
 give you a few doubles, but it shouldn't give you false-positives as
 long as you have all the extensions in that grep regex (and you cant
 make it more generic without introducing false-positives)...
 
 grep -oiPR [a-zA-Z0-9]+\.(php|js|png|
 jpg|css|htm|html) directory | awk 'function getfiles(input, files, i,
 n, file) {result = ; n=split(input, files, :); for(i=0; i=n; i++) {
 if(files[i] !~ /^\s*$/) print files[i];}} {getfiles($0)}' | sort -biu
 
 This should give you all the files that reference files and the files
 they reference.
 
 --
 The trouble with programmers is that you can never tell what a
 programmer is doing until it’s too late.  ~Seymour Cray
 

It is possible to use the shell tools, but it is a big trouble to handle
spaces and special characters in shell scripting if your filenames have
them, quite rare with self created applications, but you can't say, and
hence I suggested python/php script method.

-- 
Regards,
Nilesh Govindarajan
@nileshgr on twitter/identica

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] dependency check

2011-07-22 Thread Alex Nikitin
On Fri, Jul 22, 2011 at 8:17 AM, Nilesh Govindarajan
cont...@nileshgr.comwrote:

 On 07/22/2011 11:21 AM, Andreas Moroder wrote:
  Hallo,
 
  I have a PHP application made of many files ( php, images etc. )
  I have a strong suspicion that many of the files in the application
  directory are no more in use, because of changes made on the application.
  Is there a tool that, starting from the entry point of the application,
   scans the files recursively for included/used files and lists them ?
  With this list I could delete the remaining files.
 
  Thanks
  Andreas
 
 

 You could write a python or even php script to do that, storing all the
 files an array/list and then finding files (regex) which are not
 included in any of the php files.

 Of course, this applies if and only if you haven't used __autoload() magic.

 --
 Regards,
 Nilesh Govindarajan
 @nileshgr on twitter/identica

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



Or you could just grep the directory, not saying you have to do this, but
this was kind of fun to write anyways, if i spent more time on it, i could
perfect it, but i dont have that kind of time, so this will still give you a
few doubles, but it shouldn't give you false-positives as long as you have
all the extensions in that grep regex (and you cant make it more generic
without introducing false-positives)...

grep -oiPR [a-zA-Z0-9]+\.(php|js|png|
jpg|css|htm|html) directory | awk 'function getfiles(input, files, i, n,
file) {result = ; n=split(input, files, :); for(i=0; i=n; i++) {
if(files[i] !~ /^\s*$/) print files[i];}} {getfiles($0)}' | sort -biu

This should give you all the files that reference files and the files they
reference.

--
The trouble with programmers is that you can never tell what a programmer is
doing until it’s too late.  ~Seymour Cray


[PHP] File concurrent file access

2011-07-22 Thread Florian Lemaitre

Hi !

I'm developing my new website and I'm worried about concurrent file access.
In fact, I want to suppress a maximum database interactions so I keep 
information in files with faster I/O than databases.
But I'm worried by the fact that an error can occur when someone try to 
access a file being edited by a cron task.


Does PHP do all the stuff itself or is there something to do about it ?

PS: I only use file_get_contents, file_put_contentsand unlink on files.

Best regards.
Florian


Re: [PHP] dependency check

2011-07-22 Thread Alex Nikitin
It would still be quicker with shell tools, imho, granted that some command
line elitistry would be required... Also if you are going to be doing string
parsing and manipulation, and string parsing here is all that you are doing,
there would be no better language than perl to do it with, granted i dont
like perl and prefer python or php or ruby to it, but when you have a lot of
string manipulation, perl has no rival i have used yet, though i guess if
awk were combined with sed, there would be some potential...

--
The trouble with programmers is that you can never tell what a programmer is
doing until it’s too late.  ~Seymour Cray



On Fri, Jul 22, 2011 at 9:33 AM, Nilesh Govindarajan
cont...@nileshgr.comwrote:

 On 07/22/2011 06:56 PM, Alex Nikitin wrote:
 
 
  Or you could just grep the directory, not saying you have to do this,
  but this was kind of fun to write anyways, if i spent more time on it, i
  could perfect it, but i dont have that kind of time, so this will still
  give you a few doubles, but it shouldn't give you false-positives as
  long as you have all the extensions in that grep regex (and you cant
  make it more generic without introducing false-positives)...
 
  grep -oiPR [a-zA-Z0-9]+\.(php|js|png|
  jpg|css|htm|html) directory | awk 'function getfiles(input, files, i,
  n, file) {result = ; n=split(input, files, :); for(i=0; i=n; i++) {
  if(files[i] !~ /^\s*$/) print files[i];}} {getfiles($0)}' | sort -biu
 
  This should give you all the files that reference files and the files
  they reference.
 
  --
  The trouble with programmers is that you can never tell what a
  programmer is doing until it’s too late.  ~Seymour Cray
 

 It is possible to use the shell tools, but it is a big trouble to handle
 spaces and special characters in shell scripting if your filenames have
 them, quite rare with self created applications, but you can't say, and
 hence I suggested python/php script method.

 --
 Regards,
 Nilesh Govindarajan
 @nileshgr on twitter/identica



Re: [PHP] File concurrent file access

2011-07-22 Thread Jonathan Tapicer
On Fri, Jul 22, 2011 at 10:44 AM, Florian Lemaitre
florian.lemai...@evolutioncom.eu wrote:
 Hi !

 I'm developing my new website and I'm worried about concurrent file access.
 In fact, I want to suppress a maximum database interactions so I keep
 information in files with faster I/O than databases.
 But I'm worried by the fact that an error can occur when someone try to
 access a file being edited by a cron task.

 Does PHP do all the stuff itself or is there something to do about it ?

 PS: I only use file_get_contents, file_put_contentsand unlink on files.

 Best regards.
 Florian


With file_put_contents you send a flag to lock the file and avoid
concurrency problems, eg:

file_put_contents('/some/file', 'data', FILE_APPEND | LOCK_EX);

Regards,

Jonathan

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Escaping '

2011-07-22 Thread Floyd Resler
I did a fresh install of PHP on a new server.  I had gotten used to PHP 
automatically adding a backslash before single quotes when form data is 
submitted.  It seems that is shut off in my new install.  How do I turn it back 
on?

Thanks!
Floyd


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Escaping '

2011-07-22 Thread Daniel Brown
On Fri, Jul 22, 2011 at 11:48, Floyd Resler fres...@adex-intl.com wrote:
 I did a fresh install of PHP on a new server.  I had gotten used to PHP 
 automatically adding a backslash before single quotes when form data is 
 submitted.  It seems that is shut off in my new install.  How do I turn it 
 back on?

That's magic quotes, and it's been deprecated for quite some time,
and slated for complete removal.  While you shouldn't rely on it, if
you absolutely need to, just re-enable it in php.ini, .htaccess, or in
your code.

See more: http://php.net/manual/en/security.magicquotes.php

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Escaping '

2011-07-22 Thread Geoff Lane
On Friday, July 22, 2011, Floyd Resler wrote:

 I did a fresh install of PHP on a new server.  I had gotten used to
 PHP automatically adding a backslash before single quotes when form
 data is submitted.  It seems that is shut off in my new install.
 How do I turn it back on?

Check the manual for 'Magic Quotes GPC':
http://php.net/manual/en/security.magicquotes.php

However, you may want to rething enabling this as it's deprecated and
judging by the discussions I've seen it will be removed in the not too
distant future.

HTH,

-- 
Geoff


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Escaping '

2011-07-22 Thread Richard Quadling
On 22 July 2011 16:54, Daniel Brown danbr...@php.net wrote:
 On Fri, Jul 22, 2011 at 11:48, Floyd Resler fres...@adex-intl.com wrote:
 I did a fresh install of PHP on a new server.  I had gotten used to PHP 
 automatically adding a backslash before single quotes when form data is 
 submitted.  It seems that is shut off in my new install.  How do I turn it 
 back on?

    That's magic quotes, and it's been deprecated for quite some time,
 and slated for complete removal.  While you shouldn't rely on it, if
 you absolutely need to, just re-enable it in php.ini, .htaccess, or in
 your code.

    See more: http://php.net/manual/en/security.magicquotes.php

 --
 /Daniel P. Brown
 Network Infrastructure Manager
 http://www.php.net/

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



Unless you are using a self-built V5.4.0 from today onwards.

Magic Quotes was finally removed completely and will give you an
E_CORE_ERROR if you attempt to enable it.

-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: Escaping '

2011-07-22 Thread Richard Quadling
On 22 July 2011 16:56, Geoff Lane ge...@gjctech.co.uk wrote:
 On Friday, July 22, 2011, Floyd Resler wrote:

 I did a fresh install of PHP on a new server.  I had gotten used to
 PHP automatically adding a backslash before single quotes when form
 data is submitted.  It seems that is shut off in my new install.
 How do I turn it back on?

 Check the manual for 'Magic Quotes GPC':
 http://php.net/manual/en/security.magicquotes.php

 However, you may want to rething enabling this as it's deprecated and
 judging by the discussions I've seen it will be removed in the not too
 distant future.

 HTH,

 --
 Geoff

Geoff, more like the dim and distance past
http://svn.php.net/viewvc/php/php-src/branches/PHP_5_4/NEWS?r1=313575r2=313574pathrev=313575

Welcome to the future!

-- 
Richard Quadling
Twitter : EE : Zend : PHPDoc
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Escaping '

2011-07-22 Thread Floyd Resler

On Jul 22, 2011, at 11:54 AM, Daniel Brown wrote:

 On Fri, Jul 22, 2011 at 11:48, Floyd Resler fres...@adex-intl.com wrote:
 I did a fresh install of PHP on a new server.  I had gotten used to PHP 
 automatically adding a backslash before single quotes when form data is 
 submitted.  It seems that is shut off in my new install.  How do I turn it 
 back on?
 
That's magic quotes, and it's been deprecated for quite some time,
 and slated for complete removal.  While you shouldn't rely on it, if
 you absolutely need to, just re-enable it in php.ini, .htaccess, or in
 your code.
 
See more: http://php.net/manual/en/security.magicquotes.php
 

I had forgotten what it was called.  While I don't like having to rely on it, 
I'm dealing with some really old code that does rely on it.  Some day I'll get 
around to rewriting that old stuff!  Thanks for reminding me what it was called!

Thanks!
Floyd



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Escaping '

2011-07-22 Thread Floyd Resler

On Jul 22, 2011, at 12:08 PM, Richard Quadling wrote:

 On 22 July 2011 16:54, Daniel Brown danbr...@php.net wrote:
 On Fri, Jul 22, 2011 at 11:48, Floyd Resler fres...@adex-intl.com wrote:
 I did a fresh install of PHP on a new server.  I had gotten used to PHP 
 automatically adding a backslash before single quotes when form data is 
 submitted.  It seems that is shut off in my new install.  How do I turn it 
 back on?
 
That's magic quotes, and it's been deprecated for quite some time,
 and slated for complete removal.  While you shouldn't rely on it, if
 you absolutely need to, just re-enable it in php.ini, .htaccess, or in
 your code.
 
See more: http://php.net/manual/en/security.magicquotes.php
 
 --
 /Daniel P. Brown
 Network Infrastructure Manager
 http://www.php.net/
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 Unless you are using a self-built V5.4.0 from today onwards.
 
 Magic Quotes was finally removed completely and will give you an
 E_CORE_ERROR if you attempt to enable it.
 
 -- 
 Richard Quadling
 Twitter : EE : Zend : PHPDoc
 @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea
 

Guess I won't be upgrading until I can do some code rewriting.

Take care,
Floyd


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] dependency check

2011-07-22 Thread Ashley Sheridan
On Fri, 2011-07-22 at 09:51 -0400, Alex Nikitin wrote:

 It would still be quicker with shell tools, imho, granted that some command
 line elitistry would be required... Also if you are going to be doing string
 parsing and manipulation, and string parsing here is all that you are doing,
 there would be no better language than perl to do it with, granted i dont
 like perl and prefer python or php or ruby to it, but when you have a lot of
 string manipulation, perl has no rival i have used yet, though i guess if
 awk were combined with sed, there would be some potential...
 
 --
 The trouble with programmers is that you can never tell what a programmer is
 doing until it’s too late.  ~Seymour Cray
 
 
 
 On Fri, Jul 22, 2011 at 9:33 AM, Nilesh Govindarajan
 cont...@nileshgr.comwrote:
 
  On 07/22/2011 06:56 PM, Alex Nikitin wrote:
  
  
   Or you could just grep the directory, not saying you have to do this,
   but this was kind of fun to write anyways, if i spent more time on it, i
   could perfect it, but i dont have that kind of time, so this will still
   give you a few doubles, but it shouldn't give you false-positives as
   long as you have all the extensions in that grep regex (and you cant
   make it more generic without introducing false-positives)...
  
   grep -oiPR [a-zA-Z0-9]+\.(php|js|png|
   jpg|css|htm|html) directory | awk 'function getfiles(input, files, i,
   n, file) {result = ; n=split(input, files, :); for(i=0; i=n; i++) {
   if(files[i] !~ /^\s*$/) print files[i];}} {getfiles($0)}' | sort -biu
  
   This should give you all the files that reference files and the files
   they reference.
  
   --
   The trouble with programmers is that you can never tell what a
   programmer is doing until it’s too late.  ~Seymour Cray
  
 
  It is possible to use the shell tools, but it is a big trouble to handle
  spaces and special characters in shell scripting if your filenames have
  them, quite rare with self created applications, but you can't say, and
  hence I suggested python/php script method.
 
  --
  Regards,
  Nilesh Govindarajan
  @nileshgr on twitter/identica
 



The only problem you may run into is an include that's part of a logic
branch in your code that never gets called under any circumstance (maybe
the logic changed and you no longer require a certain set of functions
for example)

It's also possible that your bigger problem isn't rogue files that
aren't being used but files with lots of unused functions, unused class
methods, etc. Sometimes the only way to find those is by tracing back
all the way from each function/method in turn.

-- 
Thanks,
Ash
http://www.ashleysheridan.co.uk




Re: [PHP] dependency check

2011-07-22 Thread Alex Nikitin
On Fri, Jul 22, 2011 at 3:09 PM, Ashley Sheridan
a...@ashleysheridan.co.ukwrote:

 **
 On Fri, 2011-07-22 at 09:51 -0400, Alex Nikitin wrote:

 It would still be quicker with shell tools, imho, granted that some command
 line elitistry would be required... Also if you are going to be doing string
 parsing and manipulation, and string parsing here is all that you are doing,
 there would be no better language than perl to do it with, granted i dont
 like perl and prefer python or php or ruby to it, but when you have a lot of
 string manipulation, perl has no rival i have used yet, though i guess if
 awk were combined with sed, there would be some potential...

 --
 The trouble with programmers is that you can never tell what a programmer is
 doing until it’s too late.  ~Seymour Cray



 On Fri, Jul 22, 2011 at 9:33 AM, Nilesh Govindarajan
 cont...@nileshgr.comwrote:

  On 07/22/2011 06:56 PM, Alex Nikitin wrote:
  
  
   Or you could just grep the directory, not saying you have to do this,
   but this was kind of fun to write anyways, if i spent more time on it, i
   could perfect it, but i dont have that kind of time, so this will still
   give you a few doubles, but it shouldn't give you false-positives as
   long as you have all the extensions in that grep regex (and you cant
   make it more generic without introducing false-positives)...
  
   grep -oiPR [a-zA-Z0-9]+\.(php|js|png|
   jpg|css|htm|html) directory | awk 'function getfiles(input, files, i,
   n, file) {result = ; n=split(input, files, :); for(i=0; i=n; i++) {
   if(files[i] !~ /^\s*$/) print files[i];}} {getfiles($0)}' | sort -biu
  
   This should give you all the files that reference files and the files
   they reference.
  
   --
   The trouble with programmers is that you can never tell what a
   programmer is doing until it’s too late.  ~Seymour Cray
  
 
  It is possible to use the shell tools, but it is a big trouble to handle
  spaces and special characters in shell scripting if your filenames have
  them, quite rare with self created applications, but you can't say, and
  hence I suggested python/php script method.
 
  --
  Regards,
  Nilesh Govindarajan
  @nileshgr on twitter/identica
 



 The only problem you may run into is an include that's part of a logic
 branch in your code that never gets called under any circumstance (maybe the
 logic changed and you no longer require a certain set of functions for
 example)

 It's also possible that your bigger problem isn't rogue files that aren't
 being used but files with lots of unused functions, unused class methods,
 etc. Sometimes the only way to find those is by tracing back all the way
 from each function/method in turn.

   --
 Thanks,
 Ash
 http://www.ashleysheridan.co.uk



You could actually automate that as well, all your functions are defined
with a function definition, you would build a table of functions and then
traverse the code searching for these functions. Chances are you would have
the majority of functions traced. This leaves out dynamic functions, eval
and some magic methods, dynamic functions and eval are not the best of ideas
to begin with, though i admit, i have had to use them before. But it's not
to say that this would be impossible to solve. There are other ways to do
this too which would be a bit more involved...


--
The trouble with programmers is that you can never tell what a programmer is
doing until it’s too late.  ~Seymour Cray