本文整理汇总了PHP中Build类的典型用法代码示例。如果您正苦于以下问题:PHP Build类的具体用法?PHP Build怎么用?PHP Build使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Build类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
function delete($details)
{
$conn = new Connection("auto");
$query = new Build();
$result = $query->delete($conn->grab_conn(), $details, "close");
return $result;
}
示例2: testBuildReplaceExampleProject
public function testBuildReplaceExampleProject()
{
$build = new Build();
$build->build(__DIR__ . '/../_fixtures/example-replace');
$bazNamespaces = (include __DIR__ . '/../_fixtures/example-replace/baz/vendor/composer/autoload_namespaces.php');
$this->assertCount(2, $bazNamespaces);
$this->assertEquals(array('Baz\\', 'Bar\\'), array_keys($bazNamespaces));
}
示例3: deregister
public function deregister(Build $build)
{
$file = $this->baseDir . DIRECTORY_SEPARATOR . $build->getName();
if (file_exists($file)) {
unlink($file);
return true;
}
return false;
}
示例4: testBuildGetDate
public function testBuildGetDate()
{
$retval = 0;
$build = new Build();
$build->Id = 1;
$build->ProjectId = 1;
$build->Filled = true;
$row = pdo_single_row_query('SELECT nightlytime FROM project WHERE id=1');
$original_nightlytime = $row['nightlytime'];
// Test the case where the project's start time is in the evening.
pdo_query("UPDATE project SET nightlytime = '20:00:00' WHERE id=1");
$build->StartTime = date('Y-m-d H:i:s', strtotime('2009-02-23 19:59:59'));
$expected_date = '2009-02-23';
$date = $build->GetDate();
if ($date !== $expected_date) {
$this->fail("Evening case: expected {$expected_date}, found {$date}");
$retval = 1;
}
$build->StartTime = date('Y-m-d H:i:s', strtotime('2009-02-23 20:00:00'));
$expected_date = '2009-02-24';
$build->NightlyStartTime = false;
$date = $build->GetDate();
if ($date !== $expected_date) {
$this->fail("Evening case: expected {$expected_date}, found {$date}");
$retval = 1;
}
// Test the case where the project's start time is in the morning.
pdo_query("UPDATE project SET nightlytime = '09:00:00' WHERE id=1");
$build->StartTime = date('Y-m-d H:i:s', strtotime('2009-02-23 08:59:59'));
$expected_date = '2009-02-22';
$build->NightlyStartTime = false;
$date = $build->GetDate();
if ($date !== $expected_date) {
$this->fail("Morning case: expected {$expected_date}, found {$date}");
$retval = 1;
}
$build->StartTime = date('Y-m-d H:i:s', strtotime('2009-02-23 09:00:00'));
$expected_date = '2009-02-23';
$build->NightlyStartTime = false;
$date = $build->GetDate();
if ($date !== $expected_date) {
$this->fail("Morning case: expected {$expected_date}, found {$date}");
$retval = 1;
}
pdo_query("UPDATE project SET nightlytime = '{$original_nightlytime}' WHERE id=1");
if ($retval === 0) {
$this->pass('Tests passed');
}
return $retval;
}
示例5: saveConfig
public function saveConfig()
{
// C('URL_MODEL',2);
//动态生成控制器类/模型类
Build::buildController('Home', 'UserDisplay');
Build::buildModel('User', 'UserDisplay');
}
示例6: testBuildDeletePost
public function testBuildDeletePost()
{
$build = Build::find(2);
$data = array('confirm-delete' => '1');
$response = $this->call('POST', '/modpack/build/' . $build->id . '?action=delete', $data);
$this->assertRedirectedTo('modpack/view/' . $build->modpack->id);
}
示例7: inbetweenBuilds
static function inbetweenBuilds($regression)
{
$build = $regression->build();
$run = $build->run();
$mode_id = $build->mode_id();
$machine_id = $run->machine_id();
$sortOrder = $run->sort_order();
$prevSortOrder = $regression->prev_build()->run()->sort_order();
$builds = array();
for ($i = $prevSortOrder + 1; $i < $sortOrder; $i++) {
$run_i = Run::withMachineAndSortOrder($machine_id, $i);
if (!$run_i->isFinished()) {
continue;
}
$build = Build::withRunAndMode($run_i->id, $mode_id);
if (!$build) {
continue;
}
if (count($build->scores()) == 0) {
continue;
}
$builds[] = $build;
}
return $builds;
}
示例8: start
public static function start()
{
//注册自动加载类函数
spl_autoload_register('self::autoload');
//导入公用的函数
include THINK_PATH . 'Common/functions.php';
//导入通用的function函数
if (is_file(COMMON_PATH . 'Common/function.php')) {
include COMMON_PATH . 'Common/function.php';
}
//导入通用的配置文件
C(include THINK_PATH . 'Conf/convention.php');
// 设置系统时区
date_default_timezone_set(C('DEFAULT_TIMEZONE'));
// 检查应用目录结构 如果不存在则自动创建
if (C('CHECK_APP_DIR')) {
if (!is_dir(LOG_PATH)) {
// 检测应用目录结构
Build::checkDir();
}
}
// 定义当前请求的系统常量
define('NOW_TIME', $_SERVER['REQUEST_TIME']);
define('REQUEST_METHOD', $_SERVER['REQUEST_METHOD']);
define('IS_GET', REQUEST_METHOD == 'GET' ? true : false);
define('IS_POST', REQUEST_METHOD == 'POST' ? true : false);
//路由解析
self::dispatch();
define('IS_AJAX', isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' || !empty($_POST[C('VAR_AJAX_SUBMIT')]) || !empty($_GET[C('VAR_AJAX_SUBMIT')]) ? true : false);
//初始化session
session(C('SESSION_OPTIONS'));
//执行应用程序
self::exec();
}
示例9: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('modpacks')->delete();
$testmodpack = Modpack::create(array('name' => 'TestModpack', 'slug' => 'testmodpack', 'icon' => false, 'icon_md5' => md5_file(public_path() . '/resources/default/icon.png'), 'icon_url' => URL::asset('/resources/default/icon.png'), 'logo' => false, 'logo_md5' => md5_file(public_path() . '/resources/default/logo.png'), 'logo_url' => URL::asset('/resources/default/logo.png'), 'background' => false, 'background_md5' => md5_file(public_path() . '/resources/default/background.jpg'), 'background_url' => URL::asset('/resources/default/background.jpg')));
DB::table('builds')->delete();
$testbuild = Build::create(array('modpack_id' => $testmodpack->id, 'version' => '1.0.0', 'minecraft' => '1.7.10', 'minecraft_md5' => 'e6b7a531b95d0c172acb704d1f54d1b3', 'min_java' => '1.7', 'min_memory' => '1024', 'is_published' => true));
}
示例10: findSortOrder
private static function findSortOrder($run, $mode_id, $revision)
{
$version_control = VersionControl::forMode($mode_id);
$j = 0;
while (True) {
if ($j++ > 30) {
throw new Exception("There shouldn't be too many runs in between");
}
if (!$run->isBuildInfoComplete()) {
throw new Exception("Encountered an incomplete run.");
}
$build = Build::withRunAndMode($run->id, $mode_id);
// We can safely ignore runs that have no results with the requested mode_id
if (!$build) {
$run = $run->next();
continue;
}
// We skip to the next run, if revisions are the same.
// To make sure that new runs are shown after existing ones.
if ($version_control->equal($build->revision(), $revision)) {
$run = $run->next();
continue;
}
// Using version control take a peek if the revision
// is later/earlier than this one.
if ($version_control->isAfter($build->revision(), $revision)) {
return $run->sort_order();
}
$run = $run->next();
}
}
示例11: getIndex
public function getIndex()
{
$builds = Build::where('is_published', '=', '1')->orderBy('updated_at', 'desc')->take(5)->get();
$modversions = Modversion::whereNotNull('md5')->orderBy('updated_at', 'desc')->take(5)->get();
$rawChangeLog = UpdateUtils::getLatestChangeLog();
$changelogJson = array_key_exists('error', $rawChangeLog) ? $rawChangeLog : array_slice($rawChangeLog, 0, 10);
return View::make('dashboard.index')->with('modversions', $modversions)->with('builds', $builds)->with('changelog', $changelogJson);
}
示例12: up
/**
* Make changes to the database.
*
* @return void
*/
public function up()
{
Schema::table('builds', function ($table) {
$table->string('minecraft_md5')->default('');
});
$minecraft = MinecraftUtils::getMinecraft(true);
foreach (Build::all() as $build) {
$build->minecraft_md5 = $minecraft[$build->minecraft]->md5;
$build->save();
}
}
示例13: up
/**
* Make changes to the database.
*
* @return void
*/
public function up()
{
Schema::table('builds', function ($table) {
$table->string('minecraft_md5');
});
$minecraft = $this->getMinecraft();
$minecraft = (array) $minecraft;
foreach (Build::all() as $build) {
$build->minecraft_md5 = $minecraft[$build->minecraft]->md5;
$build->save();
}
}
示例14: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
Eloquent::unguard();
//$this->call('UserTableSeeder');
$this->call('ModpackTableTestSeeder');
$this->call('ModTableTestSeeder');
$this->call('ClientTableTestSeeder');
$this->call('KeyTableTestSeeder');
DB::table('build_modversion')->delete();
$testbuild = Build::find(1);
//Add testmodversion to testbuild
$testbuild->modversions()->attach(1);
}
示例15: start
public static function start()
{
//注册AUTOLOAD方法
spl_autoload_register('\\Core\\HF::autoload');
//自动生成目录
Build::checkDir();
//加载项目下配置文件
if (is_file(CONF_PATH . 'config.php')) {
C(include CONF_PATH . 'config.php');
}
//运行应用
App::run();
}