本文整理汇总了PHP中Kwf_Setup::setUp方法的典型用法代码示例。如果您正苦于以下问题:PHP Kwf_Setup::setUp方法的具体用法?PHP Kwf_Setup::setUp怎么用?PHP Kwf_Setup::setUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Kwf_Setup
的用法示例。
在下文中一共展示了Kwf_Setup::setUp方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
if (!file_exists('bootstrap.php')) {
throw new \Exception("Run this script in the application root directory");
}
\Kwf_Setup::setUp();
if (file_exists('setup/initial/dump.sql')) {
unlink('setup/initial/dump.sql');
}
if (file_exists('setup/initial/uploads')) {
foreach (glob('setup/initial/uploads/*') as $f) {
unlink($f);
}
}
if ($input->getOption('include-initial-dump')) {
$output->writeln("checking for pending updates...");
$pendingUpdatesCount = \Kwf_Util_Update_Helper::countPendingUpdates();
if ($pendingUpdatesCount) {
throw new \Exception("{$pendingUpdatesCount} Updates have not been executed. Run update first.");
}
$output->writeln("creating database dump...");
$dump = DbDump::dump();
if (!file_exists('setup/initial')) {
mkdir('setup/initial', 0777, true);
$ignore = "";
if (file_exists('setup/.gitignore')) {
$ignore = file_get_contents('setup/.gitignore');
}
if (!preg_match('#^initial$#m', $ignore)) {
$ignore = rtrim($ignore);
if ($ignore) {
$ignore .= "\n";
}
$ignore .= "initial\n";
}
file_put_contents('setup/.gitignore', $ignore);
}
file_put_contents('setup/initial/dump.sql', $dump);
$output->writeln("copying uploads...");
if (!file_exists('setup/initial/uploads')) {
mkdir('setup/initial/uploads');
}
$model = \Kwf_Model_Abstract::getInstance('Kwf_Uploads_Model');
$select = new \Kwf_Model_Select();
$it = new \Kwf_Model_Iterator_Packages(new \Kwf_Model_Iterator_Rows($model, $select));
foreach ($it as $row) {
$fileSource = $row->getFileSource();
copy($fileSource, 'setup/initial/uploads/' . basename($fileSource));
}
}
$excludes = ExcludeFinder::findExcludes('.');
$excludeArgs = '';
foreach ($excludes as $i) {
$excludeArgs .= " -x " . escapeshellarg('./' . $i . '*');
}
$cmd = "zip deploy.zip . --quiet -r {$excludeArgs}";
$output->writeln("creating deploy.zip archive...");
$this->_systemCheckRet($cmd, $input, $output);
$output->writeln("deploy.zip successfully created.");
}
示例2: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
\Kwf_Setup::setUp();
$dbConfig = \Kwf_Registry::get('dao')->getDbConfig();
$cacheTables = \Kwf_Util_ClearCache::getInstance()->getDbCacheTables();
$dumpCmd = "mysqldump";
$dumpCmd .= " --host=" . escapeshellarg($dbConfig['host']);
$dumpCmd .= " --user=" . escapeshellarg($dbConfig['username']);
$dumpCmd .= " --password=" . escapeshellarg($dbConfig['password']);
$cmd = $dumpCmd;
foreach ($cacheTables as $t) {
$cmd .= " --ignore-table=" . escapeshellarg($dbConfig['dbname'] . '.' . $t);
}
$cmd .= " {$dbConfig['dbname']}";
passthru($cmd, $ret);
if ($ret) {
return $ret;
}
foreach ($cacheTables as $t) {
$cmd = $dumpCmd;
$cmd .= " --no-data " . escapeshellarg($dbConfig['dbname']) . " " . escapeshellarg($t);
passthru($cmd, $ret);
if ($ret) {
return $ret;
}
}
return 0;
}
示例3: execute
protected function execute(InputInterface $input, OutputInterface $output)
{
if (!file_exists($_SERVER['HOME'] . '/.aws/config')) {
throw new \Exception("Can't get aws config, set up eb cli first");
}
$awsConfig = parse_ini_file($_SERVER['HOME'] . '/.aws/config', true);
$awsConfig = array('key' => $awsConfig['profile eb-cli']['aws_access_key_id'], 'secret' => $awsConfig['profile eb-cli']['aws_secret_access_key']);
$s3 = new \Kwf_Util_Aws_S3($awsConfig);
\Kwf_Setup::setUp();
$prodSection = $input->getOption('server');
$prodConfig = \Kwf_Config_Web::getInstance($prodSection);
$bucket = $prodConfig->aws->uploadsBucket;
if (!$bucket) {
throw new \Exception("No aws.uploadBucket configured for '{$prodSection}'");
}
$model = \Kwf_Model_Abstract::getInstance('Kwf_Uploads_Model');
$select = new \Kwf_Model_Select();
$it = new \Kwf_Model_Iterator_Packages(new \Kwf_Model_Iterator_Rows($model, $select));
$it = new \Kwf_Iterator_ConsoleProgressBar($it);
foreach ($it as $row) {
$file = $row->getFileSource();
if (file_exists($file)) {
if ($s3->if_object_exists($bucket, $row->id)) {
echo "already existing: {$row->id}\n";
} else {
echo "uploading: {$row->id}";
$contents = file_get_contents($file);
$r = $s3->create_object($bucket, $row->id, array('body' => $contents, 'length' => strlen($contents), 'contentType' => $row->mime_type));
if (!$r->isOk()) {
throw new \Exception($r->body);
}
echo " OK\n";
}
}
}
}
示例4: chdir
<?php
chdir(dirname(__FILE__) . '/tests');
set_include_path('.' . PATH_SEPARATOR . realpath(getcwd() . '/..'));
define('VENDOR_PATH', '../vendor');
require 'Kwf/Setup.php';
Kwf_Setup::setUp();
if (isset($_SERVER['REQUEST_URI']) && $_SERVER['REQUEST_URI'] == '/') {
echo Kwf_Registry::get('config')->application->kwf->name . ' ' . Kwf_Registry::get('config')->application->kwf->version;
exit;
}
$front = Kwf_Controller_Front::getInstance();
$front->addControllerDirectory(KWF_PATH . '/tests', 'kwf_test');
$front->addControllerDirectory(KWF_PATH . '/tests/controller', 'tests_controller');
$router = $front->getRouter();
if ($router instanceof Kwf_Controller_Router) {
//für selenium-tests von sachen die im kwf liegen
$router->AddRoute('kwf_test', new Zend_Controller_Router_Route('/kwf/test/:controller/:action', array('module' => 'kwf_test', 'action' => 'index')));
$router->AddRoute('kwf_kwctest', new Zend_Controller_Router_Route_Regex('kwf/kwctest/([^/]+)/(.*)', array('module' => 'tests_controller', 'controller' => 'render-component', 'action' => 'index', 'url' => ''), array('root' => 1, 'url' => 2)));
$router->AddRoute('kwf_test_componentedit', new Zend_Controller_Router_Route('/kwf/componentedittest/:root/:class/:componentController/:action', array('module' => 'component_test', 'controller' => 'component_test', 'action' => 'index')));
}
$front->setBaseUrl('');
$response = $front->dispatch();
$response->sendResponse();
示例5: define
<?php
define('KWF_PATH', 'vendor/koala-framework/koala-framework');
define('VENDOR_PATH', 'vendor');
require VENDOR_PATH . '/koala-framework/koala-framework/Kwf/Setup.php';
Kwf_Setup::setUp('Kwf_Modernizr_Config');