Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP
Author Message
testy1
Involved
Involved



Joined: Apr 06, 2008
Posts: 484

PostPosted: Wed Nov 18, 2009 2:30 am Reply with quote

Ive been thinking about this today.Is my train of thought on the right track here.

if we used functions for checking if a file exists, in a basic ravennuke installation this could cut out as much as 600 lines of code

Code:


function _include_once($file) {
   if (file_exists($file)) {
      include_once($file);
   }
}
 
function _require_once($file) {
   if (file_exists($file)) {
      require_once($file);
   }
}
 
View user's profile Send private message
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Wed Nov 18, 2009 5:11 am Reply with quote

include() and require() are already native PHP functions but I see what your driving at.
 
View user's profile Send private message Send e-mail
Palbin
Site Admin



Joined: Mar 30, 2006
Posts: 2583
Location: Pittsburgh, Pennsylvania

PostPosted: Wed Nov 18, 2009 6:33 am Reply with quote

I get what you are talking about, but since it is doing the exact same thing. The difference in not loaded a few lines of text server side is really insignificant.

_________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan. 
View user's profile Send private message
testy1







PostPosted: Wed Nov 18, 2009 4:04 pm Reply with quote

ok, thanks, that makes sense.
 
evaders99
Former Moderator in Good Standing



Joined: Apr 30, 2004
Posts: 3221

PostPosted: Fri Nov 20, 2009 1:20 am Reply with quote

include and include_once aren't necessarily the same thing. Granted phpNuke generally only needs include_once, rarely should be including a file twice.
[ Only registered users can see links on this board! Get registered or login! ]
Require emits a fatal error, in that respect a file_exists check is nice to have.

_________________
- Star Wars Rebellion Network -

Need help? Nuke Patched Core, Coding Services, Webmaster Services 
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> PHP

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©