本文整理汇总了PHP中Build::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Build::create方法的具体用法?PHP Build::create怎么用?PHP Build::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Build
的用法示例。
在下文中一共展示了Build::create方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveApk
public function saveApk($file, $label, $name, $icon)
{
$fileSystem = new Filesystem();
$parser = new ApkParser\Parser($file->getRealPath());
$version = $parser->getManifest()->getVersionCode();
$bundle = $parser->getManifest()->getPackageName();
if (!$fileSystem->exists(public_path() . '/builds')) {
$fileSystem->makeDirectory(public_path() . '/builds');
}
if (!$fileSystem->exists(public_path() . '/builds/android')) {
$fileSystem->makeDirectory(public_path() . '/builds/android');
}
if (!$fileSystem->exists(public_path() . '/builds/android/' . $label)) {
$fileSystem->makeDirectory(public_path() . '/builds/android/' . $label);
}
if (!$fileSystem->exists(public_path() . '/builds/android/' . $label . '/' . $version)) {
$fileSystem->makeDirectory(public_path() . '/builds/android/' . $label . '/' . $version);
}
$label_model = Label::where('label_name', '=', $label)->where('build_type_id', '=', self::BUILD_ANDROID_TYPE_ID)->first();
if ($label_model != null) {
$version_model = $label_model->versions()->where('version', '=', $version)->first();
if ($version_model != null) {
$build_version_count = Build::where('version_id', '=', $version_model->id)->count();
$build = Build::create(array('bundle' => $bundle, 'name' => $name, 'version_id' => $version_model->id, 'build' => $build_version_count + 1));
} else {
$version_model = Version::create(array('version' => $version, 'label_id' => $label_model->id));
$build = Build::create(array('bundle' => $bundle, 'name' => $name, 'version_id' => $version_model->id, 'build' => 1));
}
} else {
$label_model = Label::create(array('label_name' => $label, 'build_type_id' => self::BUILD_ANDROID_TYPE_ID));
$version_model = Version::create(array('version' => $version, 'label_id' => $label_model->id));
$build = Build::create(array('bundle' => $bundle, 'name' => $name, 'version_id' => $version_model->id, 'build' => 1));
}
$fn = public_path() . '/builds/android/' . $label . '/' . $version . '/' . $build->build . '/' . $bundle . '.apk';
if (!$fileSystem->exists(public_path() . '/builds/android/' . $label . '/' . $version . '/' . $build->build)) {
$fileSystem->makeDirectory(public_path() . '/builds/android/' . $label . '/' . $version . '/' . $build->build);
}
$fileSystem->move($file->getRealPath(), $fn);
$fileSystem->move($icon->getRealPath(), public_path() . '/builds/android/' . $label . '/' . $version . '/' . $build->build . '/' . $bundle . '.png');
return Config::get("app.domain") . "/android/builds/{$label}/{$version}/{$build->build}";
}
示例2: 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));
}
示例3: scheduleBuilders
/**
* @brief Schedules builders discovered in @p dir directory.
*
* @param buildset Parent buildset for newly created builds.
* @param dir Directory to look for builders.
* @param suffix Additional suffix for builders path (appended to @p dir).
*
* @returns Array of scheduler builder names.
*/
function scheduleBuilders($buildset, $dir, $suffix)
{
$builders = [];
$basePath = "{$dir}/{$suffix}";
if (is_dir($basePath) && ($handle = opendir($basePath))) {
while (($entry = readdir($handle)) !== false) {
$path = "{$basePath}/{$entry}";
if (!is_dir($path) && $entry != '.' && $entry != '..') {
$builderName = "{$suffix}{$entry}";
Build::create($buildset, $builderName);
array_push($builders, $builderName);
}
}
closedir($handle);
}
return $builders;
}
示例4: addBundle
public function addBundle()
{
if (!Input::hasFile('ipa')) {
exit(0);
} else {
$ipa = Input::file('ipa');
}
$payload = exec("unzip -l " . $ipa->getRealPath() . " | sed -e 's/ /\\n/g' | grep app/Info.plist | sed -e 's/Info.plist//g'");
$default_icon = public_path() . "/images/default_icon.png";
$fileSystem = new Filesystem();
if (!$fileSystem->exists('/tmp/bundle')) {
$fileSystem->makeDirectory('/tmp/bundle');
}
if (!$fileSystem->exists('/tmp/bundle/tmp')) {
$fileSystem->makeDirectory('/tmp/bundle/tmp');
}
$path = "/tmp/bundle" . $ipa->getRealPath();
if ($fileSystem->exists($path)) {
$fileSystem->deleteDirectory($path);
}
$fileSystem->makeDirectory($path);
$zip = new ZipArchive();
$res = $zip->open($ipa->getRealPath());
if ($res === TRUE) {
$zip->extractTo($path);
$zip->close();
}
$dirs = scandir($path);
array_shift($dirs);
array_shift($dirs);
$APP_PATH = $path . "/" . $dirs[0];
$dirs = scandir($APP_PATH);
array_shift($dirs);
array_shift($dirs);
$APP_PATH = $APP_PATH . "/" . $dirs[0];
$plist = CFPropertyList::getInstance();
$plist->setFile($APP_PATH . "/Info.plist");
$plist->load();
$info = $plist->toArray();
$name = $info['CFBundleName'];
$build = isset($info['CFBundleVersion']) && array_key_exists("CFBundleVersion", $info) ? $info['CFBundleVersion'] : 1;
$version = isset($info['CFBundleShortVersionString']) && array_key_exists("CFBundleShortVersionString", $info) ? $info['CFBundleShortVersionString'] : 0;
if (array_key_exists("CFBundleIconFiles", $info)) {
$icons = $info['CFBundleIconFiles'];
} else {
if (array_key_exists("CFBundleIcons", $info)) {
$icons = $info["CFBundleIcons"]["CFBundlePrimaryIcon"]["CFBundleIconFiles"];
} else {
$icons = array();
}
}
$bundle = $info['CFBundleIdentifier'];
$label = $_POST['label'];
if (!$fileSystem->exists(public_path() . '/builds')) {
$fileSystem->makeDirectory(public_path() . '/builds');
}
if (!$fileSystem->exists(public_path() . '/builds/ios')) {
$fileSystem->makeDirectory(public_path() . '/builds/ios');
}
if (!$fileSystem->exists(public_path() . '/builds/ios/' . $label)) {
$fileSystem->makeDirectory(public_path() . '/builds/ios/' . $label);
}
if (!$fileSystem->exists(public_path() . '/builds/ios/' . $label . '/' . $version)) {
$fileSystem->makeDirectory(public_path() . '/builds/ios/' . $label . '/' . $version);
}
$icons_ready = array();
foreach ($icons as $icon) {
$img = "{$path}/tmp5646431.png";
$icon = str_replace(".png", "", $icon) . ".png";
$processor = PPngUncrush::getInstance();
if (is_file("{$APP_PATH}/{$icon}")) {
$processor->setFilePath("{$APP_PATH}/{$icon}");
try {
$processor->decode($img . $icon);
} catch (ErrorException $e) {
$img = $default_icon;
$icon = "";
}
$sz = getimagesize($img . $icon);
$icons_ready[] = array("image" => $img . $icon, "size" => $sz);
}
// $fileSystem->copy($img.$icon ,public_path().'/builds/ios/'.$label.'/'.$version.'/'.$bundle.$sz[0].'x'.$sz[1].'.png');
}
$label_model = Label::where('label_name', '=', $label)->where('build_type_id', '=', self::BUILD_IOS_TYPE_ID)->first();
if ($label_model != null) {
$version_model = $label_model->versions()->where('version', '=', $version)->first();
if ($version_model != null) {
$build_version_count = Build::where('version_id', '=', $version_model->id)->count();
$build = Build::create(array('bundle' => $bundle, 'name' => $name, 'version_id' => $version_model->id, 'build' => $build_version_count + 1));
} else {
$version_model = Version::create(array('version' => $version, 'label_id' => $label_model->id));
$build = Build::create(array('bundle' => $bundle, 'name' => $name, 'version_id' => $version_model->id, 'build' => 1));
}
} else {
$label_model = Label::create(array('label_name' => $label, 'build_type_id' => self::BUILD_IOS_TYPE_ID));
$version_model = Version::create(array('version' => $version, 'label_id' => $label_model->id));
$build = Build::create(array('bundle' => $bundle, 'name' => $name, 'version_id' => $version_model->id, 'build' => 1));
}
$fn = public_path() . '/builds/ios/' . $label . '/' . $version . '/' . $build->build . '/' . $bundle . '.ipa';
if (!$fileSystem->exists(public_path() . '/builds/ios/' . $label . '/' . $version . '/' . $build->build)) {
//.........这里部分代码省略.........
示例5: installMods
function installMods($mods)
{
global $config, $db, $user, $auth, $template, $cache;
global $phpbb_root_path, $phpbb_admin_path, $phpEx, $table_prefix;
$res = $db->sql_query(
'SELECT style_name FROM ' . $table_prefix
. 'styles WHERE style_id = ' . $config['default_style']
);
$this->style = $db->sql_fetchfield('style_name');
$build = Build::create();
foreach ($mods as $modName)
$build->addMod(Mod::create()->setName($modName));
try {
$deps = $build->getDependences('style');
} catch (Exception $e) {
return null;
}
if ($deps && !in_array($this->style, $deps)) {
return $build;
} else {
try {
InstallAction::me()->setBuild($build)->run();
file_put_contents(
USER_DIR . DIRECTORY_SEPARATOR . '.htaccess',
str_replace(
$this->build->getHash(),
$build->getHash(),
file_get_contents(
USER_DIR . DIRECTORY_SEPARATOR . '.htaccess'
)
)
);
file_put_contents(
USER_DIR . DIRECTORY_SEPARATOR . 'nginx.rewrite',
str_replace(
$this->build->getHash(),
$build->getHash(),
file_get_contents(
USER_DIR . DIRECTORY_SEPARATOR . 'nginx.rewrite'
)
)
);
} catch (Exception $e) {
trigger_error($e->getMessage(),E_USER_WARNING);
}
}
return $this;
}