[Solar-svn] Revision 3005

pmjones at solarphp.com pmjones at solarphp.com
Mon Mar 17 14:55:36 CDT 2008


Solar_Cli_MakeModel

* [FIX] Make the class directory if it doesn't exist.  Thanks for the patch, Andreas Ravnestad.

* [CHG] Use 0755 for directories, not 0777.


Modified: trunk/Solar/Cli/MakeModel.php
===================================================================
--- trunk/Solar/Cli/MakeModel.php	2008-03-17 19:53:06 UTC (rev 3004)
+++ trunk/Solar/Cli/MakeModel.php	2008-03-17 19:55:36 UTC (rev 3005)
@@ -94,6 +94,15 @@
             $this->_tpl['model']
         );
         
+        // create the class dir before attempting to write the model class
+        $cdir = Solar_Dir::fix(
+            $this->_target . str_replace('_', '/', $class)
+        );
+        
+        if (! file_exists($cdir)) {
+            mkdir($cdir, 0755, true);
+        }
+        
         // write the model class
         $target = $this->_target
                 . str_replace('_', DIRECTORY_SEPARATOR, $class)
@@ -111,8 +120,11 @@
         $dir = Solar_Dir::fix(
             $this->_target . str_replace('_', '/', $class) . '/Setup'
         );
-        @mkdir($dir, 0777, true);
         
+        if (! file_exists($dir)) {
+            mkdir($dir, 0755, true);
+        }
+        
         // write the cols file
         $this->_outln('Updating table cols.');
         $text = var_export($table_cols, true);
@@ -170,7 +182,7 @@
         $list = glob($dir . '*.php');
         foreach ($list as $file) {
             // strip .php off the end of the file name
-            $key = susbtr(basename($file), 0, -4);
+            $key = substr(basename($file), 0, -4);
             
             // we need to add the php-open tag ourselves, instead of
             // having it in the template file, becuase the PEAR packager




More information about the Solar-svn mailing list