-
Notifications
You must be signed in to change notification settings - Fork 181
/
Copy pathsandbox_installer.php
42 lines (32 loc) · 1.54 KB
/
sandbox_installer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/*
* This file is part of the Symfony1 package.
*
* (c) Fabien Potencier <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
$this->installDir(__DIR__.'/sandbox_skeleton');
$this->logSection('install', 'add symfony CLI for Windows users');
$this->getFilesystem()->copy(__DIR__.'/symfony.bat', \sfConfig::get('sf_root_dir').'/symfony.bat');
$this->logSection('install', 'add LICENSE');
$this->getFilesystem()->copy(__DIR__.'/../../LICENSE', \sfConfig::get('sf_root_dir').'/LICENSE');
$this->logSection('install', 'default to sqlite');
$this->runTask('configure:database', sprintf("'sqlite:%s/sandbox.db'", \sfConfig::get('sf_data_dir')));
$this->logSection('install', 'create an application');
$this->runTask('generate:app', 'frontend');
$this->logSection('install', 'publish assets');
$this->runTask('plugin:publish-assets');
$this->logSection('install', 'fix sqlite database permissions');
touch(\sfConfig::get('sf_data_dir').'/sandbox.db');
chmod(\sfConfig::get('sf_data_dir'), 0777);
chmod(\sfConfig::get('sf_data_dir').'/sandbox.db', 0777);
$this->logSection('install', 'add an empty file in empty directories');
$seen = [];
foreach (new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(\sfConfig::get('sf_root_dir')), \RecursiveIteratorIterator::CHILD_FIRST) as $path => $item) {
if (!isset($seen[$path]) && $item->isDir() && !$item->isLink()) {
touch($item->getRealPath().'/.sf');
}
$seen[$item->getPath()] = true;
}