public function setUp() { parent::setUp(); $databaseUrl = __DIR__ . '/../tests/studs/testing.sqlite'; $runMigrate = false; $fileSystem = new \Illuminate\Filesystem\Filesystem(); if (!$this->inMemoryDb && !$fileSystem->exists($databaseUrl)) { $fileSystem->put($databaseUrl, ''); $runMigrate = true; fwrite(STDOUT, "\r\n- Migrate \r\n"); } $this->app['config']->set('app.key', 'SomeRandomStringWith32Characters'); $this->app['config']->set('app.debug', true); $this->app['config']->set('database.default', 'sqlite'); $this->app['config']->set('database.connections.sqlite.database', $this->inMemoryDb ? ':memory:' : $databaseUrl); if ($runMigrate || $this->inMemoryDb) { $this->migrate(); $this->createSiteAndAdminUser(); } // generally it is not run during console calls, but it is ok for testing, because // system knows that site's url is localhost app('veer')->run(); $admin = \Veer\Models\UserAdmin::where('banned', 0)->first(); \Auth::loginUsingId($admin->users_id); }
/** * Remove old chunks */ protected function removeOldData($filePath) { if ($this->storage->exists($filePath) && $this->storage->lastModified($filePath) < time() - $this->maxFileAge) { $this->storage->delete($filePath); } }
*/ use Illuminate\Remote; use Syncer\SSH; use Syncer\Credential\SshPubkeyAuthCredential; $conn = ['name' => 'lmodev', 'host' => 'lmodev2.lmo.com', 'username' => 'vimdev', 'auth' => ['key' => '/Users/goce/.ssh/passless_key']]; $dbCred = ['db-name' => 'ncarb_demo', 'host' => 'localhost', 'username' => "root", 'password' => 'root']; /* $connection = new Remote\Connection('remote', 'lmodev2.lmo.com', 'vimdev', ['key' => $conn['auth']['key']]); $connection->run("ls -all", function ($line) { echo "printing line" . PHP_EOL; });*/ /* Dump a DB Connection */ $db = new \Syncer\Credential\DatabaseCredential($dbCred['db-name'], $dbCred['username'], $dbCred['password']); //$adapter = new \League\Flysystem\Adapter\Local('/tmp'); $temp = new \Illuminate\Filesystem\Filesystem(); $dbDumpName = "db.dump." . $db->name() . "__" . time(); $localPath = '/tmp/' . $dbDumpName; $temp->put($localPath, "test"); $temp->exists($localPath) ? print "Hell YES" : (print "NOOOOooooooo!"); //$adapter->write($dbDumpName,"test"); /* Make a remote SSH Connection $cred = new SshPubkeyAuthCredential($conn['name'],$conn['host'],$conn['username'],$conn['auth']['key']); $ssh = new SSH('default',$cred); $ssh->run('ls -all',function($line){ echo "printing line" . PHP_EOL; echo $line; }); /**/
/** * Prepare public asset URL for filename-based cache busting. * More details https://github.com/h5bp/html5-boilerplate/blob/master/.htaccess * * @param string $file * @param string $url * @return string */ function cache_buster($file) { $files = new \Illuminate\Filesystem\Filesystem(); $path = rtrim(app()->basePath('public/'), '/') . DIRECTORY_SEPARATOR . $file; if ($files->exists($path)) { $filename = substr($file, 0, -strlen($files->extension($path)) - 1); $buster = $files->lastModified($path); $ext = $files->extension($path); return \Illuminate\Support\Facades\URL::to($filename . '.' . $buster . '.' . $ext); } throw new \Illuminate\Filesystem\FileNotFoundException("File does not exist at path {$path}"); }
public function getCartListElement() { $fileSystem = new \Illuminate\Filesystem\Filesystem(); if ($fileSystem->exists(DIR_BASE . '/application/elements/cart_list.php')) { View::element('cart_list', array('cart' => StoreCart::getCart())); } else { View::element('cart_list', array('cart' => StoreCart::getCart()), 'vivid_store'); } }
/** * put * * Create a file a file with the specified content * * @param string $path * @param string $content * @param string $directory (optional) * @param bool $createDirIfNotExists (optional) * @return BinaryFile */ public static function put($filename, $content, $directory = self::TMP_FOLDER_NAME, $createDirIfNotExists = true) { $fileSystem = new \Illuminate\Filesystem\Filesystem(); $directory = self::resolvePath($directory); if ($createDirIfNotExists && !$fileSystem->exists($directory)) { $fileSystem->makeDirectory($directory . DIRECTORY_SEPARATOR, 0755, true, true); } $path = $directory . DIRECTORY_SEPARATOR . $filename; $fileSystem->put($path, $content); return new BinaryFile($path); }