Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // =======================================================================================
- // Script for checking file changes and if there's changes - replace with an old version
- // Really I don't know who need it, use freely everywhere!
- //
- // File list settings:
- // $files[number] = array('path/to/source.file', 'path/to/file_we_need_to.check');
- //
- // You can choose relative or absolut path
- // =======================================================================================
- $files[0] = array('src/js.js', 'dest/js.js');
- $files[1] = array('src/js.js', 'dest/js.js');
- // =======================================================================================
- // Keep this safe :)
- header('Content-Type: text/html; charset=utf-8');
- foreach ($files AS $onefile) {
- $sfile = sha1_file($onefile[0]);
- $dfile = sha1_file($onefile[1]);
- if ($sfile!=$dfile) {
- echo "There's changes in '".$dfile."'. Rewriting...<br />";
- if (!copy($onefile[0], $onefile[1])) {
- echo "We have a problem copying '".$onefile[0]."'...\n";
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement