Do you know a tool that can scan a tree of PHP files (but also web-related files such as HTML or CSS, anything that can include other files - I want to emphasize that the tool must be able to recursively scan a directory and be aware of include, require, @import, <x src> and other known including directives) and tell what files are independent.
More exactly, I want a tool to find old unused files in my PHP projects so I can zap them.
Remove Error Warnings Made By Tpl Files In Eclipse Project?
i installed eclipse 3.5.2 with php support and when i created my php project all tpl files appeared with errors, seem to be searching zend_debugger, how do i remove that errors for the sake of keep my code flow normal with no red warns everywhere?
A Trick To Find Unused Files (Drupal Template Files)?
I am looking for a trick to find included files that are not in use. Preferrably not by going trough them by hand. This project has over 400 of such files, 100 are probably unused by now.They are Drupal template files (tpl.php) and were placed in the theme/template during development and -as always- were never removed when obsoleted.
Things I have thought of:
* maintain a register in the database or a log, and spider the site. All files that don't appear in the log are candidates for removal, and need manual checking.
* use a file-profiling tool such as cachegrind to render call-stacks: the files should appear in there somehow. I have no idea, however, how to get this done.
Problem in Drupal templates, is that they are very dynamic, so simply grepping for include_once() and the likes does not work.
I'm using NetBeans, but would be grateful for any FOSS tool which identifies functions that are never called (plus files which contain only such functions, or files which are never included and never a form action (i.e. never used)).
I might try using PHPdoc to identify such cases, but just wondered if there are any specialized tools (especially for use with NetBeans).
Keeping Track Of Links Or References To Image Files And Deleting Unused Ones (Database)?
I need a way to remove "unused" images from my filesystem, i.e. images that are never accessed from any point in my website (doesn't matter if I break external links. I might disable external hotlinking altogether). What's the best way of going about this?Regular users can add multiple attachments to topics/posts and content contributers can bulk upload large numbers of images which can be used in articles or image galleries.The problem is that the images could be referenced in any of the following ways:From user content (text/html, possibly Markdown or BBCode) stored in the databaseHardcoded into an HTML pageHardcoded into a PHP fileHardcoded into a CSS fileAs an "attachment" field in a database table, usually containing only the filename itself with no path, because the application assumes that it would be in a certain folder.And to top it off, the path of the image could be an absolute or relative HTTP or PHP path and may or may not be built with string concatenation in PHP.
So obviously find/replace or regexing the database or filesystem is out of the question.But luckily for you and me, this system isn't fully implemented yet and I don't need anything that deals with an existing hoard of images. I just need to set up some efficient structure that will allow this in the future.Some ideas I've thought of:Intercepting the HTTP request for the image with PHP, and keeping track of the HTTP_REFERER. The problem with this is that just because no one has clicked on a link at the time of checking this doesn't mean the link doesn't exist.Use extreme database normalization - i.e. make a table for images and use foreign keys for anything that references it. However this would result in making a metric craptonne of many-to-many relationships (and the crosstables) in addition to being impractical for any regular user to use.Backup all the images and delete them, and check every single 404 request and run a script each time that attempts to find the image from the backup folder and puts it in the "real" folder. The problem is that this cache would have to be purged every so often and the server might be strained when rebuilding the cache.Ideas/suggestions? Is this just something you have to ignore and live with even if you're making a site with a ridiculous amount of images? Even if it's not worth it, how would something work just for proof-of-concept (I added the garbage-collection tag just because this might be going into that area conceptually).
I have created two applications in my symfony project, but my second application i can only access using .php extension. example [URL] I want to remove the .php extension from the backend project, is possible?
How do I find all files (php, html, gif, jpg,) NOT used, starting from index.php, out of a project containing about 200 files without having to read every line of every file looking for includes or links etc.?
I am searching a kind of software engineering document about PHP. This document should give advices about PHP project organisation (structure of files, directories, names). Shall I organize hierachically and how (a main directory, a directory for php files, for html files ...)? How to use "base" request in HTML under PHP and that sort of things.
I used the Netbeans, and I tried to save my files in the folder 'htdocs' of apache server. However, it seems that the permission needs to be changed for that folder or something because I could not be able to save them there. Could you tell me what sould I do?
Use Netbeans for PHP development, get in Netbeans a selection from a list of files quickly.Suppose there are different folders for MVC pattern and edit 1 section of it.The 3 files that I work with only now.Want to get files from all folders that ends in:"_suffix.php".
Dynamically Controll Paths In Static CSS Files With MVC Code Igniter Project?
I'm creating a website/codeigniter-project that uses views which link to external CSS files.Everywhere throughout my project/web-page's views I can control the url paths of images, links, etc by constructing them from the 'base_url' setting variable. I don't have any control over static, linked external css files. This means that whenever my base url path changes for my site I have to go through my css files and do global search/replaces to update all my paths.
Get E Text Editor To Upload Local Copy Of Project Files To Server?
I have a project saved locally on my computer, that replicates a folder saved on my server. When I use my php IDE (PhpEd) and save a change to the locally saved file, it automatically updates the respective file on my server. Can I customize E Text Editor to do this also? It would save lots of time!
I was wondering: is there a way in PHP to get some messages from the VM if a code includes unused or wrongly named variables? I find it helpful in finding coding mistakes when using other programming language.
Encryption - File Verification System Project Or Licence Checking The Configuration Files?
My colleague asked me a question like "license check to config file".
when i searched i got this
and in the result i got this (URL) but could not grasp much of its idea.
Here is my thoughts...
Our project is written in codeigniter. The project owner is providing it to their customer. The owner is a business partner with that concept. Besides, the owner needs control of the project code so that the customer will not break rules with him like changing the code or moving it go another server or validity.
So the owner needs a system to enable disable the site. Let me give an example...
(URL) will have an admin panel where he can either disable or enable the (URL)
when he disables the client.com should display a custom message instead of loading the files.
(URL) is written i a way that i will process requests from (URL) and also the other way round.
so, here i want a list of the concepts with which we can implement the ownership and control over (URL)
any suggestions, links, references, answers will be helpful.
If i am missing something in my question i will update my question according to your comments if any so that the users can give in their idea without confusing of what i had asked.
Keeping Track Of File Dependencies Across Multiple Files In A Medium-size Project?
My PHP code is split between many files, and often I find myself using code like this this:
require_once( "$preIP/functions.php" );
The problem is that I have to keep using this a lot, and sometimes these statements are becoming redundant.What kind of system do yo use/would recommend for keeping track of all the inter-dependencies in all the PHP files?
I am having one column which contains unique ids and if user deletes that id then that id is removed. Now what I want is that if I provide a range to a query then it should give me that ids that i have deleted. For example I am having 10 records in table & I want 5 records from it and if record number 4 is deleted then it should give me output as 4. How can I do this using single query?
I'm creating a language system for my script, and I was wondering:
When I look at large scripts like PHP-Nuke, or phpBB, I see that they're calling a file with 100's, if not thousands of lang constants in it, to load a page that may only use 20 of the definitions.
Does the script only load the definitions it needs? Is there any ill impact at all when loading a page that large just to use a couple of them?
I'm considering using separate lang files(like I've seen in Zen-Cart) so the lang file being loaded is smaller. My script is pretty tiny to begin with, but I'm trying to do these things to learn how to code smart.
On a site where 90% of the pages use the same libraries, should you just load the libraries all the time or only load them when needed? The other pages would be ajax or simple pages that don't have any real functionality. Also, should you only load the code when needed? If part way down a page you need a library, should you load it then or just load it at the top. Maybe it's possible it may never get there before of an error or wrong data. (Loading at the top makes it somewhat easier to understand, but may result in extra code not needed.)
I'm also wondering if I should make the libraries more specific so I'm not say loading the code to edit at the same time as viewing? Basically, how much should I worry about loading code or not loading code?
I haven't bothered to check memory usage until recently installing the (awesome, but gigantic) 'HTML Purifier' library and glancing at its autoloader. Apparently, autoloader on not, each script instance now weighs in at a whopping (sweet jesus!) 5376 kilobytes memory usage. (I have no idea what the built-in autoloader is for if that's the end result, but I digress) Without the HTML Purifier, most instances still weight in at over a megabyte.
Reading about the PHP autoload functions I'm getting the impression that the autoloader is meant strictly for OOP. With the exception of the purifier library, I'm using very little object-oriented code. Am I just misunderstanding the concept? Is there any other practical way to avoid blindly loading a bunch of classes that may not be needed for each request? Am I just being lazy for trying to include them all up-front?
Repeating this comment up up here to clarify what I meant by non-oo, if that makes much difference:
I am basically using classes in lieu of namespaces without using (hardly) any actual OOP. That is to say, the "DBFunctions" class may contain, for example, the functions "execute" and "getRow". The functions are invoked with a static method call such as "dbFunctions::execute($sql)."
Converting A Frozen Production Symfony Project Back To Development Project?
converting a production version of a symfony project which is in frozen state back to a development state so I can work on the project locally. I need to do this because I'm having to download the latest working copy from the server down onto my personal macbook so that I can work on some files over this evening and the SVN is currently not to the latest revision and I don't have the latest copy on here!
somewhere, somehow, my host decided to remove INNODB tables from the list of allowed table types and this has given me some problems. In order to reclaim unused keys I used to do a simple 'ALTER TABLE $table TYPE=INNODB'
and I would be able to re-use purged keys. Somehow, this wont work. Well, the query succeeds apperently, but the deleted keys still exist and the next autoindex is way to high.
A OPTIME query doesnt work either. #*$! am I doing wrong, or what can I do to fix this?