/** * キャッシュされたtgzの削除 */ public static function rm() { if (is_dir(self::$tgz_dir)) { foreach (File::ls(self::$tgz_dir, true) as $file) { File::rm($file->fullname()); } foreach (File::dirs(self::$tgz_dir, true) as $dir) { File::rm($dir); } } }
private static function read_server($http, $server, $uri, $tgz, $package_path) { if ($http->do_get($server . "__repository__.php" . "/state/" . $uri)->status() === 200) { if (Tag::setof($tag, $http->body(), "rest") && $tag->f("status.value()") == "success") { $http->do_download($server . "__repository__.php" . "/download/" . $uri, $tgz); File::untgz($tgz, getcwd()); File::rm($tgz); return true; } } return false; }
public static function __shutdown__() { if (self::$ftmp !== null && is_dir(self::ftpath())) { foreach (File::dirs(self::ftpath()) as $dir) { File::rm($dir); } } if (!empty(self::$TMP_DB)) { foreach (self::$TMP_DB as $db => $table) { $dobj = Db::connection($db); foreach ($table as $name => $value) { $dobj->drop_table($name); $dobj->commit(); } } } }
/** * vendorsをすべて更新する * -cでcoreも更新する * * -up [-c] */ public static function __setup_up__(Request $req, $value) { if ($req->is_vars("c") && defined("_JUMP_PATH_")) { if (empty($value) && defined("_CORE_URL_")) { $value = constant("_CORE_URL_"); } if (Http::request_status($value) === 404) { throw new InvalidArgumentException($value . " not found"); } File::rm(constant("_JUMP_PATH_"), false); File::untgz($value, constant("_JUMP_PATH_")); self::info_print('core updated'); } Lib::vendors_update(); self::info_print('vendors updated'); }
public static function __shutdown__() { if (!self::$in_test) { File::rm(self::tmp_path()); } }
/** * vendorsを更新する */ public static function vendors_update() { self::set_path(); if (is_dir(self::$vendor_path)) { File::rm(self::$vendor_path, false); } foreach (Lib::classes(true, true) as $key => $class) { Lib::import($key); } foreach (File::ls(App::path()) as $f) { if ($f->is_ext('php')) { $src = File::read($f); if (preg_match_all("/[^\\w](import|R|C)\\(([\"\\'])(.+?)\\2\\)/", $src, $match)) { foreach ($match[3] as $path) { try { self::import(trim($path)); } catch (Exception $e) { } } } if (Tag::setof($tag, $src, 'app')) { if (preg_match_all("/[^\\w]class=([\"\\'])(.+?)\\1/", $src, $match)) { foreach ($match[2] as $path) { try { self::import(trim($path)); } catch (Exceptions $e) { } } } } } } }