コード例 #1
0
ファイル: FileUtils.php プロジェクト: corneltek/phifty
 public static function mkpath($paths, $verbose = false, $mode = 0777)
 {
     $paths = (array) $paths;
     foreach ($paths as $path) {
         if ($verbose) {
             echo "\tCreating directory {$path}\n";
         }
         futil_mkdir_if_not_exists($path, $mode, true);
     }
 }
コード例 #2
0
ファイル: ComposerInstaller.php プロジェクト: azole/Phifty
 public static function postInstall(CommandEvent $event)
 {
     $composer = $event->getComposer();
     echo "Creating directory structure...\n";
     $dirs = array();
     $dirs[] = 'bin';
     $dirs[] = 'cache' . DIRECTORY_SEPARATOR . 'view';
     $dirs[] = 'cache' . DIRECTORY_SEPARATOR . 'config';
     $dirs[] = 'applications';
     $dirs[] = 'config';
     foreach ($dirs as $dir) {
         futil_mkdir_if_not_exists($dir, 0755, true);
     }
     echo "Installing main.php\n";
     if (!file_exists('main.php')) {
         copy('vendor/corneltek/phifty-core/main_app.php', 'main.php');
     }
     if (!file_exists('config/framework.yml')) {
         echo "Installing default framework config...\n";
         $appId = basename(getcwd());
         $appName = ucfirst(basename(getcwd()));
         $uuid = UUID::v4();
         $domain = $appId . '.dev';
         echo "ApplicationId: {$appId}, Domain: {$domain}, UUID: {$uuid}\n";
         $content = self::createConfigFromTemplate($appId, $appName, $uuid, $domain);
         file_put_contents("config/framework.yml", $content);
     }
     if (!file_exists('config/database.yml')) {
         echo "Installing default database config...\n";
         copy('vendor/corneltek/phifty-core/config/database.yml', 'config/database.yml');
         echo "Rewriting database config...\n";
         $config = ConfigCompiler::load('config/database.yml');
         $config['data_sources']['default'] = array('database' => basename(getcwd()), 'driver' => 'mysql', 'host' => 'localhost', 'user' => 'user', 'pass' => 'pass');
         file_put_contents("config/database.yml", yaml_emit($config));
     }
     if (!file_exists('locale')) {
         echo "Installing locale...\n";
         passthru('rsync -r vendor/corneltek/phifty-core/locale/ locale/');
     }
     if (!file_exists('webroot')) {
         passthru('rsync -r vendor/corneltek/phifty-core/webroot/ webroot/');
     }
     echo "Changing permissions...\n";
     $chmods = array();
     $chmods[] = array("og+rw", "cache");
     $chmods[] = array("og+rw", "webroot" . DIRECTORY_SEPARATOR . 'static' . DIRECTORY_SEPARATOR . 'upload');
     foreach ($chmods as $mod) {
         list($mod, $path) = $mod;
         if (!file_exists($path)) {
             mkdir($path, 0755, true);
         }
         system("chmod -R {$mod} {$path}");
     }
     if (!file_exists('.gitignore')) {
         copy('vendor/corneltek/phifty-core/.gitignore', '.gitignore');
     }
     echo "Done";
 }