[Mapbender-commits] r2729 - branches/spsneo_dev/build

svn_mapbender at osgeo.org svn_mapbender at osgeo.org
Sat Jul 26 04:35:26 EDT 2008


Author: spsneo
Date: 2008-07-26 04:35:25 -0400 (Sat, 26 Jul 2008)
New Revision: 2729

Added:
   branches/spsneo_dev/build/commandLine.inc
Modified:
   branches/spsneo_dev/build/build-checksum.php
Log:
Documented

Modified: branches/spsneo_dev/build/build-checksum.php
===================================================================
--- branches/spsneo_dev/build/build-checksum.php	2008-07-26 08:26:12 UTC (rev 2728)
+++ branches/spsneo_dev/build/build-checksum.php	2008-07-26 08:35:25 UTC (rev 2729)
@@ -1,34 +1,73 @@
 <?php
 
+#build-checksum.php 
+#@author Siddharth Prakash Singh (spsneo)
+#Google SoC 2008 Project
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Update Script
+# To be executed from command line only.
+
+
+#A constant for the path to the mapbender installation folder
 define("ROOTDIR", "../mapbender");
 
+#check whether this file is being executed from command line or not
+#abort if it is not being executed from command line
+require_once("commandLine.inc");
+
+#This file is required 
 require_once("checksum-utils.inc");
+
+#These are the directories which are not to be scanned and checksum not to be evaluated as these 
+#directories are prone to change and always include "." and ".." in this list.
 $dir_not_to_scan = array();
 array_push($dir_not_to_scan,".", "..", "conf", "license", "log", "resources", "update");
 
 $rootdir_path = ROOTDIR;
+
 //remove slash if it is there at the end of the path
 if(substr($rootdir_path, -1) == '/') {
 	$rootdir_path = substr($rootdir_path, 0 , -1);
 }
 
+#check whether this is a valid directory
 if(!is_dir($rootdir_path)) {
 	echo $rootdir_path." is not a valid directory\n";
 	return FALSE;
 }
 
+#check whether this directory is readable
 if(!is_readable($rootdir_path)) {
 	echo $rootdir_path." is not readable.\nPlease make sure you have privilege to build.\nAborting...";
 	exit();
 }
+
+#initialize the directory
 $rootdir = dir($rootdir_path);
 $rootdir_path = $rootdir->path;
 
 while(false !== ($dir_to_scan = $rootdir->read())) {
 	$dir_to_scan_path = $rootdir_path.'/'.$dir_to_scan;
+	#directories to scan, hidden directories excluded
 	if(is_dir($dir_to_scan_path) && !in_array($dir_to_scan, $dir_not_to_scan) && !preg_match("/^\./", $dir_to_scan)) {
 		echo "Scanning directory: ".$dir_to_scan_path."\n";
 		build_checksum($dir_to_scan_path);
 		echo "All checksums and respective JSON files created for all the files and directories inside ".$dir_to_scan_path."\n\n";
 	}
 }
+
+echo "\n\nDone!\n\n";
+?>

Added: branches/spsneo_dev/build/commandLine.inc
===================================================================
--- branches/spsneo_dev/build/commandLine.inc	                        (rev 0)
+++ branches/spsneo_dev/build/commandLine.inc	2008-07-26 08:35:25 UTC (rev 2729)
@@ -0,0 +1,22 @@
+<?php
+
+#Mapbender Updater File
+#@author Siddharth Prakash Singh (spsneo)
+#Google SoC 2008 Project
+# This file tests whether the update script has been called from command line or browser.
+# Aborts the update process if called from a web browser
+
+
+if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
+	echo "This script must be executed from the command line ";
+	exit();
+}
+
+if(PHP_SAPI != 'cli') {
+echo "This script must be executed from the command line.";
+exit();
+}
+
+#Set the execution time to infinity
+ at set_time_limit( 0 );
+?>



More information about the Mapbender_commits mailing list