public static function get($class = null) { if ($class) { return make($class); } return $this->class ? make($this->class) : null; }
public function getAction() : callable { if ($this->resolvedAction !== null) { return $this->resolvedAction; } if (!$this->routeAction instanceof ControllerCallback) { return $this->resolvedAction = $this->routeAction; } /** @var ControllerCallback $callback */ $callback = $this->routeAction; $router = app()->getHttpRouter(); $values = $router->bind($router->extract($router->getContext(), $this), $this->getBindings()); $method = $callback->getMethod(); $class = $callback->getClass(); if ($class[0] === '@') { $class = substr($class, 1); if (!isset($values[$class])) { throw new \RuntimeException("Unknown controller variable '{$class}'"); } $class = $values[$class]->value(); } if ($method[0] === '@') { $method = substr($method, 1); if (!isset($values[$method])) { throw new \RuntimeException("Unknown controller variable '{$method}'"); } $method = $values[$method]->value(); } if (!$callback->isStatic()) { $class = make($class); } return $this->resolvedAction = [$class, $method]; }
public function init() { if (!$this->engine instanceof StorageContract) { $this->engine = make($this->engine); } $this->engine->timeout($this->expires); }
public function init() { $this->monolog = new MonoLogger($this->name); foreach ($this->targets as &$target) { $target = make($target); $this->monolog->pushHandler($target); } }
function init() { $arg = array_slice($_SERVER['argv'], 1); $arg = $arg ? $arg[0] : ''; if (in_array($arg, array('?', 'help'))) { exit("make.php\n"); } make(); }
protected function handleStart() { $pidFile = $this->blink->root . '/runtime/server.pid'; if (file_exists($pidFile)) { throw new InvalidValueException('The pidfile exists, it seems the server is already started'); } $server = (require $this->blink->root . '/src/config/server.php'); $server['asDaemon'] = 1; $server['pidFile'] = $this->blink->root . '/runtime/server.pid'; return make($server)->run(); }
/** * monitorserver start 命令 * * @return mixed * @throws \Kerisy\Core\InvalidConfigException */ protected function handleStart() { $pidFile = APPLICATION_PATH . '/runtime/monitorserver.pid'; if (file_exists($pidFile)) { throw new InvalidValueException('The pidfile exists, it seems the server is already started'); } $server = config('monitorservice')->all(); $server['asDaemon'] = 1; $server['pidFile'] = APPLICATION_PATH . '/runtime/monitorserver.pid'; return make($server)->run(); }
protected function handleStart() { $server = $this->getServerDefinition(); $pidFile = !empty($server['pidFile']) ? $server['pidFile'] : $this->blink->runtime . '/server.pid'; if (file_exists($pidFile)) { throw new InvalidValueException('The pidfile exists, it seems the server is already started'); } $server['asDaemon'] = 1; $server['pidFile'] = $pidFile; return make($server)->run(); }
public function calling() { if ($this->params['supplier'] == 33) { $res = $this->sql->table_exist('v8_sorted'); if (!$res) { make($this->sql); } return $this->sql->getByPage('v8_sorted', $this->params['start'], $this->params['limit'], ' 1 ORDER BY brand ASC, model ASC '); } return false; }
public function init() { foreach ($this->loaders as $format => $loader) { $loader = make($loader); $this->addLoader($format, $loader); } foreach ($this->resources as $resource) { if (!isset($resource['format'], $resource['resource'], $resource['locale'])) { throw new InvalidParamException('The resource item requires format, resource and locale keys.'); } $this->addResource($resource['format'], $resource['resource'], $resource['locale'], isset($resource['domain']) ? $resource['domain'] : null); } }
protected function handleStart() { $pidFile = APPLICATION_PATH . 'runtime/server.pid'; if (file_exists($pidFile)) { throw new InvalidValueException('The pidfile exists, it seems the server is already started'); } $server = config('service')->all(); $server['asDaemon'] = 1; $server['pidFile'] = APPLICATION_PATH . 'runtime/server.pid'; $serv = make($server); isset($this->getAliases()['alias_name']) && $serv->setAliasName($this->getAliases()['alias_name']); return $serv->run(); }
/** * @param string $name * @return bool|ValidatorInterface */ public function get(string $name) { if (!isset($this->validators[$name])) { if (isset($this->classes[$name])) { $validator = make($this->classes[$name]); if (!$validator instanceof ValidatorInterface) { return false; } return $this->validators[$name] = $validator; } } return isset($this->validators[$name]) ? $this->validators[$name] : false; }
public function run() { $app = $this->startApp(); $runner = new \blink\core\console\Application(['name' => 'Blink Command Runner', 'version' => Application::VERSION, 'blink' => $app]); foreach ($app->consoleCommands() as $command) { if (is_string($command)) { $command = ['class' => $command]; } $command['blink'] = $app; $runner->add(make($command)); } return $runner->run(new ArgvInput(), new ConsoleOutput()); }
/** * Call the middleware stack. * * @throws InvalidConfigException */ public function callMiddleware() { if ($this->_middlewareCalled) { return; } foreach ($this->middleware as $definition) { $middleware = make($definition); if (!$middleware instanceof MiddlewareContract) { throw new InvalidConfigException(sprintf("'%s' is not a valid middleware", get_class($middleware))); } if ($middleware->handle($this) === false) { break; } } $this->_middlewareCalled = true; }
/** * make (All component) */ function run() { global $do_chown, $builds_dir, $tests_path, $user, $jobs_dir, $jobs_tmp_dir; foreach (new DirectoryIterator($tests_path) as $d) { $name = null; $component = null; $tests = null; $replace_phpunitxml = false; if ($d->isDot() || $d->isDir() && in_array($d, array('AllTests', '_files'))) { continue; } if ($d->isFile() && in_array($d->getFileName(), array('DebugTest.php', 'RegistryTest.php', 'VersionTest.php'))) { $component = substr($d->getFilename(), 0, -8); $tests = "../../tests/Zend/" . $d->getFileName(); make($component, $tests, $user, $do_chown, true, $component . '.php'); make_job($component, $builds_dir, $jobs_tmp_dir, $user, $do_chown); } else { if ($d->getFilename() == 'Service') { foreach (new DirectoryIterator($d->getRealpath()) as $s) { if ($s->isDot()) { continue; } $component = "Service" . $s->getFilename(); $tests = "../../tests/Zend/Service/" . $s->getFilename(); make($component, $tests, $user, $do_chown, false, "Service/" . $s->getFilename()); make_job($component, $builds_dir, $jobs_tmp_dir, $user, $do_chown); } } else { $component = $d->getFilename(); $tests = "../../tests/Zend/" . $d->getFileName(); make($component, $tests, $user, $do_chown, false, $d->getFilename()); make_job($component, $builds_dir, $jobs_tmp_dir, $user, $do_chown); } } } }
public function handleConsole($input, $output) { $app = new \Kerisy\Core\Console\Application(['name' => 'Kerisy Command Runner', 'version' => self::VERSION, 'kerisy' => $this]); $commands = array_merge($this->commands, ['Kerisy\\Console\\ServerCommand', 'Kerisy\\Console\\ShellCommand', 'Kerisy\\Rpc\\Console\\RpcServerCommand', 'Kerisy\\Job\\JobServerCommand', 'Kerisy\\Console\\PHPCsCommand', 'Kerisy\\Monitor\\Console\\MonitorServerCommand']); foreach ($commands as $command) { $app->add(make(['class' => $command, 'kerisy' => $this])); } return $app->run($input, $output); }
function public_showmsg_two($uid) { global $_MooClass, $dbTablePre, $timestamp, $memcached, $user_arr; $time = time(); $lastmake = $memcached->get('lastmake' . $GLOBALS['MooUid']); //echo "<br />".$lastmake; //if(($lastmake+3)>$time){ $get_visitor_uid = $_MooClass['MooMySQL']->getOne("select uid from {$dbTablePre}service_visitor where visitorid={$uid} and who_del!=2 and visitortime>" . (time() - 600) . " and visitortime < " . (time() - 60) . " order by visitortime desc limit 1"); if ($get_visitor_uid) { if (MOOPHP_ALLOW_FASTDB) { $msg = MooFastdbGet('members_search', 'uid', $get_visitor_uid['uid']); } else { $sql = "SELECT * FROM {$dbTablePre}members_search where uid='{$get_visitor_uid['uid']}'"; $msg = $_MooClass['MooMySQL']->query($sql); } } else { //note 伪造 if ($user_arr['s_cid'] == 40) { make($uid, 1); } else { make($uid, 2); } } //} //} if ($msg) { return $msg; } else { return 0; } }
break; case 'commit-help': commit(true); break; case 'extract': xtract(); break; case 'init': init(); $c->writeln(); merge(); break; case 'make': cleanup(true); $c->writeln(); make(); break; case 'make-help': make_help(); break; case 'update': xtract(); $c->writeln(); merge(); break; case 'update-help': update_help(); break; case 'status': // xtract(); merge();
protected function createSession() { return make(['class' => Session::class, 'storage' => ['class' => FileStorage::class, 'path' => $this->sessionPath]]); }
protected function execute(InputInterface $input, OutputInterface $output) { $server = (require $this->blink->root . '/src/config/server.php'); return make($server)->run(); }
<?php /* * This file is part of the async generator runtime project. * * (c) Julien Bianchi <*****@*****.**> * * This source file is subject to the MIT license that is bundled * with this source code in the file LICENSE. */ require_once __DIR__ . '/../../vendor/autoload.php'; use function jubianchi\async\pipe\{make}; use function jubianchi\async\runtime\{await, all, fork}; use function jubianchi\async\time\{delay, throttle}; $pipe = make(); $i = 0; await(all(throttle(2500, function () use($pipe, &$i) { $pipe->enqueue($i++); }), throttle(500, function () use($pipe) { echo __LINE__; var_dump("[32m" . (yield from $pipe->dequeue()) . "[0m"); }), throttle(1000, function () use($pipe) { echo __LINE__; var_dump("[31m" . (yield from $pipe->dequeue()) . "[0m"); })));
protected function registerPlugins() { foreach ($this->plugins as $name => $definition) { $this->plugins[$name] = $plugin = make($definition); $plugin->install($this); } }
$accessToken = $client->authenticate($authCode); $client->setAccessToken($accessToken); //************************************************* Select Flow ************************************************************************** //$query = mysql_query("select * from files"); //$row = mysql_fetch_array($query); $flow = 'update'; //$row['flow']; if ($flow == 'down') { //************************************************** DOWNLOAD ***************************************************************************** $fileId = 1; //$row['fid']; $file = new Google_DriveFile(); $file = $service->files->get($fileId); $data = downloadFile($service, $file); $name = $file->getTitle(); make($data, $name); mysql_query("UPDATE files SET fname='" . $name . "' WHERE sr='1'") or die('error updating'); echo '<script type="text/javascript">'; echo 'window.location.href = "http://localhost/Dropbox-master/examples/putFile.php";'; echo '</script>'; } elseif ($flow == 'up') { //************************************************** UPLOAD **************************************************************************** $name = 'WorldCup2014.txt'; //Insert a file $file = new Google_DriveFile(); $file->setTitle($name); //$file->setDescription('A test document'); //$file->setMimeType('text/plain'); $data = file_get_contents($name); $createdFile = $service->files->insert($file, array('data' => $data)); print_r($createdFile);
function public_showmsg_two($uid) { global $_MooClass, $dbTablePre, $timestamp, $memcached, $user_arr, $_MooCookie; $time = time(); $msg = array(); // $lastmake = $memcached->get('lastmake'.$GLOBALS['MooUid']);//如果先前伪造了用户 // $visitortime = $time - 600; /* * $real_offest = $_MooCookie['real_offest']; if(empty($real_offest)){ * $real_offest=0; } */ $scan_space = $i_scan_space = $uid_scan_lock = false; $uid_scan_lock = $GLOBALS['memcached']->get($uid . '_scan'); $i_scan_space = empty($uid_scan_lock) ? $GLOBALS['fastdb']->get($uid . '_scan_space') : false; // 我浏览的全权会员 $i_scan_space = empty($i_scan_space) ? array() : json_decode($i_scan_space, true); $i_scan_space = is_array($i_scan_space) ? $i_scan_space : array(); if (!empty($i_scan_space)) { $scan_space = $i_scan_space; $scan_space_key = $uid . '_scan_space'; } else { $GLOBALS['fastdb']->set($uid . '_scan_space', json_encode($i_scan_space)); $scan_space = $GLOBALS['fastdb']->get('scan_space_' . $uid); // 浏览我的人员 $scan_space = empty($scan_space) ? array() : json_decode($scan_space, true); if (empty($scan_space) || !is_array($scan_space)) { $scan_space = array(); $GLOBALS['fastdb']->set('scan_space_' . $uid, json_encode($scan_space)); } $scan_space_key = 'scan_space_' . $uid; } if (empty($scan_space)) { $visitor_uid = isset($_MooCookie['visitor_uid']) ? $_MooCookie['visitor_uid'] : null; // 搜索访问您的会员 $get_visitor_uid = empty($visitor_uid) ? array() : $_MooClass['MooMySQL']->getOne("select uid from {$dbTablePre}service_browser where browserid=" . $uid . " order by browsertime desc limit 1"); /* * $real_offest++; MooSetCookie('real_offest',$real_offest,86400); */ // if($get_visitor_uid && $get_visitor_uid['uid'] != $visitor_uid){ if ($get_visitor_uid && $get_visitor_uid['uid']) { $other_uid = $get_visitor_uid['uid']; // MooSetCookie('visitor_uid',$msg['uid'],86400); } else { // note 伪造 // 高级会员 不伪造 (模拟) //if ($user_arr ['s_cid'] >= 40) { $other_uid = make($uid); // MooSetCookie('visitor_uid',$msg['uid'],86400); } } else { $other = array_shift($scan_space); $GLOBALS['fastdb']->set($scan_space_key, json_encode($scan_space)); $other_uid = is_array($other) ? $other[0] : $other; if ($scan_space_key == $uid . '_scan_space' && !empty($other_uid)) { $result = $_MooClass['MooMySQL']->getOne("SELECT `vid` FROM `{$dbTablePre}service_visitor` WHERE uid='{$other_uid}' AND visitorid='{$uid}' AND `who_del`!=2"); $visitortime = rand(1, 100) > 70 ? $timestamp : $timestamp - rand(60, 120) * 60; if ($result['vid']) { $_MooClass['MooMySQL']->query("UPDATE `{$dbTablePre}service_visitor` SET `visitortime`='{$visitortime}' WHERE `vid`={$result['vid']}"); } else { $_MooClass['MooMySQL']->query("INSERT INTO `{$dbTablePre}service_visitor` SET `uid`='{$other_uid}',`visitorid`='{$uid}',`visitortime`='{$visitortime}',`who_del`=1"); } $_MooClass['MooMySQL']->query("UPDATE `{$dbTablePre}members_login` SET `lastvisit`=" . $visitortime . " WHERE `uid`=" . $other_uid); MooFastdbUpdate('members_login', 'uid', $other_uid, array('lastvisit' => $visitortime)); } } if (empty($other_uid)) { return 0; } if (MOOPHP_ALLOW_FASTDB) { $msg = MooFastdbGet('members_search', 'uid', $other_uid); $msg_b = MooFastdbGet('members_base', 'uid', $other_uid); if (is_array($msg) && is_array($msg_b)) { $msg = array_merge($msg, $msg_b); } } else { $sql = "SELECT * FROM {$dbTablePre}members_search as s left join {$dbTablePre}members_base as b on s.uid=b.uid where s.uid='{$other_uid}'"; $msg = $_MooClass['MooMySQL']->getOne($sql); } // } // } if (!empty($msg)) { if (!empty($other) && is_array($other)) { $msg['user_show_time'] = $other[1]; } if ($scan_space_key == $uid . '_scan_space') { $msg['user_show_time'] = $visitortime; } $msg['fastdb'] = empty($other) ? 0 : 1; // 访问信息来源1队列 return $msg; } else { return 0; } }
public function handleConsole($input, $output) { $app = new \blink\core\console\Application(['name' => 'Blink Command Runner', 'version' => self::VERSION, 'blink' => $this]); $commands = array_merge($this->commands, ['blink\\console\\ServerCommand']); foreach ($commands as $command) { $app->add(make(['class' => $command, 'blink' => $this])); } return $app->run($input, $output); }
protected function fakeFile() { return make(['class' => File::class, 'name' => 'test.jpg', 'tmpName' => '/tmp/tmp.' . uniqid(), 'size' => 1024, 'type' => 'image/jpeg', 'error' => 0]); }