[pLog-svn] r620 - in plog/trunk: . class/file/finder locale

ork at devel.plogworld.net ork at devel.plogworld.net
Thu Dec 30 13:27:23 GMT 2004


Author: ork
Date: 2004-12-30 13:27:23 +0000 (Thu, 30 Dec 2004)
New Revision: 620

Modified:
   plog/trunk/class/file/finder/filefinder.class.php
   plog/trunk/locale/locale_de_DE.php
   plog/trunk/locale/locale_ru_RU.php
   plog/trunk/wizard.php
Log:
added findBinary() method to FileFinder, so the misc/filefinder class is
not needed anymore. used the new method in wizard.php and added a
LocaleFinder to wizard.php to scan for available locales at db
initialisation. 
the locales de and ru did not have a description, so i added that as
well. 


Modified: plog/trunk/class/file/finder/filefinder.class.php
===================================================================
--- plog/trunk/class/file/finder/filefinder.class.php	2004-12-30 10:58:06 UTC (rev 619)
+++ plog/trunk/class/file/finder/filefinder.class.php	2004-12-30 13:27:23 UTC (rev 620)
@@ -74,6 +74,29 @@
 
 			return true;
 		}
+
+        function findBinary( $binary, $searchFolders ) {
+            if( $searchFolders == null )
+                $searchFolders = Array( $this->_folder );
+
+			$found = false;
+			$i = 0;
+			while( !$found && $i < count($searchFolders)) {
+				// get the current folder
+				$currentFolder = $searchFolders[$i];
+				// see if the file's there
+				$fullPath = $currentFolder.$binary;
+				if( File::isReadable( $fullPath )) 
+					$found = true;
+				else
+					$i++;
+			}
+			
+			if( $found ) 
+				return $fullPath;
+			else
+				return "";
+        }
 	
 		/**
 		 * returns all the new items that are not in the list that was passed as a parameter to the
@@ -86,4 +109,4 @@
 			return( $this->_new );
 		}
 	}
-?>
\ No newline at end of file
+?>

Modified: plog/trunk/locale/locale_de_DE.php
===================================================================
--- plog/trunk/locale/locale_de_DE.php	2004-12-30 10:58:06 UTC (rev 619)
+++ plog/trunk/locale/locale_de_DE.php	2004-12-30 13:27:23 UTC (rev 620)
@@ -7,6 +7,8 @@
 //
 // set this to the encoding that should be used to display the pages correctly
 $messages["encoding"] = "iso-8859-1";
+$messages["locale_description"] = "Deutsche (german) Lokalisierung f&uuml;r pLog";
+
 // days of the week
 $messages["days"] = Array( "Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag" );
 // -- compatibility, do not touch -- //
@@ -655,4 +657,4 @@
 $messages["register_error_adding_user"] = "Error adding the user: ";
 $messages["register_error_creating_blog"] = "There was an error creating the new blog";
 $messages["register_error_blog_name"] = "You should choose a better name for the blog.<br/>" ;
-?>
\ No newline at end of file
+?>

Modified: plog/trunk/locale/locale_ru_RU.php
===================================================================
--- plog/trunk/locale/locale_ru_RU.php	2004-12-30 10:58:06 UTC (rev 619)
+++ plog/trunk/locale/locale_ru_RU.php	2004-12-30 13:27:23 UTC (rev 620)
@@ -1,6 +1,8 @@
 <?php
 // set this to the encoding that should be used to display the pages correctly
 $messages["encoding"] = "utf-8";
+$messages["locale_description"] = "Russian locale file for pLog";
+
 // days of the week
 $messages["days"] = Array( "воскресенье", "понедельник", "вторник", "среда", "четверг", "пятница", "суббота" );
 // -- compatibility, do not touch -- //
@@ -641,4 +643,4 @@
 $messages["register_error_adding_user"] = "Error adding the user: ";
 $messages["register_error_creating_blog"] = "There was an error creating the new blog";
 $messages["register_error_blog_name"] = "<li>You should choose a better name for the blog.<br/>" ;
-?>
\ No newline at end of file
+?>

Modified: plog/trunk/wizard.php
===================================================================
--- plog/trunk/wizard.php	2004-12-30 10:58:06 UTC (rev 619)
+++ plog/trunk/wizard.php	2004-12-30 13:27:23 UTC (rev 620)
@@ -29,11 +29,12 @@
     include_once( PLOG_CLASS_PATH."class/dao/userpermissions.class.php" );
     include_once( PLOG_CLASS_PATH."class/misc/version.class.php" );
     include_once( PLOG_CLASS_PATH."class/file/file.class.php" );
-    include_once( PLOG_CLASS_PATH."class/misc/filefinder.class.php" );
+    include_once( PLOG_CLASS_PATH."class/file/finder/filefinder.class.php" );
     include_once( PLOG_CLASS_PATH."class/gallery/resizers/gddetector.class.php" );
     include_once( PLOG_CLASS_PATH."class/config/configfilestorage.class.php" );
-	include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
-	include_once( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+    include_once( PLOG_CLASS_PATH."class/data/textfilter.class.php" );
+    include_once( PLOG_CLASS_PATH."class/locale/locales.class.php" );
+    include_once( PLOG_CLASS_PATH."class/locale/localefinder.class.php" );
 
     define( "TEMP_FOLDER", "./tmp" );
 
@@ -853,13 +854,14 @@
              $plogUrl = $httpProtocol.$httpHost.$requestUrl;
 
             // Find some of the tools we are going to need (last one is for os x, with fink installed)
+            // TBD: support for Windows specific directories
             $folders = Array( "/bin/", "/usr/bin/", "/usr/local/bin/", "/sw/bin/" );
-            $finder = new FileFinder( $folders );
-            $pathToUnzip = $finder->find( "unzip" );
-            $pathToTar = $finder->find( "tar" );
-            $pathToGzip = $finder->find( "gzip" );
-            $pathToBzip2 = $finder->find( "bzip2" );
-            $pathToConvert = $finder->find( "convert" );
+            $finder = new FileFinder();
+            $pathToUnzip = $finder->findBinary( "unzip", $folders );
+            $pathToTar = $finder->findBinary( "tar", $folders);
+            $pathToGzip = $finder->findBinary( "gzip", $folders);
+            $pathToBzip2 = $finder->findBinary( "bzip2", $folders);
+            $pathToConvert = $finder->findBinary( "convert", $folders);
 
             // and execute some insert's
             foreach( $Inserts as $insert ) {
@@ -915,7 +917,17 @@
                 $this->_view = new WizardView( "step2" );
                 $this->_view->setValue( "message", $message );                
             }
-			
+
+            // Scan for locales
+            $locales = new Locales();
+            // find all the new locales that we have not yet stored
+            $f = new LocaleFinder();
+            $newLocaleCodes = $f->find();
+
+            foreach( $newLocaleCodes as $newLocaleCode ) {
+                $res = $locales->addLocale( $newLocaleCode );
+            }
+
 			return true;
         }
     }




More information about the pLog-svn mailing list