OKyJIucT
9/5/2015 - 4:44 PM

Git file

Git file

<?php
/**
 * Created by PhpStorm.
 * User: Kohone
 * Date: 21.03.2015
 * Time: 10:56
 */

header('Content-type: text/plain');

if (!ini_get('date.timezone')) {
    date_default_timezone_set('Europe/Moscow');
}

$domains = file('sites.txt');

foreach($domains as $domain) {
    
    $domain = trim($domain);
	$path = '/var/www/sites/data/www/'.$domain;
	chdir($path);
	
	exec('git init');
	exec('git remote add advert git@bitbucket.org:okyjiuct/advert.git');
	exec('git remote set-url advert git@bitbucket.org:okyjiuct/advert.git');
	exec('git pull advert master', $out);
		
    $path = '/var/www/sites/data/www/'.$domain.'/protected';
	chdir($path);
	$out = [];
	
	// миграции
	exec('php yiic migrate --interactive=0');
	
	print_r($out);
		
	$out = array_pop($out);
	$date = date("d.m.Y H:i", time());
	echo "$domain\r\n-------------\r\n";
}