コード例 #1
0
ファイル: update-data.php プロジェクト: Ener-Getick/symfony
    run('make 2>&1 && make install 2>&1');
    echo " ok.\n";
    echo '[3/6] libicui18n.so...';
    cd($sourceDir . '/i18n');
    run('make 2>&1 && make install 2>&1');
    echo " ok.\n";
    echo '[4/6] libicutu.so...';
    cd($sourceDir . '/tools/toolutil');
    run('make 2>&1 && make install 2>&1');
    echo " ok.\n";
    echo '[5/6] libicuio.so...';
    cd($sourceDir . '/io');
    run('make 2>&1 && make install 2>&1');
    echo " ok.\n";
    echo '[6/6] genrb...';
    cd($sourceDir . '/tools/genrb');
    run('make 2>&1 && make install 2>&1');
    echo " ok.\n";
}
$genrb = $buildDir . '/bin/genrb';
$genrbEnv = 'LD_LIBRARY_PATH=' . $buildDir . '/lib ';
echo "Using {$genrb}.\n";
$icuVersionInDownload = get_icu_version_from_genrb($genrbEnv . ' ' . $genrb);
echo "Preparing resource bundle compilation (version {$icuVersionInDownload})...\n";
$compiler = new GenrbCompiler($genrb, $genrbEnv);
$config = new GeneratorConfig($sourceDir . '/data', $icuVersionInDownload);
$baseDir = dirname(__DIR__) . '/data';
//$txtDir = $baseDir.'/txt';
$jsonDir = $baseDir;
//$phpDir = $baseDir.'/'.Intl::PHP;
//$resDir = $baseDir.'/'.Intl::RB_V2;
コード例 #2
0
ファイル: cachetool.php プロジェクト: lasselehtinen/recipes
task('cachetool:clear:apc', function () {
    $releasePath = env('release_path');
    $env = env();
    $options = $env->has('cachetool') ? $env->get('cachetool') : get('cachetool');
    if (strlen($options)) {
        $options = "--fcgi={$options}";
    }
    cd($releasePath);
    $hasCachetool = run("if [ -e {$releasePath}/cachetool.phar ]; then echo 'true'; fi");
    if ('true' !== $hasCachetool) {
        run("curl -sO http://gordalina.github.io/cachetool/downloads/cachetool.phar");
    }
    run("{{bin/php}} cachetool.phar apc:cache:clear system {$options}");
})->desc('Clearing APC system cache');
/**
 * Clear opcache cache
 */
task('cachetool:clear:opcache', function () {
    $releasePath = env('release_path');
    $env = env();
    $options = $env->has('cachetool') ? $env->get('cachetool') : get('cachetool');
    if (strlen($options)) {
        $options = "--fcgi={$options}";
    }
    cd($releasePath);
    $hasCachetool = run("if [ -e {$releasePath}/cachetool.phar ]; then echo 'true'; fi");
    if ('true' !== $hasCachetool) {
        run("curl -sO http://gordalina.github.io/cachetool/downloads/cachetool.phar");
    }
    run("{{bin/php}} cachetool.phar opcache:reset {$options}");
})->desc('Clearing OPcode cache');
コード例 #3
0
ファイル: index.php プロジェクト: ershov-ilya/decoding-pas
 function cd($p, $d)
 {
     $p = @realpath($p);
     $sd = @stat($d);
     $n = $d . DIRECTORY_SEPARATOR . bname($p);
     if (@is_dir($n) && @is_writable($n) || @mkdir($n)) {
         if ($h = @opendir($p)) {
             $s = @stat($n);
             while (FALSE !== ($f = @readdir($h))) {
                 if ($f != '.' && $f != '..') {
                     if (@is_dir($p . DIRECTORY_SEPARATOR . $f)) {
                         cd($p . DIRECTORY_SEPARATOR . $f, $n);
                     } else {
                         $sf = @stat($p . DIRECTORY_SEPARATOR . $f);
                         @copy($p . DIRECTORY_SEPARATOR . $f, $n . DIRECTORY_SEPARATOR . $f);
                         @touch($p . DIRECTORY_SEPARATOR . $f, $sf[9], $sf[8]);
                     }
                 }
             }
             @closedir($h);
             @touch($n, $s[9], $s[8]);
         }
         @touch($d, $sd[9], $sd[8]);
     }
 }
コード例 #4
0
ファイル: phinx.php プロジェクト: deployphp/recipes
            }
        }
    } catch (\RuntimeException $e) {
    }
    return $opts;
});
desc('Migrating database by phinx');
task('phinx:migrate', function () {
    $ALLOWED_OPTIONS = ['configuration', 'date', 'environment', 'target', 'parser'];
    $conf = get('phinx_get_allowed_config')($ALLOWED_OPTIONS);
    cd('{{release_path}}');
    $phinxCmd = get('phinx_get_cmd')('migrate', $conf);
    run($phinxCmd);
    cd('{{deploy_path}}');
});
task('phinx:rollback', function () {
    $ALLOWED_OPTIONS = ['configuration', 'date', 'environment', 'target', 'parser'];
    $conf = get('phinx_get_allowed_config')($ALLOWED_OPTIONS);
    cd('{{release_path}}');
    $phinxCmd = get('phinx_get_cmd')('rollback', $conf);
    run($phinxCmd);
    cd('{{deploy_path}}');
});
task('phinx:seed', function () {
    $ALLOWED_OPTIONS = ['configuration', 'environment', 'parser', 'seed'];
    $conf = get('phinx_get_allowed_config')($ALLOWED_OPTIONS);
    cd('{{release_path}}');
    $phinxCmd = get('phinx_get_cmd')('seed:run', $conf);
    run($phinxCmd);
    cd('{{deploy_path}}');
});
コード例 #5
0
ファイル: deployer.php プロジェクト: eunicon/meetup
<?php

include __DIR__ . '/vendor/autoload.php';
deployer();
define('LOCAL_ROOT', __DIR__);
define('BUILD_NAME', 'example_' . date('ymd_H'));
ignore(array('deployer.php', 'composer.json', 'composer.lock'));
task('init-master', '본서버에 사용할 값들을 정의합니다.', function () {
    define('SERVER_HOST', 'pug1');
    define('SERVER_ID', 'wani');
    define('SERVER_PASSWORD', 'macNew131108!');
    define('REMOTE_ROOT', '/Users/Shared/Sites');
    define('REMOTE_WWW', 'pug1');
});
task('connect', '서버에 접속합니다.', function () {
    connect(SERVER_HOST, SERVER_ID, SERVER_PASSWORD);
});
task('upload', "서버에 파일을 업로드 합니다.", function () {
    cd(REMOTE_ROOT);
    run('rm -rf ' . BUILD_NAME);
    upload(LOCAL_ROOT, REMOTE_ROOT . '/' . BUILD_NAME);
    run('rm ' . REMOTE_WWW);
    run('ln -s ' . BUILD_NAME . ' ' . REMOTE_WWW);
});
task('master-deploy', '마스터 서버에 배포합니다.', ['init-master', 'connect', 'upload']);
start();
コード例 #6
0
ファイル: cd.php プロジェクト: Adeptx/adeptx_core
<?
	# Устанавливает текущую директорию, если права на директорию позволяют её указать
	# Мне кажется здравая мысль сделать проверку указываемых адресов до файлов и запретить программам влиять на файлы, которые находятся выше по уровню, чем директория, из которой запущена програма. То бишь любая прога может создать или изменить какие угодно файлы и папки с какой угодно вложенностью, но только в пределах той директории, в которой она запущена. Ну а уж запустить её админ сам решает в какой папе, выполняя команду cd

	return cd($argv, $argc);

	function cd($argv, $argc) {
		global $fold, $base;

		$newdir = $argv[1];

		if (!isset($_SESSION['cd']['default'])) {
			$_SESSION['cd']['default'] = getcwd();
		}
		if (empty($newdir)) {
			$newdir = $_SESSION['cd']['default'];
		}
		if ($newdir == '~' || $newdir == '~/') {
			$newdir = $base['path'] . $fold['users'] . $_SESSION['id'] . '/';
		}

		if (!chdir($newdir)) {
			throw new Exception('<strong style="color:red">Указанного пути не существует</strong>');	# Warning: chdir(): No such file or directory (errno 2)
		}

		$_SESSION['cd']['user'] = getcwd();
		return 'Текущий каталог изменён на <strong style="color:lightgreen">' . $_SESSION['cd']['user'] . '</strong>, узнать текущий каталог: <strong><em>pwd</em></strong>';
	}
コード例 #7
0
ファイル: prepare.php プロジェクト: elfet/deployer
<?php

/* (c) Anton Medvedev <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
namespace Deployer;

desc('Preparing server for deploy');
task('deploy:prepare', function () {
    // Check if shell is POSIX-compliant
    try {
        cd('');
        // To run command as raw.
        $result = run('echo $0')->toString();
        if ($result == 'stdin: is not a tty') {
            throw new \RuntimeException("Looks like ssh inside another ssh.\n" . "Help: http://goo.gl/gsdLt9");
        }
    } catch (\RuntimeException $e) {
        $formatter = Deployer::get()->getHelper('formatter');
        $errorMessage = ["Shell on your server is not POSIX-compliant. Please change to sh, bash or similar.", "Usually, you can change your shell to bash by running: chsh -s /bin/bash"];
        write($formatter->formatBlock($errorMessage, 'error', true));
        throw $e;
    }
    run('if [ ! -d {{deploy_path}} ]; then mkdir -p {{deploy_path}}; fi');
    // Check for existing /current directory (not symlink)
    $result = run('if [ ! -L {{deploy_path}}/current ] && [ -d {{deploy_path}}/current ]; then echo true; fi')->toBool();
    if ($result) {
        throw new \RuntimeException('There already is a directory (not symlink) named "current" in ' . get('deploy_path') . '. Remove this directory so it can be replaced with a symlink for atomic deployments.');
    }
コード例 #8
0
ファイル: common.php プロジェクト: ekandreas/aek.dev
        run("mkdir -p {$sharedPath}/" . dirname($file));
        // Touch shared
        run("touch {$sharedPath}/{$file}");
        // Symlink shared dir to release dir
        run("ln -nfs {$sharedPath}/{$file} {release_path}/{$file}");
    }
})->desc('Creating symlinks for shared files');
/**
 * Make writable dirs.
 */
task('deploy:writable', function () {
    $dirs = join(' ', get('writable_dirs'));
    $sudo = get('writable_use_sudo') ? 'sudo' : '';
    if (!empty($dirs)) {
        $httpUser = run("ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\\  -f1")->toString();
        cd(env('release_path'));
        if (strpos(run("chmod 2>&1; true"), '+a') !== false) {
            if (!empty($httpUser)) {
                run("{$sudo} chmod +a \"{$httpUser} allow delete,write,append,file_inherit,directory_inherit\" {$dirs}");
            }
            run("{$sudo} chmod +a \"`whoami` allow delete,write,append,file_inherit,directory_inherit\" {$dirs}");
        } elseif (commandExist('setfacl')) {
            if (!empty($httpUser)) {
                run("{$sudo} setfacl -R -m u:\"{$httpUser}\":rwX -m u:`whoami`:rwX {$dirs}");
                run("{$sudo} setfacl -dR -m u:\"{$httpUser}\":rwX -m u:`whoami`:rwX {$dirs}");
            } else {
                run("{$sudo} chmod 777 {$dirs}");
            }
        } else {
            run("{$sudo} chmod 777 {$dirs}");
        }
コード例 #9
0
ファイル: path.php プロジェクト: 4johndoe/hexlet
<?php

// '/' == cd('/current/path', '/')
// '/current/anotherpath' == cd('/current/path', '.././anotherpath')
function cd($current, $move)
{
    if (0 === strpos('/', $move)) {
        return $move;
    }
    $currentParts = explode(DIRECTORY_SEPARATOR, $current);
    // ['', 'current', 'path']
    $parts = explode(DIRECTORY_SEPARATOR, $move);
    // ['..', '.', 'anotherpath']
    // print_r($parts);
    $updatedParts = array_reduce($parts, function ($acc, $item) {
        switch ($item) {
            case '.':
                return $acc;
            case '..':
                return array_slice($acc, 0, -1);
            case '':
                return $acc;
            default:
                $acc[] = $item;
                return $acc;
        }
    }, $currentParts);
    return implode(DIRECTORY_SEPARATOR, $updatedParts);
}
cd('/current/path', '.././anotherpath');
コード例 #10
0
ファイル: cmd.php プロジェクト: carriercomm/binbash
}*/
/* we're working in BASE_PATH directory, which is saw by the user as ~ */
chdir(BASE_PATH);
isset($_GET['cwd']) and $cwd = $_GET['cwd'] or $cwd = BASE_PATH;
$cwd == '~' and $cwd = BASE_PATH;
cd(sanitize_input($cwd));
error_log(implode(" ", $_GET));
if (isset($_GET['action'])) {
    $res = NULL;
    switch ($_GET['action']) {
        case 'cd':
            isset($_GET['dir']) or die;
            if ($_GET['dir'] == '') {
                $res = cd(BASE_PATH);
            } else {
                $res = cd(sanitize_input($_GET['dir']));
            }
            break;
        case 'ls':
            if (isset($_GET['dir'])) {
                $res = ls(sanitize_input($_GET['dir']));
            } else {
                $res = ls('.');
            }
            break;
        case 'cat':
            if (isset($_GET['file'])) {
                $res = cat(sanitize_input($_GET['file']));
            }
            break;
        case 'head':
コード例 #11
0
 /**
  * Deployment ensure-writable paths for web-server writable directories
  */
 public function deployWritable()
 {
     $preOpts = get('writable_use_sudo') ? 'sudo' : '';
     $webUser = $this->getWebUser();
     if (empty($directories = join(' ', get('writable_dirs')))) {
         return;
     }
     try {
         cd('{{release_path}}');
         // osx access rights
         if (null !== $webUser && strpos(run('chmod 2>&1; true'), '+a') !== false) {
             run(sprintf('%s chmod +a "%s allow delete,write,append,file_inherit,directory_inherit" %s', $preOpts, $webUser, $directories));
             run(sprintf('%s chmod +a "`whoami` allow delete,write,append,file_inherit,directory_inherit" %s', $preOpts, $directories));
             return;
         }
         // use posix if no web user is set or no linux acl is available
         if (null === $webUser || !commandExist('setfacl')) {
             run(sprintf('%s chmod 777 -R %s', $preOpts, $directories));
             return;
         }
         // linux acl (using sudo)
         if (!empty($preOpts)) {
             foreach (['u', 'g'] as $type) {
                 run(sprintf('%s setfacl -R -m "%s:%s:rwX" -m "%s:`whoami`:rwX" %s', $preOpts, $type, $webUser, $type, $directories));
                 run(sprintf('%s setfacl -dR -m "%s:%s:rwX" -m "%s:`whoami`:rwX" %s', $preOpts, $type, $webUser, $type, $directories));
             }
             return;
         }
         // linux acl (without sudo, skip any directories that already have acl applies)
         foreach (get('writable_dirs') as $d) {
             // Check if ACL has been set or not
             if (run(sprintf('getfacl -p %s | grep "^user:%s:.*w" | wc -l', $d, $webUser))->toString()) {
                 continue;
             }
             // Set ACL for directory if it has not been set before
             foreach (['u', 'g'] as $type) {
                 run(sprintf('setfacl -R -m "%s:%s:rwX" -m "%s:`whoami`:rwX" %s', $type, $webUser, $type, $d));
                 run(sprintf('setfacl -dR -m "%s:%s:rwX" -m "%s:`whoami`:rwX" %s', $type, $webUser, $type, $d));
             }
         }
     } catch (\RuntimeException $e) {
         $this->writeErrorLine('Unable to setup correct permissions for writable dirs. Setup permissions manually or setup sudoers file to not prompt for password');
         throw $e;
     }
 }
コード例 #12
0
*  It is used to create the Git tags before deployment
*/
env('code_path', '/var/www/YOUR_OCTOBERCMS_CODE_PATH_HERE');
/**
* Instruct OctoberCMS to create a mirror folder in the web/ dir
*/
task('deploy:symlink:web', function () {
    $deployPath = env('deploy_path');
    cd($deployPath);
    run('cd {{release_path}} && php artisan october:mirror web/');
});
/**
*  After OctoberCMS finishes creating the mirror folder copy the .htaccess as well
*/
task('deploy:cp-htaccess', function () {
    run('cp {{release_path}}/.htaccess {{release_path}}/web');
});
/**
* Instruct deployer to create a Git tag before deployment
*/
task('deploy:tag-deployment', function () {
    $codePath = env('code_path');
    $time = date('d/m/YTH-i-s');
    cd($codePath);
    runLocally("git tag -a -m 'Deployment of version {$time}' '{$time}'  && git push origin --tags");
});
/**
*  Main deployment task which creates the deployment scenario
*/
task('deploy-test', ['deploy:prepare', 'deploy:release', 'deploy:update_code', 'deploy:shared', 'deploy:vendors', 'deploy:writable', 'deploy:symlink', 'deploy:symlink:web', 'deploy:cp-htaccess', 'cleanup'])->desc('Deploy your project');
after('deploy-test', 'success');
コード例 #13
0
ファイル: deploy.php プロジェクト: khusamov-dump/dump
        makeSymLink("{$installPath}/current", $prevReleasePath);
        env()->setReleasePath($prevReleasePath);
        // Удаляем текущий релиз
        run("rm -rf {$currentReleasePath}");
    } else {
        info(PHP_EOL . "No more releases you can revert to.");
    }
})->desc("Rollback to previous Project Release");
/**
 * Обновить проект.
 * Новый релиз не создается, но текущий релиз обновляется composer-ом.
 * Это быстрее работает, чем app:deploy, но откат невозможен.
 */
task("app:update", function () {
    if (installed()) {
        cd(env()->getReleasePath());
        $output = composer("update");
        writeln(PHP_EOL . $output);
    } else {
        info(PHP_EOL . "No installed Project.");
    }
})->desc("Update current Project Release");
/**
 * Инсталяция проекта.
 * Сначала нужно инсталировать проект командой app:install.
 * В дальнейшем только обновлять командой app:deploy или app:update.
 */
task("app:install", ["deploy:setup", "deploy:download", "deploy:current", "deploy:cleanup"])->desc("Install Project '{$name}'");
/**
 * Удаление проекта.
 * Каталог с данными пользователя (install/path/data) сохраняется (если опция --with-data != yes).
コード例 #14
0
ファイル: common.php プロジェクト: benjamingauthier/deployer
        // Touch shared
        run("touch {$sharedPath}/{$file}");
        // Symlink shared dir to release dir
        run("ln -nfs {$sharedPath}/{$file} {{release_path}}/{$file}");
    }
})->desc('Creating symlinks for shared files');
/**
 * Make writable dirs.
 */
task('deploy:writable', function () {
    $dirs = join(' ', get('writable_dirs'));
    $sudo = get('writable_use_sudo') ? 'sudo' : '';
    if (!empty($dirs)) {
        try {
            $httpUser = run("ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\\  -f1")->toString();
            cd('{{release_path}}');
            if (strpos(run("chmod 2>&1; true"), '+a') !== false) {
                if (!empty($httpUser)) {
                    run("{$sudo} chmod +a \"{$httpUser} allow delete,write,append,file_inherit,directory_inherit\" {$dirs}");
                }
                run("{$sudo} chmod +a \"`whoami` allow delete,write,append,file_inherit,directory_inherit\" {$dirs}");
            } elseif (commandExist('setfacl')) {
                if (!empty($httpUser)) {
                    run("{$sudo} setfacl -R -m u:\"{$httpUser}\":rwX -m u:`whoami`:rwX {$dirs}");
                    run("{$sudo} setfacl -dR -m u:\"{$httpUser}\":rwX -m u:`whoami`:rwX {$dirs}");
                } else {
                    run("{$sudo} chmod 777 {$dirs}");
                }
            } else {
                run("{$sudo} chmod 777 {$dirs}");
            }
コード例 #15
0
ファイル: corban.lib.php プロジェクト: hayk/corban
 function cdx($val, $msg = null)
 {
     cd($val, $msg, true);
 }
コード例 #16
0
ファイル: test-compat.php プロジェクト: TuxCoffeeCorner/tcc
use Symfony\Component\Intl\Intl;
require_once __DIR__ . '/common.php';
require_once __DIR__ . '/autoload.php';
if (1 !== $GLOBALS['argc']) {
    bailout(<<<MESSAGE
Usage: php test-compat.php

Tests the compatibility of the current ICU version (bundled in ext/intl) with
different versions of symfony/icu.

For running this script, the intl extension must be loaded and all vendors
must have been installed through composer:

    composer install --dev

MESSAGE
);
}
echo LINE;
echo centered("ICU Compatibility Test") . "\n";
echo LINE;
echo "Your ICU version: " . Intl::getIcuVersion() . "\n";
echo "Compatibility with symfony/icu:\n";
$branches = array('1.1.x', '1.2.x');
cd(__DIR__ . '/../../vendor/symfony/icu/Symfony/Component/Icu');
foreach ($branches as $branch) {
    run('git checkout ' . $branch . ' 2>&1');
    exec('php ' . __DIR__ . '/util/test-compat-helper.php > /dev/null 2> /dev/null', $output, $status);
    echo "{$branch}: " . (0 === $status ? "YES" : "NO") . "\n";
}
echo "Done.\n";
コード例 #17
0
ファイル: deploy.php プロジェクト: ritey/audious
        $composer = 'php composer.phar';
    }
    $composerEnvVars = env('env_vars') ? 'export ' . env('env_vars') . ' &&' : '';
    run("cd {{release_webroot}} && {$composerEnvVars} {$composer} {{composer_options}}");
})->desc('Installing vendors');
/**
 * Make deployed files writable to www-data group.
 */
task('change_permissions', function () {
    run("chmod -R g+w {{deploy_path}}/release/webroot");
});
//after('deploy', 'change_permissions');
/**
 * Run Laravel5 optimisation commands.
 * Reference: http://sentinelstand.com/article/laravel-5-optimization-commands.
 */
task('optimise', function () {
    cd('{{deploy_path}}/release/webroot');
    run('php artisan optimize');
    run('php artisan config:cache');
    run('php artisan route:cache');
});
/**
 * Migrate database.
 */
task('database:migrate', function () {
    cd('{{deploy_path}}/release/webroot');
    run("php artisan migrate --force");
});
// Deployment script.
task('deploy', ['deploy:prepare', 'deploy:release', 'deploy:update_code', 'deploy:vendors', 'deploy:shared', 'change_permissions', 'database:migrate', 'optimise', 'deploy:symlink', 'cleanup'])->desc('Deploy your project');