public function after_create()
 {
     UserMailer::deliver_new_user($this->email, $this);
     $path = FileUtils::join(NIMBLE_ROOT, 'get', $this->username);
     FileUtils::mkdir_p($path);
     chmod($path, 0755);
 }
Beispiel #2
0
 /**
  * Generate a migration.
  * @param string $name The name of the migration.
  * @param string $table The table to create a migration for.
  */
 public static function generate_migration($name, $table = '')
 {
     $path = FileUtils::join(static::$nimble_root, 'db', 'migrations');
     FileUtils::mkdir_p($path);
     $file_name = time() . '_' . $name . '_migration.php';
     $class_name = Inflector::classify($name . 'Migration');
     $out = file_get_contents(FileUtils::join(static::$template_path, 'migration.tmpl'));
     $up = '';
     $down = '';
     if (!empty($table)) {
         $up .= '$t = $this->create_table("' . $table . '");';
         $up .= "\n" . '				//enter column definitions here';
         $up .= "\n" . '			$t->go();';
         $down .= '	$this->drop_table("' . $table . '");';
     }
     $out = str_replace(array('{class_name}', '{up_code}', '{down_code}'), array($class_name, $up, $down), $out);
     static::write_file(FileUtils::join($path, $file_name), $out);
 }
 public function move_uploaded_file($file, $version)
 {
     $path = $this->file_path($version);
     FileUtils::mkdir_p(dirname($path));
     if (is_uploaded_file($file)) {
         move_uploaded_file($file, $this->file_path($version));
         chmod($this->file_path($version), 0664);
     } else {
         copy($file, $path);
     }
 }
Beispiel #4
0
 private static function mailer_template($class, $method)
 {
     FileUtils::mkdir_p(FileUtils::join(NIMBLE_ROOT, 'app', 'view', strtolower(Inflector::underscore($class))));
     touch(FileUtils::join(NIMBLE_ROOT, 'app', 'view', strtolower(Inflector::underscore($class)), strtolower($method) . '.php'));
     touch(FileUtils::join(NIMBLE_ROOT, 'app', 'view', strtolower(Inflector::underscore($class)), strtolower($method) . '.txt'));
 }
Beispiel #5
-3
 public function __construct()
 {
     if (static::$enabled) {
         FileUtils::mkdir_p(FileUtils::join(FileUtils::join(NIMBLE_ROOT, 'log')));
         $this->log_file = FileUtils::join(NIMBLE_ROOT, 'log', NIMBLE_ENV . '.log');
     }
 }