1) A fresh backup copy of your website in a local folder (e.g.: c:\temp\backup);
2) The original version of Zen Cart that is powering your website in another folder (e.g.: c:\temp\zencart).
You can copy the following script, paste in a new document, save as a php file and run from a web server. Just make sure to rename the path to the backup and original if diferent than those listed in the script.
<?php
if($_POST['ftype']!=""){
$backup = "c:\\temp\\backup"; //path to the lattest backup of the website $original = "C:\\temp\\zencart"; //path to the original version of zen cart $v=""; //will pass $backup to function $o=""; //will pass $original to function
$t=$_POST['ftype']; //will pass the desired filetype (from dropdown) to function $s=strlen($_POST['ftype']); //will pass the length of the string for the desired file type to function $l=strlen($backup)+1;
function compareSites($v,$o,$t,$s,$l){
$item = array_diff(scandir($v), Array( ".", ".." )); //generates an array with all elements of the current directory except dot and double-dot foreach( $item as $i ){ //loops through each element of the array if( is_dir($v."\\".$i) ){ //if the element is a directory (not a file) if($i!="images" and $i!="CVS"){ //if the directory is not the images directory if(!file_exists($o."\\".$i)){
if($t=="ALL"){
echo "<strong>[".substr($v."\\".$i,$l)."]</strong><br>\n";
}
}else{
compareSites( $v."\\".$i,$o."\\".$i,$t,$s,$l); //run the function against that directory
}
}
}else{ //the current element is a file $ft=strtoupper(substr($i,-$s,$s)); //$ft receives filetype from file at backup site if($ft==$t or $t=="ALL"){ //compares $ft with $t which holds the filetype requested (e.g.: .txt) if(!file_exists($o."\\".$i)){ echo substr($v."\\".$i,$l)."<br>\n"; } //if the file does not exist in original install of zen cart display file with path
}
}
}
} //end function
if($_POST['btnSubmit']){
compareSites($backup,$original,$t,$s,$l);
}
}
?>
<div style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:14px; margin:10px;">Select the file type you want to compare to get a list of files from your website's backup copy that are not available in the original install of the shopping cart:
<form name="frmCompare" id="frmCompare" action="index.php" method="post">
<select name="ftype">
<option></option>
<option value=".PHP">php</option>
<option value=".HTM">htm</option>
<option value=".HTML">html</option>
<option value=".JS">js</option>
<option value=".JPG">jpg</option>
<option value=".GIF">gif</option>
<option value=".PNG">png</option>
<option value=".TXT">txt</option>
<option value="ALL">ALL: Files and Folders</option>
</select>
<input type="submit" name="btnSubmit" id="btnSubmit" value="Check"
</form>
</div>
Excellent Job!
ReplyDeleteZen Cart Templates
Yoda, Can you help me with a zen cart customization project? Imminent request!! please contact me. www.webmediainteractive.com
ReplyDeleteA very useful blog on Zen Cart.. I will follow you suggestions and I think this is going to help me out as I am working on my Ecommerce website. Thanks for sharing the useful information with us. Ecommerce website developer
ReplyDelete